BsScriptGUIToggle.h 2.6 KB

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