BsGUIResourceField.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. #include "BsScriptEditorPrerequisites.h"
  3. #include "BsGUIElementContainer.h"
  4. namespace BansheeEngine
  5. {
  6. class BS_SCR_BED_EXPORT GUIResourceField : public GUIElementContainer
  7. {
  8. struct PrivatelyConstruct {};
  9. public:
  10. static const String& getGUITypeName();
  11. static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
  12. const String& style = StringUtil::BLANK);
  13. static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, const GUIOptions& layoutOptions,
  14. const String& style = StringUtil::BLANK);
  15. static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
  16. const String& style = StringUtil::BLANK);
  17. static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText, const GUIOptions& layoutOptions,
  18. const String& style = StringUtil::BLANK);
  19. static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
  20. static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
  21. const String& style = StringUtil::BLANK);
  22. static GUIResourceField* create(const String& typeNamespace, const String& type, const GUIContent& labelContent,
  23. const String& style = StringUtil::BLANK);
  24. static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText, UINT32 labelWidth,
  25. const String& style = StringUtil::BLANK);
  26. static GUIResourceField* create(const String& typeNamespace, const String& type, const HString& labelText,
  27. const String& style = StringUtil::BLANK);
  28. static GUIResourceField* create(const String& typeNamespace, const String& type, const String& style = StringUtil::BLANK);
  29. GUIResourceField(const PrivatelyConstruct& dummy, const String& typeNamespace, const String& type, const GUIContent& labelContent,
  30. UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
  31. HResource getValue() const;
  32. void setValue(const HResource& value);
  33. String getUUID() const { return mUUID; }
  34. void setUUID(const String& uuid);
  35. /**
  36. * @copydoc GUIElement::setTint
  37. */
  38. virtual void setTint(const Color& color);
  39. void _updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
  40. Rect2I clipRect, UINT8 widgetDepth, UINT16 areaDepth);
  41. Vector2I _getOptimalSize() const;
  42. Event<void(const String&)> onValueChanged;
  43. private:
  44. virtual ~GUIResourceField();
  45. void styleUpdated();
  46. void dataDropped(void* data);
  47. void onClearButtonClicked();
  48. private:
  49. static const UINT32 DEFAULT_LABEL_WIDTH;
  50. GUILayout* mLayout;
  51. GUILabel* mLabel;
  52. GUIDropButton* mDropButton;
  53. GUIButton* mClearButton;
  54. String mNamespace;
  55. String mType;
  56. String mUUID;
  57. };
  58. }