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