BsScriptGUIResourceField.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. /** Interop class between C++ & CLR for GUIResourceField. */
  12. class BS_SCR_BED_EXPORT ScriptGUIResourceField : public TScriptGUIElement<ScriptGUIResourceField>
  13. {
  14. public:
  15. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIResourceField")
  16. private:
  17. /**
  18. * Triggered when the value in the native resource field changes.
  19. *
  20. * @param[in] newHandle Weak handle of the newly selected resource.
  21. */
  22. void onChanged(const WeakResourceHandle<Resource>& newHandle);
  23. /** Retrieves a managed instance of the specified native resource. Will return null if one doesn't exist. */
  24. static MonoObject* nativeToManagedResource(const HResource& instance);
  25. ScriptGUIResourceField(MonoObject* instance, GUIResourceField* resourceField);
  26. /************************************************************************/
  27. /* CLR HOOKS */
  28. /************************************************************************/
  29. static void internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title,
  30. UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle);
  31. static void internal_getValue(ScriptGUIResourceField* nativeInstance, MonoObject** output);
  32. static void internal_setValue(ScriptGUIResourceField* nativeInstance, MonoObject* value);
  33. static void internal_getValueRef(ScriptGUIResourceField* nativeInstance, MonoObject** output);
  34. static void internal_setValueRef(ScriptGUIResourceField* nativeInstance, MonoObject* value);
  35. static void internal_setTint(ScriptGUIResourceField* nativeInstance, Color* color);
  36. typedef void(BS_THUNKCALL *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
  37. static OnChangedThunkDef onChangedThunk;
  38. };
  39. /** @} */
  40. }