BsGUIGameObjectField.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIElementContainer.h"
  4. namespace BansheeEditor
  5. {
  6. class BS_ED_EXPORT GUIGameObjectField : public BS::GUIElementContainer
  7. {
  8. struct PrivatelyConstruct {};
  9. public:
  10. static const CM::String& getGUITypeName();
  11. static GUIGameObjectField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent,
  12. const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
  13. BS::GUIElementStyle* clearButtonStyle = nullptr);
  14. static GUIGameObjectField* create(BS::GUIWidget& parent, const CM::HString& labelText,
  15. const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
  16. BS::GUIElementStyle* clearButtonStyle = nullptr);
  17. static GUIGameObjectField* create(BS::GUIWidget& parent,
  18. const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
  19. BS::GUIElementStyle* clearButtonStyle = nullptr);
  20. static GUIGameObjectField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent,
  21. BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
  22. BS::GUIElementStyle* clearButtonStyle = nullptr);
  23. static GUIGameObjectField* create(BS::GUIWidget& parent, const CM::HString& labelText,
  24. BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
  25. BS::GUIElementStyle* clearButtonStyle = nullptr);
  26. static GUIGameObjectField* create(BS::GUIWidget& parent,
  27. BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
  28. BS::GUIElementStyle* clearButtonStyle = nullptr);
  29. GUIGameObjectField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent,
  30. BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle,
  31. BS::GUIElementStyle* clearButtonStyle, const BS::GUILayoutOptions& layoutOptions);
  32. GUIGameObjectField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent,
  33. BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle,
  34. BS::GUIElementStyle* clearButtonStyle, const BS::GUILayoutOptions& layoutOptions);
  35. CM::HGameObject getValue() const;
  36. void setValue(const CM::HGameObject& value);
  37. void setLabelWidth(CM::UINT32 width);
  38. void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
  39. CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
  40. CM::Vector2I _getOptimalSize() const;
  41. private:
  42. virtual ~GUIGameObjectField();
  43. void construct(BS::GUIWidget& parent, const BS::GUIContent& labelContent,
  44. BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle,
  45. BS::GUIElementStyle* clearButtonStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
  46. void dataDropped(void* data);
  47. private:
  48. CM::UINT32 mLabelWidth;
  49. BS::GUILayout* mLayout;
  50. BS::GUILabel* mLabel;
  51. GUIDropButton* mDropButton;
  52. BS::GUIButton* mClearButton;
  53. CM::UINT64 mInstanceId;
  54. };
  55. }