BsScriptGUIToggle.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. /* CLR HOOKS */
  33. /************************************************************************/
  34. static void internal_createInstance(MonoObject* instance, MonoObject* content,
  35. MonoObject* toggleGroup, MonoString* style, MonoArray* guiOptions);
  36. static void internal_setContent(ScriptGUIToggle* nativeInstance, MonoObject* content);
  37. static void internal_toggleOn(ScriptGUIToggle* nativeInstance);
  38. static void internal_toggleOff(ScriptGUIToggle* nativeInstance);
  39. static void internal_setTint(ScriptGUIToggle* nativeInstance, Color color);
  40. typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
  41. typedef void (__stdcall *OnHoverThunkDef) (MonoObject*, MonoException**);
  42. typedef void (__stdcall *OnOutThunkDef) (MonoObject*, MonoException**);
  43. typedef void (__stdcall *OnToggledThunkDef) (MonoObject*, bool toggled, MonoException**);
  44. static OnClickThunkDef onClickThunk;
  45. static OnHoverThunkDef onHoverThunk;
  46. static OnOutThunkDef onOutThunk;
  47. static OnToggledThunkDef onToggledThunk;
  48. };
  49. }