BsScriptGUIToggle.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include "BsScriptEnginePrerequisites.h"
  3. #include "BsScriptGUIElement.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Interop class between C++ & CLR for GUIToggle.
  8. */
  9. class BS_SCR_BE_EXPORT ScriptGUIToggle : public TScriptGUIElement<ScriptGUIToggle>
  10. {
  11. public:
  12. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIToggle")
  13. private:
  14. ScriptGUIToggle(MonoObject* instance, GUIToggle* toggle);
  15. /**
  16. * @brief Triggered when the native toggle button is clicked.
  17. */
  18. static void onClick(MonoObject* instance);
  19. /**
  20. * @brief Triggered when the native toggle button is hover over.
  21. */
  22. static void onHover(MonoObject* instance);
  23. /**
  24. * @brief Triggered when the pointer leaves the native toggle button.
  25. */
  26. static void onOut(MonoObject* instance);
  27. /**
  28. * @brief Triggered when the native toggle button is toggled.
  29. */
  30. static void onToggled(MonoObject* instance, bool toggled);
  31. /**
  32. * @brief Triggers when the native toggle button is double-clicked.
  33. */
  34. static void onDoubleClick(MonoObject* instance);
  35. /************************************************************************/
  36. /* CLR HOOKS */
  37. /************************************************************************/
  38. static void internal_createInstance(MonoObject* instance, MonoObject* content,
  39. MonoObject* toggleGroup, MonoString* style, MonoArray* guiOptions);
  40. static void internal_setContent(ScriptGUIToggle* nativeInstance, MonoObject* content);
  41. static bool internal_getValue(ScriptGUIToggle* nativeInstance);
  42. static void internal_setValue(ScriptGUIToggle* nativeInstance, bool value);
  43. static void internal_setTint(ScriptGUIToggle* nativeInstance, Color color);
  44. typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
  45. typedef void (__stdcall *OnHoverThunkDef) (MonoObject*, MonoException**);
  46. typedef void (__stdcall *OnOutThunkDef) (MonoObject*, MonoException**);
  47. typedef void (__stdcall *OnToggledThunkDef) (MonoObject*, bool toggled, MonoException**);
  48. typedef void(__stdcall *OnDoubleClickThunkDef) (MonoObject*, MonoException**);
  49. static OnClickThunkDef onClickThunk;
  50. static OnHoverThunkDef onHoverThunk;
  51. static OnOutThunkDef onOutThunk;
  52. static OnToggledThunkDef onToggledThunk;
  53. static OnDoubleClickThunkDef onDoubleClickThunk;
  54. };
  55. }