BsScriptDropDownWindow.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include "BsScriptEditorPrerequisites.h"
  3. #include "BsScriptObject.h"
  4. #include "BsDropDownWindow.h"
  5. #include "BsVector2I.h"
  6. namespace BansheeEngine
  7. {
  8. class ManagedDropDownWindow;
  9. class BS_SCR_BED_EXPORT ScriptDropDownWindow : public ScriptObject <ScriptDropDownWindow>
  10. {
  11. public:
  12. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "DropDownWindow")
  13. ~ScriptDropDownWindow();
  14. private:
  15. friend class ManagedDropDownWindow;
  16. ScriptDropDownWindow(ManagedDropDownWindow* window);
  17. static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* parentWindow, Vector2I position, int width, int height);
  18. static void internal_Close(ScriptDropDownWindow* nativeInstance);
  19. static void internal_SetWidth(ScriptDropDownWindow* nativeInstance, UINT32 value);
  20. static void internal_SetHeight(ScriptDropDownWindow* nativeInstance, UINT32 value);
  21. static void internal_ScreenToWindowPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* windowPos);
  22. static void internal_WindowToScreenPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* screenPos);
  23. void onAssemblyRefreshStarted();
  24. void notifyWindowClosed();
  25. ManagedDropDownWindow* mDropDownWindow;
  26. HEvent mOnAssemblyRefreshStartedConn;
  27. static MonoField* guiPanelField;
  28. };
  29. class BS_SCR_BED_EXPORT ManagedDropDownWindow : public DropDownWindow
  30. {
  31. public:
  32. ManagedDropDownWindow(const RenderWindowPtr& parent, Viewport* target,
  33. const Vector2I& position, MonoObject* managedInstance, UINT32 width, UINT32 height);
  34. ~ManagedDropDownWindow();
  35. void initialize(ScriptDropDownWindow* parent);
  36. void update() override;
  37. void reloadMonoTypes(MonoClass* windowClass);
  38. void triggerOnInitialize();
  39. void triggerOnDestroy();
  40. MonoObject* getManagedInstance() const { return mManagedInstance; }
  41. private:
  42. friend class ScriptModalWindow;
  43. typedef void(__stdcall *OnInitializeThunkDef) (MonoObject*, MonoException**);
  44. typedef void(__stdcall *OnDestroyThunkDef) (MonoObject*, MonoException**);
  45. typedef void(__stdcall *UpdateThunkDef) (MonoObject*, MonoException**);
  46. String mNamespace;
  47. String mTypename;
  48. OnInitializeThunkDef mOnInitializeThunk;
  49. OnDestroyThunkDef mOnDestroyThunk;
  50. UpdateThunkDef mUpdateThunk;
  51. MonoObject* mManagedInstance;
  52. uint32_t mGCHandle;
  53. ScriptDropDownWindow* mScriptParent;
  54. ScriptGUILayout* mContentsPanel;
  55. };
  56. }