BsScriptGUIToggle.h 2.4 KB

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