|
|
@@ -16,32 +16,21 @@ using namespace std::placeholders;
|
|
|
namespace BansheeEngine
|
|
|
{
|
|
|
const UINT32 GUIGameObjectField::DEFAULT_LABEL_WIDTH = 100;
|
|
|
- const String GUIGameObjectField::DROP_BUTTON_STYLE = "DropButton";
|
|
|
- const String GUIGameObjectField::CLEAR_BUTTON_STYLE = "ObjectClearButton";
|
|
|
|
|
|
GUIGameObjectField::GUIGameObjectField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
|
|
|
- :GUIElementContainer(layoutOptions), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mInstanceId(0)
|
|
|
+ const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
|
|
|
+ :GUIElementContainer(layoutOptions, style), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mInstanceId(0)
|
|
|
{
|
|
|
mLayout = &addLayoutXInternal(this);
|
|
|
|
|
|
if(withLabel)
|
|
|
{
|
|
|
- mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), labelStyle);
|
|
|
+ mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), getSubStyleName(getLabelStyleType()));
|
|
|
mLayout->addElement(mLabel);
|
|
|
}
|
|
|
|
|
|
- const String* curDropButtonStyle = &dropButtonStyle;
|
|
|
- const String* curClearButtonStyle = &clearButtonStyle;
|
|
|
-
|
|
|
- if(*curDropButtonStyle == StringUtil::BLANK)
|
|
|
- curDropButtonStyle = &DROP_BUTTON_STYLE;
|
|
|
-
|
|
|
- if(*curClearButtonStyle == StringUtil::BLANK)
|
|
|
- curClearButtonStyle = &CLEAR_BUTTON_STYLE;
|
|
|
-
|
|
|
- mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), *curDropButtonStyle);
|
|
|
- mClearButton = GUIButton::create(HString(L""), *curClearButtonStyle);
|
|
|
+ mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(getDropButtonStyleType()));
|
|
|
+ mClearButton = GUIButton::create(HString(L""), getSubStyleName(getClearButtonStyleType()));
|
|
|
|
|
|
mLayout->addElement(mDropButton);
|
|
|
mLayout->addElement(mClearButton);
|
|
|
@@ -55,71 +44,110 @@ namespace BansheeEngine
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, labelWidth, *curStyle,
|
|
|
GUILayoutOptions::create(layoutOptions), true);
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const GUIContent& labelContent, const GUIOptions& layoutOptions,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
|
|
|
GUILayoutOptions::create(layoutOptions), true);
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), labelWidth, *curStyle,
|
|
|
GUILayoutOptions::create(layoutOptions), true);
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const HString& labelText, const GUIOptions& layoutOptions,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
|
|
|
GUILayoutOptions::create(layoutOptions), true);
|
|
|
}
|
|
|
|
|
|
- GUIGameObjectField* GUIGameObjectField::create(const GUIOptions& layoutOptions, const String& dropButtonStyle,
|
|
|
- const String& clearButtonStyle)
|
|
|
+ GUIGameObjectField* GUIGameObjectField::create(const GUIOptions& layoutOptions, const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(), 0, nullptr, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(), 0, *curStyle,
|
|
|
GUILayoutOptions::create(layoutOptions), false);
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const GUIContent& labelContent, UINT32 labelWidth,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, labelWidth, *curStyle,
|
|
|
GUILayoutOptions::create(), true);
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const GUIContent& labelContent,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
|
|
|
GUILayoutOptions::create(), true);
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const HString& labelText, UINT32 labelWidth,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), labelWidth, *curStyle,
|
|
|
GUILayoutOptions::create(), true);
|
|
|
}
|
|
|
|
|
|
GUIGameObjectField* GUIGameObjectField::create(const HString& labelText,
|
|
|
- const String& labelStyle, const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
|
|
|
GUILayoutOptions::create(), true);
|
|
|
}
|
|
|
|
|
|
- GUIGameObjectField* GUIGameObjectField::create(const String& dropButtonStyle, const String& clearButtonStyle)
|
|
|
+ GUIGameObjectField* GUIGameObjectField::create(const String& style)
|
|
|
{
|
|
|
- return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(), 0, nullptr, dropButtonStyle, clearButtonStyle,
|
|
|
+ const String* curStyle = &style;
|
|
|
+ if (*curStyle == StringUtil::BLANK)
|
|
|
+ curStyle = &getGUITypeName();
|
|
|
+
|
|
|
+ return bs_new<GUIGameObjectField>(PrivatelyConstruct(), GUIContent(), 0, *curStyle,
|
|
|
GUILayoutOptions::create(), false);
|
|
|
}
|
|
|
|
|
|
@@ -165,9 +193,36 @@ namespace BansheeEngine
|
|
|
// TODO
|
|
|
}
|
|
|
|
|
|
+ void GUIGameObjectField::styleUpdated()
|
|
|
+ {
|
|
|
+ if (mLabel != nullptr)
|
|
|
+ mLabel->setStyle(getSubStyleName(getLabelStyleType()));
|
|
|
+
|
|
|
+ mDropButton->setStyle(getSubStyleName(getDropButtonStyleType()));
|
|
|
+ mClearButton->setStyle(getSubStyleName(getClearButtonStyleType()));
|
|
|
+ }
|
|
|
+
|
|
|
const String& GUIGameObjectField::getGUITypeName()
|
|
|
{
|
|
|
static String typeName = "GUIGameObjectField";
|
|
|
return typeName;
|
|
|
}
|
|
|
+
|
|
|
+ const String& GUIGameObjectField::getLabelStyleType()
|
|
|
+ {
|
|
|
+ static String STYLE_TYPE = "EditorFieldLabel";
|
|
|
+ return STYLE_TYPE;
|
|
|
+ }
|
|
|
+
|
|
|
+ const String& GUIGameObjectField::getDropButtonStyleType()
|
|
|
+ {
|
|
|
+ static String typeName = "DropButton";
|
|
|
+ return typeName;
|
|
|
+ }
|
|
|
+
|
|
|
+ const String& GUIGameObjectField::getClearButtonStyleType()
|
|
|
+ {
|
|
|
+ static String typeName = "ObjectClearButton";
|
|
|
+ return typeName;
|
|
|
+ }
|
|
|
}
|