2
0

BsScriptGUIEnumField.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 "BsScriptGUIElement.h"
  6. namespace BansheeEngine
  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] instance Managed GUIEnumField instance.
  24. * @param[in] newIndex Index of the selected element.
  25. * @param[in] enabled Determines whether the element at the selection index was enabled or disabled.
  26. */
  27. static void onSelectionChanged(MonoObject* instance, UINT64 newIndex, bool enabled);
  28. ScriptGUIEnumField(MonoObject* instance, GUIListBoxField* listBoxField, const Vector<UINT64>& values);
  29. Vector<UINT64> mValues;
  30. /************************************************************************/
  31. /* CLR HOOKS */
  32. /************************************************************************/
  33. static void internal_createInstance(MonoObject* instance, MonoArray* names, MonoArray* values, bool multiselect,
  34. MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle);
  35. static UINT64 internal_getValue(ScriptGUIEnumField* nativeInstance);
  36. static void internal_setValue(ScriptGUIEnumField* nativeInstance, UINT64 value);
  37. static void internal_setTint(ScriptGUIEnumField* nativeInstance, Color* color);
  38. static void internal_selectElement(ScriptGUIEnumField* nativeInstance, int idx);
  39. static void internal_deselectElement(ScriptGUIEnumField* nativeInstance, int idx);
  40. static MonoArray* internal_getElementStates(ScriptGUIEnumField* nativeInstance);
  41. static void internal_setElementStates(ScriptGUIEnumField* nativeInstance, MonoArray* states);
  42. typedef void(__stdcall *OnSelectionChangedThunkDef) (MonoObject*, UINT64, MonoException**);
  43. static OnSelectionChangedThunkDef onSelectionChangedThunk;
  44. };
  45. /** @} */
  46. }