BsScriptOSDropTarget.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "BsScriptEditorPrerequisites.h"
  3. #include "BsScriptObject.h"
  4. #include "BsRect2I.h"
  5. namespace BansheeEngine
  6. {
  7. class BS_SCR_BED_EXPORT ScriptOSDropTarget : public ScriptObject <ScriptOSDropTarget>
  8. {
  9. public:
  10. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "OSDropTarget")
  11. private:
  12. ScriptEditorWindow* mParent;
  13. OSDropTarget* mDropTarget;
  14. Rect2I mParentArea;
  15. Rect2I mArea;
  16. bool mIsDestroyed;
  17. HEvent mDropTargetEnterConn;
  18. HEvent mDropTargetMoveConn;
  19. HEvent mDropTargetLeaveConn;
  20. HEvent mDropTargetDroppedConn;
  21. HEvent mWidgetParentChangedConn;
  22. HEvent mWidgetMovedConn;
  23. HEvent mWidgetResizedConn;
  24. ScriptOSDropTarget(MonoObject* instance, ScriptEditorWindow* parent);
  25. ~ScriptOSDropTarget();
  26. void destroy();
  27. void setDropTarget(const RenderWindowPtr& parentWindow, INT32 x, INT32 y, UINT32 width, UINT32 height);
  28. void setBounds(const Rect2I& bounds);
  29. void widgetParentChanged(EditorWidgetContainer* parent);
  30. void widgetResized(UINT32 width, UINT32 height);
  31. void widgetMoved(INT32 x, INT32 y);
  32. EditorWidgetBase* getParentWidget() const;
  33. Rect2I getDropTargetArea() const;
  34. typedef void(__stdcall *OnEnterThunkDef) (MonoObject*, INT32, INT32, MonoException**);
  35. typedef void(__stdcall *OnMoveDef) (MonoObject*, INT32, INT32, MonoException**);
  36. typedef void(__stdcall *OnLeaveDef) (MonoObject*, MonoException**);
  37. typedef void(__stdcall *OnDropThunkDef) (MonoObject*, INT32, INT32, MonoException**);
  38. static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* editorWindow);
  39. static void internal_Destroy(ScriptOSDropTarget* nativeInstance);
  40. static void internal_SetBounds(ScriptOSDropTarget* nativeInstance, Rect2I bounds);
  41. static MonoArray* internal_GetFilePaths(ScriptOSDropTarget* nativeInstance);
  42. static void dropTargetDragEnter(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
  43. static void dropTargetDragMove(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
  44. static void dropTargetDragLeave(ScriptOSDropTarget* thisPtr);
  45. static void dropTargetDragDropped(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
  46. static OnEnterThunkDef onEnterThunk;
  47. static OnMoveDef onMoveThunk;
  48. static OnLeaveDef onLeaveThunk;
  49. static OnDropThunkDef onDropThunk;
  50. };
  51. }