BsScriptGUIResourceField.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "BsScriptEditorPrerequisites.h"
  3. #include "BsScriptGUIElement.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Interop class between C++ & CLR for GUIResourceField.
  8. */
  9. class BS_SCR_BED_EXPORT ScriptGUIResourceField : public TScriptGUIElement<ScriptGUIResourceField>
  10. {
  11. public:
  12. SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIResourceField")
  13. private:
  14. /**
  15. * @brief Triggered when the value in the native resource field changes.
  16. *
  17. * @param instance Managed GUIResourceField instance.
  18. * @param newValue UUID of the newly selected resource.
  19. */
  20. static void onChanged(MonoObject* instance, const String& newUUID);
  21. /**
  22. * @brief Retrieves a managed instance of the specified native resource.
  23. * Will return null if one doesn't exist.
  24. */
  25. static MonoObject* nativeToManagedResource(const HResource& instance);
  26. ScriptGUIResourceField(MonoObject* instance, GUIResourceField* resourceField);
  27. /************************************************************************/
  28. /* CLR HOOKS */
  29. /************************************************************************/
  30. static void internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
  31. MonoString* style, MonoArray* guiOptions, bool withTitle);
  32. static void internal_getValue(ScriptGUIResourceField* nativeInstance, MonoObject** output);
  33. static void internal_setValue(ScriptGUIResourceField* nativeInstance, MonoObject* value);
  34. static void internal_setTint(ScriptGUIResourceField* nativeInstance, Color color);
  35. typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
  36. static OnChangedThunkDef onChangedThunk;
  37. };
  38. }