CmPlatform.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "CmPlatform.h"
  2. namespace CamelotFramework
  3. {
  4. OSDropTarget::OSDropTarget(const RenderWindow* ownerWindow, INT32 x, INT32 y, UINT32 width, UINT32 height)
  5. :mOwnerWindow(ownerWindow), mX(x), mY(y), mWidth(width), mHeight(height), mDropType(OSDropType::None),
  6. mFileList(nullptr), mActive(false)
  7. {
  8. }
  9. OSDropTarget::~OSDropTarget()
  10. {
  11. _clear();
  12. }
  13. void OSDropTarget::setArea(INT32 x, INT32 y, UINT32 width, UINT32 height)
  14. {
  15. mX = x;
  16. mY = y;
  17. mWidth = width;
  18. mHeight = height;
  19. }
  20. void OSDropTarget::_clear()
  21. {
  22. if(mFileList != nullptr)
  23. {
  24. cm_delete(mFileList);
  25. mFileList = nullptr;
  26. }
  27. }
  28. bool OSDropTarget::_isInside(const Int2& pos) const
  29. {
  30. INT32 right = mX + mWidth;
  31. INT32 bottom = mY + mHeight;
  32. return (pos.x >= mX && pos.x < right && pos.y >= mY && pos.y < bottom);
  33. }
  34. void OSDropTarget::_setFileList(const Vector<WString>::type& fileList)
  35. {
  36. _clear();
  37. mFileList = cm_new<Vector<WString>::type>();
  38. *mFileList = fileList;
  39. }
  40. }