Browse Source

WIP refactoring editor fields

Marko Pintera 11 years ago
parent
commit
2edcfcffba

+ 2 - 0
BansheeEditor/BansheeEditor.vcxproj

@@ -277,6 +277,7 @@
     <ClInclude Include="Include\BsEditorWidgetManager.h" />
     <ClInclude Include="Include\BsGUIColor.h" />
     <ClInclude Include="Include\BsGUIColorField.h" />
+    <ClInclude Include="Include\BsGUIFieldBase.h" />
     <ClInclude Include="Include\BsGUIFloatField.h" />
     <ClInclude Include="Include\BsGUIFoldout.h" />
     <ClInclude Include="Include\BsGUIGameObjectField.h" />
@@ -333,6 +334,7 @@
     <ClCompile Include="Source\BsGUIColor.cpp" />
     <ClCompile Include="Source\BsGUIColorField.cpp" />
     <ClCompile Include="Source\BsGUIDockSlider.cpp" />
+    <ClCompile Include="Source\BsGUIFieldBase.cpp" />
     <ClCompile Include="Source\BsGUIFloatField.cpp" />
     <ClCompile Include="Source\BsGUIFoldout.cpp" />
     <ClCompile Include="Source\BsGUIGameObjectField.cpp" />

+ 6 - 0
BansheeEditor/BansheeEditor.vcxproj.filters

@@ -189,6 +189,9 @@
     <ClInclude Include="Include\BsGUIDropButton.h">
       <Filter>Header Files\Editor</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsGUIFieldBase.h">
+      <Filter>Header Files\Editor</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsEditorWidgetContainer.cpp">
@@ -329,5 +332,8 @@
     <ClCompile Include="Source\BsGUIDropButton.cpp">
       <Filter>Source Files\Editor</Filter>
     </ClCompile>
+    <ClCompile Include="Source\BsGUIFieldBase.cpp">
+      <Filter>Source Files\Editor</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 108 - 0
BansheeEditor/Include/BsGUIFieldBase.h

@@ -0,0 +1,108 @@
+#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)
+		{ }
+	};
+}

+ 5 - 35
BansheeEditor/Include/BsGUIFloatField.h

@@ -1,59 +1,29 @@
 #pragma once
 
 #include "BsEditorPrerequisites.h"
