| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #pragma once
- #include "BsEditorPrerequisites.h"
- #include "BsGUIElementContainer.h"
- namespace BansheeEditor
- {
- class BS_ED_EXPORT GUIFieldBase : public BS::GUIElementContainer
- {
- protected:
- struct PrivatelyConstruct {};
- public:
- GUIFieldBase(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
- BS::GUIElementStyle* labelStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
- void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
- CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
- CM::Vector2I _getOptimalSize() const;
- protected:
- virtual ~GUIFieldBase() { }
- protected:
- static const CM::UINT32 DEFAULT_LABEL_WIDTH;
- BS::GUILayout* mLayout;
- BS::GUILabel* mLabel;
- };
- template <class T>
- class TGUIField : public GUIFieldBase
- {
- public:
- static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, labelContent, labelWidth, labelStyle, entryElementStyle,
- GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, const BS::GUIOptions& layoutOptions,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, labelContent, DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle,
- GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), labelWidth, labelStyle, entryElementStyle,
- GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, const CM::HString& labelText, const BS::GUIOptions& layoutOptions,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle,
- GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(), 0, nullptr, entryElementStyle,
- GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), false);
- }
- static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, labelContent, labelWidth, labelStyle, entryElementStyle,
- GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, labelContent, DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle,
- GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), labelWidth, labelStyle, entryElementStyle,
- GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, const CM::HString& labelText,
- BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle,
- GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
- }
- static T* create(BS::GUIWidget& parent, BS::GUIElementStyle* entryElementStyle = nullptr)
- {
- return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(), 0, nullptr, entryElementStyle,
- GUILayoutOptions::create(&GUISkin::DefaultStyle), false);
- }
- TGUIField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
- BS::GUIElementStyle* labelStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel)
- :GUIFieldBase(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel)
- { }
- };
- }
|