BsScriptGUIEnumField.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEditorPrerequisites.h"
  5. #include "Wrappers/GUI/BsScriptGUIElement.h"
  6. namespace bs
  7. {
  8. /** @addtogroup ScriptInteropEditor
  9. * @{
  10. */
  11. /**
  12. * Interop class between C++ & CLR for GUIListBoxField, with some specific functionality meant for displaying managed
  13. * enumeration values.
  14. */
  15. class BS_SCR_BED_EXPORT ScriptGUIEnumField : public TScriptGUIElement<ScriptGUIEnumField>
  16. {
  17. public:
  18. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIEnumField")
  19. private:
  20. /**
  21. * Triggered when the value in the native list box selection changes.
  22. *
  23. * @param[in] newIndex Index of the selected element.
  24. * @param[in] enabled Determines whether the element at the selection index was enabled or disabled.
  25. */
  26. void onSelectionChanged(UINT64 newIndex, bool enabled);
  27. ScriptGUIEnumField(MonoObject* instance, GUIListBoxField* listBoxField, const Vector<UINT64>& values);
  28. Vector<UINT64> mValues;
  29. /************************************************************************/
  30. /* CLR HOOKS */
  31. /************************************************************************/
  32. static void internal_createInstance(MonoObject* instance, MonoArray* names, MonoArray* values, bool multiselect,
  33. MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle);
  34. static UINT64 internal_getValue(ScriptGUIEnumField* nativeInstance);
  35. static void internal_setValue(ScriptGUIEnumField* nativeInstance, UINT64 value);
  36. static void internal_setTint(ScriptGUIEnumField* nativeInstance, Color* color);
  37. static void internal_selectElement(ScriptGUIEnumField* nativeInstance, int idx);
  38. static void internal_deselectElement(ScriptGUIEnumField* nativeInstance, int idx);
  39. static MonoArray* internal_getElementStates(ScriptGUIEnumField* nativeInstance);
  40. static void internal_setElementStates(ScriptGUIEnumField* nativeInstance, MonoArray* states);
  41. typedef void(BS_THUNKCALL *OnSelectionChangedThunkDef) (MonoObject*, UINT64, MonoException**);
  42. static OnSelectionChangedThunkDef onSelectionChangedThunk;
  43. };
  44. /** @} */
  45. }