-#include "BsGUIElementContainer.h"
+#include "BsGUIFieldBase.h"
 
 namespace BansheeEditor
 {
-	class BS_ED_EXPORT GUIFloatField : public BS::GUIElementContainer
+	class BS_ED_EXPORT GUIFloatField : public TGUIField<GUIFloatField>
 	{
-		struct PrivatelyConstruct {};
-
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIFloatField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIFloatField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIFloatField* create(BS::GUIWidget& parent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIFloatField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIFloatField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIFloatField* create(BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		GUIFloatField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
-
-		GUIFloatField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
+		GUIFloatField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		float getValue() const;
 		void setValue(float value);
 
-		void setLabelWidth(CM::UINT32 value);
-
-		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 ~GUIFloatField();
 
 		void updateClippedBounds();
+
 	protected:
 		static const float DRAG_SPEED;
 
-		CM::UINT32 mLabelWidth;
-		BS::GUILabel* mLabel;
 		BS::GUIInputBox* mInputBox;
 		CM::INT32 mLastDragPos;
 		bool mIsDragging;

+ 4 - 35
BansheeEditor/Include/BsGUIIntField.h

@@ -1,50 +1,21 @@
 #pragma once
 
 #include "BsEditorPrerequisites.h"
-#include "BsGUIElementContainer.h"
+#include "BsGUIFieldBase.h"
 
 namespace BansheeEditor
 {
-	class BS_ED_EXPORT GUIIntField : public BS::GUIElementContainer
+	class BS_ED_EXPORT GUIIntField : public TGUIField<GUIIntField>
 	{
-		struct PrivatelyConstruct {};
-
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIIntField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIIntField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIIntField* create(BS::GUIWidget& parent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIIntField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIIntField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUIIntField* create(BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		GUIIntField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
-
-		GUIIntField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
+		GUIIntField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		CM::INT32 getValue() const;
 		void setValue(CM::INT32 value);
 
-		void setLabelWidth(CM::UINT32 value);
-
-		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 ~GUIIntField();
 
@@ -53,8 +24,6 @@ namespace BansheeEditor
 	protected:
 		static const CM::INT32 DRAG_SPEED;
 
-		CM::UINT32 mLabelWidth;
-		BS::GUILabel* mLabel;
 		BS::GUIInputBox* mInputBox;
 		CM::INT32 mLastDragPos;
 		bool mIsDragging;

+ 4 - 36
BansheeEditor/Include/BsGUITextField.h

@@ -1,56 +1,24 @@
 #pragma once
 
 #include "BsEditorPrerequisites.h"
-#include "BsGUIElementContainer.h"
+#include "BsGUIFieldBase.h"
 
 namespace BansheeEditor
 {
-	class BS_ED_EXPORT GUITextField : public BS::GUIElementContainer
+	class BS_ED_EXPORT GUITextField : public TGUIField<GUITextField>
 	{
-		struct PrivatelyConstruct {};
-
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUITextField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUITextField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUITextField* create(BS::GUIWidget& parent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUITextField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUITextField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		static GUITextField* create(BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
-
-		GUITextField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
-
-		GUITextField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
+		GUITextField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		CM::WString getValue() const;
 		void setValue(const CM::WString& value);
-
-		void setLabelWidth(CM::UINT32 width);
-
-		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 ~GUITextField();
 
 	protected:
-		CM::UINT32 mLabelWidth;
-		BS::GUILabel* mLabel;
 		BS::GUIInputBox* mInputBox;
 	};
 }

+ 41 - 0
BansheeEditor/Source/BsGUIFieldBase.cpp

@@ -0,0 +1,41 @@
+#include "BsGUIFieldBase.h"
+#include "BsGUILabel.h"
+#include "BsGUILayout.h"
+#include "BsGUIWidget.h"
+#include "BsGUISkin.h"
+
+using namespace CamelotFramework;
+using namespace BansheeEngine;
+
+namespace BansheeEditor
+{
+	const UINT32 GUIFieldBase::DEFAULT_LABEL_WIDTH = 100;
+
+	GUIFieldBase::GUIFieldBase(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, UINT32 labelWidth,
+		GUIElementStyle* labelStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
+		:GUIElementContainer(parent, layoutOptions)
+	{
+		mLayout = &addLayoutXInternal(this);
+
+		if(withLabel)
+		{
+			const GUIElementStyle* curLabelStyle = labelStyle;
+			if(curLabelStyle == nullptr)
+				curLabelStyle = parent.getSkin().getStyle("Label");
+
+			mLabel = BS::GUILabel::create(parent, labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), curLabelStyle);
+			mLayout->addElement(mLabel);
+		}
+	}
+
+	void GUIFieldBase::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
+		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
+	{
+		mLayout->_updateLayoutInternal(x, y, width, height, clipRect, widgetDepth, areaDepth);
+	}
+
+	Vector2I GUIFieldBase::_getOptimalSize() const
+	{
+		return mLayout->_getOptimalSize();
+	}
+}

+ 6 - 137
BansheeEditor/Source/BsGUIFloatField.cpp

@@ -19,44 +19,19 @@ namespace BansheeEditor
 {
 	const float GUIFloatField::DRAG_SPEED = 0.05f;
 
-	GUIFloatField::GUIFloatField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mInputBox(nullptr), mIsDragging(false),
-		mLastDragPos(0), mIsDragCursorSet(false), mLabelWidth(100)
+	GUIFloatField::GUIFloatField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, CM::UINT32 labelWidth, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
+		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
+		mLastDragPos(0), mIsDragCursorSet(false)
 	{
-		const GUIElementStyle* curLabelStyle = labelStyle;
 		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-
-		if(curLabelStyle == nullptr)
-			curLabelStyle = parent.getSkin().getStyle("Label");
-
-		if(curInputBoxStyle == nullptr)
-			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
-
-		mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
-		mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
-		mInputBox->setFilter(&GUIFloatField::floatFilter);
-
-		_registerChildElement(mLabel);
-		_registerChildElement(mInputBox);
-
-		setValue(0);
-	}
-
-	GUIFloatField::GUIFloatField(const PrivatelyConstruct& dummy, GUIWidget& parent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mInputBox(nullptr), mIsDragging(false),
-		mLastDragPos(0), mLabelWidth(100)
-	{
-		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-
 		if(curInputBoxStyle == nullptr)
 			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
 
-		mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
+		mInputBox = GUIInputBox::create(parent, false, GUIOptions(GUIOption::flexibleWidth()), inputBoxStyle);
 		mInputBox->setFilter(&GUIFloatField::floatFilter);
 
-		_registerChildElement(mInputBox);
+		mLayout->addElement(mInputBox);
 
 		setValue(0);
 	}
@@ -66,47 +41,6 @@ namespace BansheeEditor
 
 	}
 
-	GUIFloatField* GUIFloatField::create(GUIWidget& parent, const GUIContent& labelContent, const GUIOptions& layoutOptions, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIFloatField>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUIFloatField* GUIFloatField::create(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIFloatField>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
-	GUIFloatField* GUIFloatField::create(GUIWidget& parent, const HString& labelContent, const GUIOptions& layoutOptions, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIFloatField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, 
-			inputBoxStyle, GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUIFloatField* GUIFloatField::create(GUIWidget& parent, const HString& labelContent, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIFloatField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
-	GUIFloatField* GUIFloatField::create(GUIWidget& parent, const GUIOptions& layoutOptions, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIFloatField>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUIFloatField* GUIFloatField::create(GUIWidget& parent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIFloatField>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
 	bool GUIFloatField::mouseEvent(const GUIMouseEvent& event)
 	{
 		GUIElementContainer::mouseEvent(event);
@@ -220,77 +154,12 @@ namespace BansheeEditor
 		mInputBox->setText(toWString(value));
 	}
 
-	void GUIFloatField::setLabelWidth(UINT32 width)
-	{
-		mLabelWidth = width;
-
-		markContentAsDirty();
-	}
-
 	void GUIFloatField::updateClippedBounds()
 	{
 		Vector2I offset = _getOffset();
 		mClippedBounds = RectI(offset.x, offset.y, _getWidth(), _getHeight());
 	}
 
-	void GUIFloatField::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
-		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
-	{
-		UINT32 inputBoxOffset = 0;
-		UINT32 inputBoxWidth = width;
-
-		if(mLabel != nullptr)
-		{
-			UINT32 labelWidth = mLabelWidth;
-
-			Vector2I optimalSize = mLabel->_getOptimalSize();
-			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
-
-			Vector2I offset(x, y + yOffset);
-			mLabel->_setOffset(offset);
-			mLabel->_setWidth(labelWidth);
-			mLabel->_setHeight(optimalSize.y);
-			mLabel->_setAreaDepth(areaDepth);
-			mLabel->_setWidgetDepth(widgetDepth);
-
-			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
-			mLabel->_setClipRect(elemClipRect);
-
-			inputBoxOffset = labelWidth;
-			inputBoxWidth = width - labelWidth;
-		}
-
-		Vector2I inputBoxSize = mInputBox->_getOptimalSize();
-
-		{
-			Vector2I optimalSize = mInputBox->_getOptimalSize();
-			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
-
-			Vector2I offset(x + inputBoxOffset, y + yOffset);
-			mInputBox->_setOffset(offset);
-			mInputBox->_setWidth(inputBoxWidth);
-			mInputBox->_setHeight(optimalSize.y);
-			mInputBox->_setAreaDepth(areaDepth);
-			mInputBox->_setWidgetDepth(widgetDepth);
-
-			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
-			mInputBox->_setClipRect(elemClipRect);
-		}
-	}
-
-	Vector2I GUIFloatField::_getOptimalSize() const
-	{
-		Vector2I optimalsize = mInputBox->_getOptimalSize();
-
-		if(mLabel != nullptr)
-		{
-			optimalsize.x += mLabel->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mLabel->_getOptimalSize().y);
-		}
-
-		return optimalsize;
-	}
-
 	const String& GUIFloatField::getGUITypeName()
 	{
 		static String typeName = "GUIFloatField";

+ 6 - 137
BansheeEditor/Source/BsGUIIntField.cpp

@@ -19,44 +19,19 @@ namespace BansheeEditor
 {
 	const INT32 GUIIntField::DRAG_SPEED = 5;
 
-	GUIIntField::GUIIntField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mInputBox(nullptr), mIsDragging(false),
-		mLastDragPos(0), mIsDragCursorSet(false), mLabelWidth(100)
+	GUIIntField::GUIIntField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, UINT32 labelWidth,
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
+		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
+		mLastDragPos(0), mIsDragCursorSet(false)
 	{
-		const GUIElementStyle* curLabelStyle = labelStyle;
 		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-
-		if(curLabelStyle == nullptr)
-			curLabelStyle = parent.getSkin().getStyle("Label");
-
 		if(curInputBoxStyle == nullptr)
 			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
 
-		mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
-		mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
+		mInputBox = GUIInputBox::create(parent, false, GUIOptions(GUIOption::flexibleWidth()), inputBoxStyle);
 		mInputBox->setFilter(&GUIIntField::intFilter);
 
-		_registerChildElement(mLabel);
-		_registerChildElement(mInputBox);
-
-		setValue(0);
-	}
-
-	GUIIntField::GUIIntField(const PrivatelyConstruct& dummy, GUIWidget& parent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mInputBox(nullptr), mIsDragging(false),
-		mLastDragPos(0), mLabelWidth(100)
-	{
-		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-
-		if(curInputBoxStyle == nullptr)
-			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
-
-		mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
-		mInputBox->setFilter(&GUIIntField::intFilter);
-
-		_registerChildElement(mInputBox);
+		mLayout->addElement(mInputBox);
 
 		setValue(0);
 	}
@@ -66,47 +41,6 @@ namespace BansheeEditor
 
 	}
 
-	GUIIntField* GUIIntField::create(GUIWidget& parent, const GUIContent& labelContent, const GUIOptions& layoutOptions, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIIntField>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUIIntField* GUIIntField::create(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIIntField>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
-	GUIIntField* GUIIntField::create(GUIWidget& parent, const HString& labelContent, const GUIOptions& layoutOptions, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIIntField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, 
-			inputBoxStyle, GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUIIntField* GUIIntField::create(GUIWidget& parent, const HString& labelContent, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIIntField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
-	GUIIntField* GUIIntField::create(GUIWidget& parent, const GUIOptions& layoutOptions, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIIntField>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUIIntField* GUIIntField::create(GUIWidget& parent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUIIntField>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
 	bool GUIIntField::mouseEvent(const GUIMouseEvent& event)
 	{
 		GUIElementContainer::mouseEvent(event);
@@ -237,77 +171,12 @@ namespace BansheeEditor
 		mInputBox->setText(toWString(value));
 	}
 
-	void GUIIntField::setLabelWidth(UINT32 width)
-	{
-		mLabelWidth = width;
-
-		markContentAsDirty();
-	}
-
 	void GUIIntField::updateClippedBounds()
 	{
 		Vector2I offset = _getOffset();
 		mClippedBounds = RectI(offset.x, offset.y, _getWidth(), _getHeight());
 	}
 
-	void GUIIntField::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
-		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
-	{
-		UINT32 inputBoxOffset = 0;
-		UINT32 inputBoxWidth = width;
-
-		if(mLabel != nullptr)
-		{
-			UINT32 labelWidth = mLabelWidth;
-
-			Vector2I optimalSize = mLabel->_getOptimalSize();
-			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
-
-			Vector2I offset(x, y + yOffset);
-			mLabel->_setOffset(offset);
-			mLabel->_setWidth(labelWidth);
-			mLabel->_setHeight(optimalSize.y);
-			mLabel->_setAreaDepth(areaDepth);
-			mLabel->_setWidgetDepth(widgetDepth);
-
-			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
-			mLabel->_setClipRect(elemClipRect);
-
-			inputBoxOffset = labelWidth;
-			inputBoxWidth = width - labelWidth;
-		}
-
-		Vector2I inputBoxSize = mInputBox->_getOptimalSize();
-		
-		{
-			Vector2I optimalSize = mInputBox->_getOptimalSize();
-			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
-			
-			Vector2I offset(x + inputBoxOffset, y + yOffset);
-			mInputBox->_setOffset(offset);
-			mInputBox->_setWidth(inputBoxWidth);
-			mInputBox->_setHeight(optimalSize.y);
-			mInputBox->_setAreaDepth(areaDepth);
-			mInputBox->_setWidgetDepth(widgetDepth);
-
-			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
-			mInputBox->_setClipRect(elemClipRect);
-		}
-	}
-
-	Vector2I GUIIntField::_getOptimalSize() const
-	{
-		Vector2I optimalsize = mInputBox->_getOptimalSize();
-
-		if(mLabel != nullptr)
-		{
-			optimalsize.x += mLabel->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mLabel->_getOptimalSize().y);
-		}
-
-		return optimalsize;
-	}
-
 	const String& GUIIntField::getGUITypeName()
 	{
 		static String typeName = "GUIIntField";

+ 4 - 130
BansheeEditor/Source/BsGUITextField.cpp

@@ -13,38 +13,17 @@ using namespace BansheeEngine;
 
 namespace BansheeEditor
 {
-	GUITextField::GUITextField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mInputBox(nullptr), mLabelWidth(100)
+	GUITextField::GUITextField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, CM::UINT32 labelWidth, 
+		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
+		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr)
 	{
-		const GUIElementStyle* curLabelStyle = labelStyle;
 		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
 
-		if(curLabelStyle == nullptr)
-			curLabelStyle = parent.getSkin().getStyle("Label");
-
 		if(curInputBoxStyle == nullptr)
 			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
 
-		mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
 		mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
-
-		_registerChildElement(mLabel);
-		_registerChildElement(mInputBox);
-	}
-
-	GUITextField::GUITextField(const PrivatelyConstruct& dummy, GUIWidget& parent, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mInputBox(nullptr), mLabelWidth(100)
-	{
-		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-
-		if(curInputBoxStyle == nullptr)
-			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
-
-		mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
-
-		_registerChildElement(mInputBox);
+		mLayout->addElement(mInputBox);
 	}
 
 	GUITextField::~GUITextField()
@@ -52,46 +31,6 @@ namespace BansheeEditor
 
 	}
 
-	GUITextField* GUITextField::create(GUIWidget& parent, const GUIContent& labelContent, const GUIOptions& layoutOptions, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUITextField>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUITextField* GUITextField::create(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUITextField>(PrivatelyConstruct(), parent, labelContent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
-	GUITextField* GUITextField::create(GUIWidget& parent, const HString& labelContent, const GUIOptions& layoutOptions, 
-		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUITextField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, 
-			inputBoxStyle, GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUITextField* GUITextField::create(GUIWidget& parent, const HString& labelContent, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUITextField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-
-	GUITextField* GUITextField::create(GUIWidget& parent, const GUIOptions& layoutOptions, GUIElementStyle* labelStyle, 
-		GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUITextField>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, 
-			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
-	}
-
-	GUITextField* GUITextField::create(GUIWidget& parent, GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle)
-	{
-		return cm_new<GUITextField>(PrivatelyConstruct(), parent, labelStyle, inputBoxStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
-	}
-	
 	WString GUITextField::getValue() const
 	{
 		return mInputBox->getText();
@@ -102,71 +41,6 @@ namespace BansheeEditor
 		mInputBox->setText(value);
 	}
 
-	void GUITextField::setLabelWidth(UINT32 width)
-	{
-		mLabelWidth = width;
-
-		markContentAsDirty();
-	}
-
-	void GUITextField::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
-		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
-	{
-		UINT32 inputBoxOffset = 0;
-		UINT32 inputBoxWidth = width;
-
-		if(mLabel != nullptr)
-		{
-			UINT32 labelWidth = mLabelWidth;
-
-			Vector2I optimalSize = mLabel->_getOptimalSize();
-			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
-
-			Vector2I offset(x, y + yOffset);
-			mLabel->_setOffset(offset);
-			mLabel->_setWidth(labelWidth);
-			mLabel->_setHeight(optimalSize.y);
-			mLabel->_setAreaDepth(areaDepth);
-			mLabel->_setWidgetDepth(widgetDepth);
-
-			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
-			mLabel->_setClipRect(elemClipRect);
-
-			inputBoxOffset = labelWidth;
-			inputBoxWidth = width - labelWidth;
-		}
-
-		Vector2I inputBoxSize = mInputBox->_getOptimalSize();
-
-		{
-			Vector2I optimalSize = mInputBox->_getOptimalSize();
-			INT32 yOffset = Math::roundToInt((height - optimalSize.y) * 0.5f);
-
-			Vector2I offset(x + inputBoxOffset, y + yOffset);
-			mInputBox->_setOffset(offset);
-			mInputBox->_setWidth(inputBoxWidth);
-			mInputBox->_setHeight(optimalSize.y);
-			mInputBox->_setAreaDepth(areaDepth);
-			mInputBox->_setWidgetDepth(widgetDepth);
-
-			RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
-			mInputBox->_setClipRect(elemClipRect);
-		}
-	}
-
-	Vector2I GUITextField::_getOptimalSize() const
-	{
-		Vector2I optimalsize = mInputBox->_getOptimalSize();
-
-		if(mLabel != nullptr)
-		{
-			optimalsize.x += mLabel->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mLabel->_getOptimalSize().y);
-		}
-
-		return optimalsize;
-	}
-
 	const String& GUITextField::getGUITypeName()
 	{
 		static String typeName = "GUITextField";

+ 2 - 5
BansheeEditor/Source/BsGUIVector2Field.cpp

@@ -87,11 +87,8 @@ namespace BansheeEditor
 			mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
 		}
 
-		mFieldX = GUIFloatField::create(parent, HString(L"X"), labelStyle, inputBoxStyle);
-		mFieldY = GUIFloatField::create(parent, HString(L"Y"), labelStyle, inputBoxStyle);
-
-		mFieldX->setLabelWidth(ELEMENT_LABEL_WIDTH);
-		mFieldY->setLabelWidth(ELEMENT_LABEL_WIDTH);
+		mFieldX = GUIFloatField::create(parent, HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(parent, HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
 
 		_registerChildElement(mLabel);
 		_registerChildElement(mFieldX);

+ 3 - 7
BansheeEditor/Source/BsGUIVector3Field.cpp

@@ -89,13 +89,9 @@ namespace BansheeEditor
 			mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
 		}
 
-		mFieldX = GUIFloatField::create(parent, HString(L"X"), labelStyle, inputBoxStyle);
-		mFieldY = GUIFloatField::create(parent, HString(L"Y"), labelStyle, inputBoxStyle);
-		mFieldZ = GUIFloatField::create(parent, HString(L"Z"), labelStyle, inputBoxStyle);
-
-		mFieldX->setLabelWidth(ELEMENT_LABEL_WIDTH);
-		mFieldY->setLabelWidth(ELEMENT_LABEL_WIDTH);
-		mFieldZ->setLabelWidth(ELEMENT_LABEL_WIDTH);
+		mFieldX = GUIFloatField::create(parent, HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(parent, HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldZ = GUIFloatField::create(parent, HString(L"Z"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
 
 		_registerChildElement(mLabel);
 		_registerChildElement(mFieldX);

+ 4 - 9
BansheeEditor/Source/BsGUIVector4Field.cpp

@@ -89,15 +89,10 @@ namespace BansheeEditor
 			mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
 		}
 
-		mFieldX = GUIFloatField::create(parent, HString(L"X"), labelStyle, inputBoxStyle);
-		mFieldY = GUIFloatField::create(parent, HString(L"Y"), labelStyle, inputBoxStyle);
-		mFieldZ = GUIFloatField::create(parent, HString(L"Z"), labelStyle, inputBoxStyle);
-		mFieldW = GUIFloatField::create(parent, HString(L"W"), labelStyle, inputBoxStyle);
-
-		mFieldX->setLabelWidth(ELEMENT_LABEL_WIDTH);
-		mFieldY->setLabelWidth(ELEMENT_LABEL_WIDTH);
-		mFieldZ->setLabelWidth(ELEMENT_LABEL_WIDTH);
-		mFieldW->setLabelWidth(ELEMENT_LABEL_WIDTH);
+		mFieldX = GUIFloatField::create(parent, HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(parent, HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldZ = GUIFloatField::create(parent, HString(L"Z"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldW = GUIFloatField::create(parent, HString(L"W"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
 
 		_registerChildElement(mLabel);
 		_registerChildElement(mFieldX);

+ 1 - 1
BansheeEditor/Source/DbgEditorWidget2.cpp

@@ -32,7 +32,7 @@ namespace BansheeEditor
 	{
 		GUILayout& layout = mContent->getLayout().addLayoutY();
 
-		GUIIntField* intField = GUIIntField::create(getParentWidget(), HString(L"Int Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIIntField* intField = GUIIntField::create(getParentWidget(), GUIContent(HString(L"Int Field")), 100, GUIOptions(GUIOption::fixedWidth(200)));
 		GUIFloatField* floatField = GUIFloatField::create(getParentWidget(), HString(L"Float Field"), GUIOptions(GUIOption::fixedWidth(200)));
 		GUITextField* textField = GUITextField::create(getParentWidget(), HString(L"Text Field"), GUIOptions(GUIOption::fixedWidth(200)));
 		GUIVector4Field* vec4Field = GUIVector4Field::create(getParentWidget(), HString(L"Vec4 Field"), GUIOptions(GUIOption::fixedWidth(200)));