BsScriptGUIToggle.h 2.4 KB

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