Kaynağa Gözat

Refactored GUILayoutOptions:
- Now called GUIDimensions and are supported on layouts as well
- They have x, y coordinates for positioning elements in GUILayoutExplicit

Marko Pintera 10 yıl önce
ebeveyn
işleme
33ab6e3f79
100 değiştirilmiş dosya ile 849 ekleme ve 718 silme
  1. 1 1
      BansheeEditor/Include/BsDockManager.h
  2. 1 1
      BansheeEditor/Include/BsGUIColor.h
  3. 1 1
      BansheeEditor/Include/BsGUIColorField.h
  4. 1 1
      BansheeEditor/Include/BsGUIComponentFoldout.h
  5. 1 1
      BansheeEditor/Include/BsGUIDockSlider.h
  6. 1 1
      BansheeEditor/Include/BsGUIDropButton.h
  7. 12 12
      BansheeEditor/Include/BsGUIFieldBase.h
  8. 1 1
      BansheeEditor/Include/BsGUIFloatField.h
  9. 1 1
      BansheeEditor/Include/BsGUIFoldout.h
  10. 1 1
      BansheeEditor/Include/BsGUIIntField.h
  11. 1 1
      BansheeEditor/Include/BsGUIResourceTreeView.h
  12. 1 1
      BansheeEditor/Include/BsGUISceneTreeView.h
  13. 1 1
      BansheeEditor/Include/BsGUITabButton.h
  14. 2 2
      BansheeEditor/Include/BsGUITabbedTitleBar.h
  15. 1 1
      BansheeEditor/Include/BsGUITextField.h
  16. 1 1
      BansheeEditor/Include/BsGUIToggleField.h
  17. 1 1
      BansheeEditor/Include/BsGUITreeView.h
  18. 1 1
      BansheeEditor/Include/BsGUITreeViewEditBox.h
  19. 1 1
      BansheeEditor/Include/BsGUIVector2Field.h
  20. 1 1
      BansheeEditor/Include/BsGUIVector3Field.h
  21. 1 1
      BansheeEditor/Include/BsGUIVector4Field.h
  22. 1 1
      BansheeEditor/Include/BsGUIWindowDropArea.h
  23. 1 1
      BansheeEditor/Include/BsGUIWindowFrame.h
  24. 8 8
      BansheeEditor/Source/BsDockManager.cpp
  25. 5 5
      BansheeEditor/Source/BsGUIColor.cpp
  26. 1 1
      BansheeEditor/Source/BsGUIColorField.cpp
  27. 6 6
      BansheeEditor/Source/BsGUIComponentFoldout.cpp
  28. 4 4
      BansheeEditor/Source/BsGUIDockSlider.cpp
  29. 4 4
      BansheeEditor/Source/BsGUIDropButton.cpp
  30. 1 1
      BansheeEditor/Source/BsGUIFieldBase.cpp
  31. 1 1
      BansheeEditor/Source/BsGUIFloatField.cpp
  32. 9 9
      BansheeEditor/Source/BsGUIFoldout.cpp
  33. 1 1
      BansheeEditor/Source/BsGUIIntField.cpp
  34. 3 3
      BansheeEditor/Source/BsGUIResourceTreeView.cpp
  35. 3 3
      BansheeEditor/Source/BsGUISceneTreeView.cpp
  36. 6 6
      BansheeEditor/Source/BsGUITabButton.cpp
  37. 15 15
      BansheeEditor/Source/BsGUITabbedTitleBar.cpp
  38. 11 11
      BansheeEditor/Source/BsGUITextField.cpp
  39. 1 1
      BansheeEditor/Source/BsGUIToggleField.cpp
  40. 34 34
      BansheeEditor/Source/BsGUITreeView.cpp
  41. 3 3
      BansheeEditor/Source/BsGUITreeViewEditBox.cpp
  42. 2 2
      BansheeEditor/Source/BsGUIVector2Field.cpp
  43. 2 2
      BansheeEditor/Source/BsGUIVector3Field.cpp
  44. 2 2
      BansheeEditor/Source/BsGUIVector4Field.cpp
  45. 4 4
      BansheeEditor/Source/BsGUIWindowDropArea.cpp
  46. 4 4
      BansheeEditor/Source/BsGUIWindowFrame.cpp
  47. 2 2
      BansheeEngine/BansheeEngine.vcxproj
  48. 6 6
      BansheeEngine/BansheeEngine.vcxproj.filters
  49. 1 1
      BansheeEngine/Include/BsGUIButton.h
  50. 1 1
      BansheeEngine/Include/BsGUIButtonBase.h
  51. 83 0
      BansheeEngine/Include/BsGUIDimensions.h
  52. 1 1
      BansheeEngine/Include/BsGUIDropDownContent.h
  53. 1 1
      BansheeEngine/Include/BsGUIDropDownHitBox.h
  54. 27 38
      BansheeEngine/Include/BsGUIElement.h
  55. 43 20
      BansheeEngine/Include/BsGUIElementBase.h
  56. 2 2
      BansheeEngine/Include/BsGUIElementContainer.h
  57. 3 3
      BansheeEngine/Include/BsGUIHelper.h
  58. 1 1
      BansheeEngine/Include/BsGUIInputBox.h
  59. 1 1
      BansheeEngine/Include/BsGUILabel.h
  60. 6 1
      BansheeEngine/Include/BsGUILayout.h
  61. 1 1
      BansheeEngine/Include/BsGUILayoutExplicit.h
  62. 0 53
      BansheeEngine/Include/BsGUILayoutOptions.h
  63. 1 1
      BansheeEngine/Include/BsGUILayoutX.h
  64. 1 1
      BansheeEngine/Include/BsGUILayoutY.h
  65. 1 1
      BansheeEngine/Include/BsGUIListBox.h
  66. 11 3
      BansheeEngine/Include/BsGUIOptions.h
  67. 1 1
      BansheeEngine/Include/BsGUIProgressBar.h
  68. 1 1
      BansheeEngine/Include/BsGUIRenderTexture.h
  69. 1 1
      BansheeEngine/Include/BsGUIScrollArea.h
  70. 1 1
      BansheeEngine/Include/BsGUIScrollBar.h
  71. 1 1
      BansheeEngine/Include/BsGUIScrollBarHorz.h
  72. 1 1
      BansheeEngine/Include/BsGUIScrollBarVert.h
  73. 3 3
      BansheeEngine/Include/BsGUISlider.h
  74. 1 1
      BansheeEngine/Include/BsGUISliderHandle.h
  75. 1 1
      BansheeEngine/Include/BsGUITexture.h
  76. 1 1
      BansheeEngine/Include/BsGUIToggle.h
  77. 1 1
      BansheeEngine/Include/BsGUIViewport.h
  78. 1 1
      BansheeEngine/Include/BsPrerequisites.h
  79. 0 4
      BansheeEngine/Source/BsGUIArea.cpp
  80. 4 4
      BansheeEngine/Source/BsGUIButton.cpp
  81. 3 3
      BansheeEngine/Source/BsGUIButtonBase.cpp
  82. 142 0
      BansheeEngine/Source/BsGUIDimensions.cpp
  83. 9 9
      BansheeEngine/Source/BsGUIDropDownContent.cpp
  84. 3 3
      BansheeEngine/Source/BsGUIDropDownHitBox.cpp
  85. 10 42
      BansheeEngine/Source/BsGUIElement.cpp
  86. 60 9
      BansheeEngine/Source/BsGUIElementBase.cpp
  87. 3 3
      BansheeEngine/Source/BsGUIElementContainer.cpp
  88. 5 10
      BansheeEngine/Source/BsGUIHelper.cpp
  89. 6 6
      BansheeEngine/Source/BsGUIInputBox.cpp
  90. 5 5
      BansheeEngine/Source/BsGUILabel.cpp
  91. 120 23
      BansheeEngine/Source/BsGUILayoutExplicit.cpp
  92. 0 127
      BansheeEngine/Source/BsGUILayoutOptions.cpp
  93. 1 1
      BansheeEngine/Source/BsGUILayoutUtility.cpp
  94. 34 64
      BansheeEngine/Source/BsGUILayoutX.cpp
  95. 32 59
      BansheeEngine/Source/BsGUILayoutY.cpp
  96. 4 4
      BansheeEngine/Source/BsGUIListBox.cpp
  97. 11 0
      BansheeEngine/Source/BsGUIOptions.cpp
  98. 10 10
      BansheeEngine/Source/BsGUIProgressBar.cpp
  99. 3 3
      BansheeEngine/Source/BsGUIRenderTexture.cpp
  100. 12 12
      BansheeEngine/Source/BsGUIScrollArea.cpp

+ 1 - 1
BansheeEditor/Include/BsDockManager.h

@@ -101,7 +101,7 @@ namespace BansheeEngine
 		void updateClippedBounds();
 
 	private:
-		DockManager(EditorWindowBase* parentWindow, const GUILayoutOptions& layoutOptions);
+		DockManager(EditorWindowBase* parentWindow, const GUIDimensions& layoutOptions);
 
 		static const Color TINT_COLOR;
 		static const Color HIGHLIGHT_COLOR;

+ 1 - 1
BansheeEditor/Include/BsGUIColor.h

@@ -27,7 +27,7 @@ namespace BansheeEngine
 
 		Event<void(const Color&)> onValueChanged;
 	protected:
-		GUIColor(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIColor(const String& styleName, const GUIDimensions& layoutOptions);
 		virtual ~GUIColor();
 
 		/**

+ 1 - 1
BansheeEditor/Include/BsGUIColorField.h

@@ -13,7 +13,7 @@ namespace BansheeEngine
 		static const String& getColorInputStyleType();
 
 		GUIColorField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		Color getValue() const { return mValue; }
 		void setValue(const Color& value);

+ 1 - 1
BansheeEditor/Include/BsGUIComponentFoldout.h

@@ -16,7 +16,7 @@ namespace BansheeEngine
 		static GUIComponentFoldout* create(const HString& label, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
 		static GUIComponentFoldout* create(const HString& label, const String& style = StringUtil::BLANK);
 
-		GUIComponentFoldout(const PrivatelyConstruct& dummy, const HString& label, const String& style, const GUILayoutOptions& layoutOptions);
+		GUIComponentFoldout(const PrivatelyConstruct& dummy, const HString& label, const String& style, const GUIDimensions& layoutOptions);
 
 		bool isExpanded() const { return mIsExpanded; }
 		void setExpanded(bool expanded);

+ 1 - 1
BansheeEditor/Include/BsGUIDockSlider.h

@@ -26,6 +26,6 @@ namespace BansheeEngine
 		bool mIsCursorSet;
 		bool mDragInProgress;
 
-		GUIDockSlider(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIDockSlider(bool horizontal, const String& styleName, const GUIDimensions& layoutOptions);
 	};
 }

+ 1 - 1
BansheeEditor/Include/BsGUIDropButton.h

@@ -24,7 +24,7 @@ namespace BansheeEngine
 		virtual ~GUIDropButton();
 
 	protected:
-		GUIDropButton(UINT32 dragType, const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIDropButton(UINT32 dragType, const String& styleName, const GUIDimensions& layoutOptions);
 
 		virtual bool _mouseEvent(const GUIMouseEvent& ev);
 		virtual bool _acceptDragAndDrop(const Vector2I position, UINT32 typeId) const;

+ 12 - 12
BansheeEditor/Include/BsGUIFieldBase.h

@@ -12,7 +12,7 @@ namespace BansheeEngine
 
 	public:
 		GUIFieldBase(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& labelStyle, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& labelStyle, const GUIDimensions& layoutOptions, bool withLabel);
 
 		void _updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
 			Rect2I clipRect, UINT8 widgetDepth, UINT16 areaDepth);
@@ -48,7 +48,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), labelContent, labelWidth, *curStyle,
-				GUILayoutOptions::create(layoutOptions), true);
+				GUIDimensions::create(layoutOptions), true);
 		}
 
 		static T* create(const GUIContent& labelContent, const GUIOptions& layoutOptions,
@@ -59,7 +59,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
-				GUILayoutOptions::create(layoutOptions), true);
+				GUIDimensions::create(layoutOptions), true);
 		}
 
 		static T* create(const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
@@ -70,7 +70,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), GUIContent(labelText), labelWidth, *curStyle,
-				GUILayoutOptions::create(layoutOptions), true);
+				GUIDimensions::create(layoutOptions), true);
 		}
 
 		static T* create(const HString& labelText, const GUIOptions& layoutOptions,
@@ -81,7 +81,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
-				GUILayoutOptions::create(layoutOptions), true);
+				GUIDimensions::create(layoutOptions), true);
 		}
 
 		static T* create(const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK)
@@ -91,7 +91,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), GUIContent(), 0, *curStyle,
-				GUILayoutOptions::create(layoutOptions), false);
+				GUIDimensions::create(layoutOptions), false);
 		}
 
 		static T* create(const GUIContent& labelContent, UINT32 labelWidth,
@@ -101,7 +101,7 @@ namespace BansheeEngine
 			if (*curStyle == StringUtil::BLANK)
 				curStyle = &T::getGUITypeName();
 
-			return bs_new<T>(PrivatelyConstruct(), labelContent, labelWidth, *curStyle, GUILayoutOptions::create(), true);
+			return bs_new<T>(PrivatelyConstruct(), labelContent, labelWidth, *curStyle, GUIDimensions::create(), true);
 		}
 
 		static T* create(const GUIContent& labelContent,
@@ -112,7 +112,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
-				GUILayoutOptions::create(), true);
+				GUIDimensions::create(), true);
 		}
 
 		static T* create(const HString& labelText, UINT32 labelWidth,
@@ -123,7 +123,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), GUIContent(labelText), labelWidth, *curStyle,
-				GUILayoutOptions::create(), true);
+				GUIDimensions::create(), true);
 		}
 
 		static T* create(const HString& labelText,
@@ -134,7 +134,7 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
-				GUILayoutOptions::create(), true);
+				GUIDimensions::create(), true);
 		}
 
 		static T* create(const String& style = StringUtil::BLANK)
@@ -144,11 +144,11 @@ namespace BansheeEngine
 				curStyle = &T::getGUITypeName();
 
 			return bs_new<T>(PrivatelyConstruct(), GUIContent(), 0, *curStyle,
-				GUILayoutOptions::create(), false);
+				GUIDimensions::create(), false);
 		}
 
 		TGUIField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 			:GUIFieldBase(dummy, labelContent, labelWidth, style, layoutOptions, withLabel)
 		{ }
 	};

+ 1 - 1
BansheeEditor/Include/BsGUIFloatField.h

@@ -12,7 +12,7 @@ namespace BansheeEngine
 		static const String& getInputStyleType();
 
 		GUIFloatField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		float getValue() const { return mValue; }
 		void setValue(float value);

+ 1 - 1
BansheeEditor/Include/BsGUIFoldout.h

@@ -17,7 +17,7 @@ namespace BansheeEngine
 		static GUIFoldout* create(const HString& label, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
 		static GUIFoldout* create(const HString& label, const String& style = StringUtil::BLANK);
 
-		GUIFoldout(const PrivatelyConstruct& dummy, const HString& label, const String& style, const GUILayoutOptions& layoutOptions);
+		GUIFoldout(const PrivatelyConstruct& dummy, const HString& label, const String& style, const GUIDimensions& layoutOptions);
 
 		bool isExpanded() const { return mIsExpanded; }
 		void setExpanded(bool expanded);

+ 1 - 1
BansheeEditor/Include/BsGUIIntField.h

@@ -12,7 +12,7 @@ namespace BansheeEngine
 		static const String& getInputStyleType();
 
 		GUIIntField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		INT32 getValue() const { return mValue; }
 		void setValue(INT32 value);

+ 1 - 1
BansheeEditor/Include/BsGUIResourceTreeView.h

@@ -68,7 +68,7 @@ namespace BansheeEngine
 
 		GUIResourceTreeView(const String& backgroundStyle, const String& elementBtnStyle, 
 			const String& foldoutBtnStyle, const String& selectionBackgroundStyle, const String& editBoxStyle, 
-			const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUILayoutOptions& layoutOptions);
+			const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUIDimensions& layoutOptions);
 
 		virtual void _updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
 			Rect2I clipRect, UINT8 widgetDepth, UINT16 areaDepth);

+ 1 - 1
BansheeEditor/Include/BsGUISceneTreeView.h

@@ -56,7 +56,7 @@ namespace BansheeEngine
 
 		GUISceneTreeView(const String& backgroundStyle, const String& elementBtnStyle, 
 			const String& foldoutBtnStyle, const String& selectionBackgroundStyle, const String& editBoxStyle, 
-			const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUILayoutOptions& layoutOptions);
+			const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUIDimensions& layoutOptions);
 
 		void updateTreeElement(SceneTreeElement* element);
 

+ 1 - 1
BansheeEditor/Include/BsGUITabButton.h

@@ -39,6 +39,6 @@ namespace BansheeEngine
 
 		static const UINT32 DRAG_MIN_DISTANCE;
 
-		GUITabButton(const String& styleName, const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, const GUILayoutOptions& layoutOptions);
+		GUITabButton(const String& styleName, const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, const GUIDimensions& layoutOptions);
 	};
 }

+ 2 - 2
BansheeEditor/Include/BsGUITabbedTitleBar.h

@@ -15,7 +15,7 @@ namespace BansheeEngine
 		static GUITabbedTitleBar* create(const String& backgroundStyle = StringUtil::BLANK, const String& tabBtnStyle = StringUtil::BLANK, 
 			const String& minBtnStyle = StringUtil::BLANK, const String& closeBtnStyle = StringUtil::BLANK);
 
-		static GUITabbedTitleBar* create(const GUILayoutOptions& layoutOptions, 
+		static GUITabbedTitleBar* create(const GUIDimensions& layoutOptions, 
 			const String& backgroundStyle = StringUtil::BLANK, const String& tabBtnStyle = StringUtil::BLANK, 
 			const String& minBtnStyle = StringUtil::BLANK, const String& closeBtnStyle = StringUtil::BLANK);
 
@@ -67,7 +67,7 @@ namespace BansheeEngine
 		String mTabBtnStyle;
 
 		GUITabbedTitleBar(const String& backgroundStyle, const String& tabBtnStyle, 
-			const String& minBtnStyle, const String& closeBtnStyle, const GUILayoutOptions& layoutOptions);
+			const String& minBtnStyle, const String& closeBtnStyle, const GUIDimensions& layoutOptions);
 
 		virtual bool _mouseEvent(const GUIMouseEvent& ev);
 

+ 1 - 1
BansheeEditor/Include/BsGUITextField.h

@@ -43,7 +43,7 @@ namespace BansheeEngine
 		static GUITextField* create(bool multiline, const String& style = StringUtil::BLANK);
 
 		GUITextField(const PrivatelyConstruct& dummy, bool multiline, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		void _updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
 			Rect2I clipRect, UINT8 widgetDepth, UINT16 areaDepth);

+ 1 - 1
BansheeEditor/Include/BsGUIToggleField.h

@@ -12,7 +12,7 @@ namespace BansheeEngine
 		static const String& getToggleStyleType();
 
 		GUIToggleField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		bool getValue() const { return mValue; }
 		void setValue(bool value);

+ 1 - 1
BansheeEditor/Include/BsGUITreeView.h

@@ -124,7 +124,7 @@ namespace BansheeEngine
 
 		GUITreeView(const String& backgroundStyle, const String& elementBtnStyle, 
 			const String& foldoutBtnStyle, const String& selectionBackgroundStyle, const String& editBoxStyle, 
-			const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUILayoutOptions& layoutOptions);
+			const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUIDimensions& layoutOptions);
 
 		const GUITreeView::InteractableElement* findElementUnderCoord(const Vector2I& coord) const;
 		TreeElement* getTopMostSelectedElement() const;

+ 1 - 1
BansheeEditor/Include/BsGUITreeViewEditBox.h

@@ -17,7 +17,7 @@ namespace BansheeEngine
 		Event<void()> onInputCanceled;
 
 	private:
-		GUITreeViewEditBox(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUITreeViewEditBox(const String& styleName, const GUIDimensions& layoutOptions);
 
 		virtual bool _commandEvent(const GUICommandEvent& ev);
 	};

+ 1 - 1
BansheeEditor/Include/BsGUIVector2Field.h

@@ -13,7 +13,7 @@ namespace BansheeEngine
 		static const String& getFloatFieldStyleType();
 
 		GUIVector2Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		Vector2 getValue() const;
 		void setValue(const Vector2& value);

+ 1 - 1
BansheeEditor/Include/BsGUIVector3Field.h

@@ -13,7 +13,7 @@ namespace BansheeEngine
 		static const String& getFloatFieldStyleType();
 
 		GUIVector3Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		Vector3 getValue() const;
 		void setValue(const Vector3& value);

+ 1 - 1
BansheeEditor/Include/BsGUIVector4Field.h

@@ -13,7 +13,7 @@ namespace BansheeEngine
 		static const String& getFloatFieldStyleType();
 
 		GUIVector4Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
+			const String& style, const GUIDimensions& layoutOptions, bool withLabel);
 
 		Vector4 getValue() const;
 		void setValue(const Vector4& value);

+ 1 - 1
BansheeEditor/Include/BsGUIWindowDropArea.h

@@ -19,7 +19,7 @@ namespace BansheeEngine
 		Event<void()> onDraggedItemDropped;
 	protected:
 		~GUIWindowDropArea();
-		GUIWindowDropArea(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIWindowDropArea(const String& styleName, const GUIDimensions& layoutOptions);
 
 		virtual bool _mouseEvent(const GUIMouseEvent& ev);
 	};

+ 1 - 1
BansheeEditor/Include/BsGUIWindowFrame.h

@@ -17,6 +17,6 @@ namespace BansheeEngine
 		void setFocused(bool focused);
 	protected:
 		~GUIWindowFrame();
-		GUIWindowFrame(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIWindowFrame(const String& styleName, const GUIDimensions& layoutOptions);
 	};
 }

+ 8 - 8
BansheeEditor/Source/BsDockManager.cpp

@@ -107,9 +107,9 @@ namespace BansheeEngine
 				mChildren[0]->setArea(mArea.x, mArea.y, mArea.width, sizeTop);
 				mChildren[1]->setArea(mArea.x, mArea.y + sizeTop + SLIDER_SIZE, mArea.width, sizeBottom);
 
-				mSlider->setOffset(Vector2I(mArea.x, mArea.y + sizeTop));
-				mSlider->setWidth(mArea.width);
-				mSlider->setHeight(SLIDER_SIZE);
+				mSlider->_setPosition(Vector2I(mArea.x, mArea.y + sizeTop));
+				mSlider->_setWidth(mArea.width);
+				mSlider->_setHeight(SLIDER_SIZE);
 
 				Rect2I elemClipRect(clipRect.x - mArea.x, clipRect.y - mArea.y, clipRect.width, clipRect.height);
 				mSlider->_setClipRect(elemClipRect);
@@ -123,9 +123,9 @@ namespace BansheeEngine
 				mChildren[0]->setArea(mArea.x, mArea.y, sizeLeft, mArea.height);
 				mChildren[1]->setArea(mArea.x + sizeLeft + SLIDER_SIZE, mArea.y, sizeRight, mArea.height);
 
-				mSlider->setOffset(Vector2I(mArea.x + sizeLeft, mArea.y));
-				mSlider->setWidth(SLIDER_SIZE);
-				mSlider->setHeight(mArea.height);
+				mSlider->_setPosition(Vector2I(mArea.x + sizeLeft, mArea.y));
+				mSlider->_setWidth(SLIDER_SIZE);
+				mSlider->_setHeight(mArea.height);
 
 				Rect2I elemClipRect(clipRect.x - mArea.x, clipRect.y - mArea.y, clipRect.width, clipRect.height);
 				mSlider->_setClipRect(elemClipRect);
@@ -408,7 +408,7 @@ namespace BansheeEngine
 		}
 	}
 
-	DockManager::DockManager(EditorWindowBase* parentWindow, const GUILayoutOptions& layoutOptions)
+	DockManager::DockManager(EditorWindowBase* parentWindow, const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions), mMouseOverContainer(nullptr), mHighlightedDropLoc(DockLocation::None),
 		mShowOverlay(false), mRootContainer(this), mParentWindow(parentWindow)
 	{
@@ -434,7 +434,7 @@ namespace BansheeEngine
 
 	DockManager* DockManager::create(EditorWindowBase* parentWindow)
 	{
-		return new (bs_alloc<DockManager, PoolAlloc>()) DockManager(parentWindow, GUILayoutOptions::create());
+		return new (bs_alloc<DockManager, PoolAlloc>()) DockManager(parentWindow, GUIDimensions::create());
 	}
 
 	void DockManager::update()

+ 5 - 5
BansheeEditor/Source/BsGUIColor.cpp

@@ -3,7 +3,7 @@
 #include "BsGUIWidget.h"
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUIHelper.h"
 #include "BsBuiltinResources.h"
@@ -13,7 +13,7 @@ namespace BansheeEngine
 {
 	const float GUIColor::ALPHA_SPLIT_POSITION = 0.75f;
 
-	GUIColor::GUIColor(const String& styleName, const GUILayoutOptions& layoutOptions)
+	GUIColor::GUIColor(const String& styleName, const GUIDimensions& layoutOptions)
 		:GUIElement(styleName, layoutOptions), mColorSprite(nullptr), mAlphaSprite(nullptr)
 	{
 		mColorSprite = bs_new<ImageSprite, PoolAlloc>();
@@ -37,12 +37,12 @@ namespace BansheeEngine
 
 	GUIColor* GUIColor::create(const String& styleName)
 	{
-		return new (bs_alloc<GUIColor, PoolAlloc>()) GUIColor(getStyleName<GUIColor>(styleName), GUILayoutOptions::create());
+		return new (bs_alloc<GUIColor, PoolAlloc>()) GUIColor(getStyleName<GUIColor>(styleName), GUIDimensions::create());
 	}
 
 	GUIColor* GUIColor::create(const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIColor, PoolAlloc>()) GUIColor(getStyleName<GUIColor>(styleName), GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIColor, PoolAlloc>()) GUIColor(getStyleName<GUIColor>(styleName), GUIDimensions::create(layoutOptions));
 	}
 
 	void GUIColor::setColor(const Color& color)
@@ -125,7 +125,7 @@ namespace BansheeEngine
 
 	Vector2I GUIColor::_getOptimalSize() const
 	{
-		return GUIHelper::calcOptimalContentsSize(Vector2I(80, 10), *_getStyle(), _getLayoutOptions()); // Arbitrary size
+		return GUIHelper::calcOptimalContentsSize(Vector2I(80, 10), *_getStyle(), _getDimensions()); // Arbitrary size
 	}
 
 	void GUIColor::_fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, 

+ 1 - 1
BansheeEditor/Source/BsGUIColorField.cpp

@@ -14,7 +14,7 @@ using namespace std::placeholders;
 namespace BansheeEngine
 {
 	GUIColorField::GUIColorField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:TGUIField(dummy, labelContent, labelWidth, style, layoutOptions, withLabel), 
 		mLabel(nullptr), mColor(nullptr), mLabelWidth(100)
 	{

+ 6 - 6
BansheeEditor/Source/BsGUIComponentFoldout.cpp

@@ -13,7 +13,7 @@ using namespace std::placeholders;
 namespace BansheeEngine
 {
 	GUIComponentFoldout::GUIComponentFoldout(const PrivatelyConstruct& dummy, const HString& label, const String& style,
-		const GUILayoutOptions& layoutOptions)
+		const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions, style), mToggle(nullptr), mIsExpanded(false)
 	{
 		mToggle = GUIToggle::create(label, getSubStyleName(getFoldoutButtonStyleType()));
@@ -35,7 +35,7 @@ namespace BansheeEngine
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &getGUITypeName();
 
-		return bs_new<GUIComponentFoldout>(PrivatelyConstruct(), label, *curStyle, GUILayoutOptions::create(layoutOptions));
+		return bs_new<GUIComponentFoldout>(PrivatelyConstruct(), label, *curStyle, GUIDimensions::create(layoutOptions));
 	}
 
 	GUIComponentFoldout* GUIComponentFoldout::create(const HString& label, const String& style)
@@ -44,7 +44,7 @@ namespace BansheeEngine
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &getGUITypeName();
 
-		return bs_new<GUIComponentFoldout>(PrivatelyConstruct(), label, *curStyle, GUILayoutOptions::create());
+		return bs_new<GUIComponentFoldout>(PrivatelyConstruct(), label, *curStyle, GUIDimensions::create());
 	}
 
 	void GUIComponentFoldout::setExpanded(bool expanded)
@@ -94,9 +94,9 @@ namespace BansheeEngine
 			INT32 yOffset = Math::roundToInt(((INT32)height - optimalSize.y) * 0.5f);
 
 			Vector2I offset(x, y + yOffset);
-			mToggle->setOffset(offset);
-			mToggle->setWidth(width);
-			mToggle->setHeight(optimalSize.y);
+			mToggle->_setPosition(offset);
+			mToggle->_setWidth(width);
+			mToggle->_setHeight(optimalSize.y);
 			mToggle->_setAreaDepth(areaDepth);
 			mToggle->_setWidgetDepth(widgetDepth);
 

+ 4 - 4
BansheeEditor/Source/BsGUIDockSlider.cpp

@@ -1,7 +1,7 @@
 #include "BsGUIDockSlider.h"
 #include "BsGUIWidget.h"
 #include "BsGUISkin.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUITabbedTitleBar.h"
 #include "BsCursor.h"
@@ -15,7 +15,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIDockSlider::GUIDockSlider(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions)
+	GUIDockSlider::GUIDockSlider(bool horizontal, const String& styleName, const GUIDimensions& layoutOptions)
 		:GUIButtonBase(styleName, GUIContent(HString(L"")), layoutOptions),
 		mDragInProgress(false), mHorizontal(horizontal), mIsCursorSet(false)
 	{
@@ -25,13 +25,13 @@ namespace BansheeEngine
 	GUIDockSlider* GUIDockSlider::create(bool horizontal, const String& styleName)
 	{
 		return new (bs_alloc<GUIDockSlider, PoolAlloc>()) GUIDockSlider(horizontal, 
-			getStyleName<GUIDockSlider>(styleName), GUILayoutOptions::create());
+			getStyleName<GUIDockSlider>(styleName), GUIDimensions::create());
 	}
 
 	GUIDockSlider* GUIDockSlider::create(bool horizontal, const GUIOptions& layoutOptions, const String& styleName)
 	{
 		return new (bs_alloc<GUIDockSlider, PoolAlloc>()) GUIDockSlider(horizontal, 
-			getStyleName<GUIDockSlider>(styleName), GUILayoutOptions::create(layoutOptions));
+			getStyleName<GUIDockSlider>(styleName), GUIDimensions::create(layoutOptions));
 	}
 
 	bool GUIDockSlider::_hasCustomCursor(const Vector2I position, CursorType& type) const

+ 4 - 4
BansheeEditor/Source/BsGUIDropButton.cpp

@@ -4,7 +4,7 @@
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
 #include "BsTextSprite.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUIHelper.h"
 #include "BsTexture.h"
@@ -18,7 +18,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIDropButton::GUIDropButton(UINT32 dragType, const String& styleName, const GUILayoutOptions& layoutOptions)
+	GUIDropButton::GUIDropButton(UINT32 dragType, const String& styleName, const GUIDimensions& layoutOptions)
 		:GUIButtonBase(styleName, GUIContent(HString(L"None")), layoutOptions), mDragType(dragType)
 	{
 
@@ -30,13 +30,13 @@ namespace BansheeEngine
 	GUIDropButton* GUIDropButton::create(UINT32 dragType, const String& styleName)
 	{
 		return new (bs_alloc<GUIDropButton, PoolAlloc>()) GUIDropButton(dragType, 
-			getStyleName<GUIDropButton>(styleName), GUILayoutOptions::create());
+			getStyleName<GUIDropButton>(styleName), GUIDimensions::create());
 	}
 
 	GUIDropButton* GUIDropButton::create(UINT32 dragType, const GUIOptions& layoutOptions, const String& styleName)
 	{
 		return new (bs_alloc<GUIDropButton, PoolAlloc>()) GUIDropButton(dragType, 
-			getStyleName<GUIDropButton>(styleName), GUILayoutOptions::create(layoutOptions));
+			getStyleName<GUIDropButton>(styleName), GUIDimensions::create(layoutOptions));
 	}
 
 	bool GUIDropButton::_mouseEvent(const GUIMouseEvent& ev)

+ 1 - 1
BansheeEditor/Source/BsGUIFieldBase.cpp

@@ -10,7 +10,7 @@ namespace BansheeEngine
 	const UINT32 GUIFieldBase::DEFAULT_LABEL_WIDTH = 100;
 
 	GUIFieldBase::GUIFieldBase(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:GUIElementContainer(layoutOptions, style), mLabel(nullptr)
 	{
 		mLayout = GUILayoutX::create();

+ 1 - 1
BansheeEditor/Source/BsGUIFloatField.cpp

@@ -20,7 +20,7 @@ namespace BansheeEngine
 	const float GUIFloatField::DRAG_SPEED = 0.05f;
 
 	GUIFloatField::GUIFloatField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth, 
-		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:TGUIField(dummy, labelContent, labelWidth, style, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
 		mLastDragPos(0), mHasInputFocus(false), mValue(0.0f)
 	{

+ 9 - 9
BansheeEditor/Source/BsGUIFoldout.cpp

@@ -13,7 +13,7 @@ using namespace std::placeholders;
 namespace BansheeEngine
 {
 	GUIFoldout::GUIFoldout(const PrivatelyConstruct& dummy, const HString& label, const String& style,
-		const GUILayoutOptions& layoutOptions)
+		const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions, style), mToggle(nullptr), mIsExpanded(false)
 	{
 		mLabel = GUILabel::create(label, getSubStyleName(getLabelStyleType()));
@@ -37,7 +37,7 @@ namespace BansheeEngine
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &getGUITypeName();
 
-		return bs_new<GUIFoldout>(PrivatelyConstruct(), label, *curStyle, GUILayoutOptions::create(layoutOptions));
+		return bs_new<GUIFoldout>(PrivatelyConstruct(), label, *curStyle, GUIDimensions::create(layoutOptions));
 	}
 
 	GUIFoldout* GUIFoldout::create(const HString& label, const String& style)
@@ -46,7 +46,7 @@ namespace BansheeEngine
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &getGUITypeName();
 
-		return bs_new<GUIFoldout>(PrivatelyConstruct(), label, *curStyle, GUILayoutOptions::create());
+		return bs_new<GUIFoldout>(PrivatelyConstruct(), label, *curStyle, GUIDimensions::create());
 	}
 
 	void GUIFoldout::setExpanded(bool expanded)
@@ -97,9 +97,9 @@ namespace BansheeEngine
 			INT32 yOffset = Math::roundToInt(((INT32)height - optimalSize.y) * 0.5f);
 
 			Vector2I offset(x, y + yOffset);
-			mToggle->setOffset(offset);
-			mToggle->setWidth(optimalSize.x);
-			mToggle->setHeight(optimalSize.y);
+			mToggle->_setPosition(offset);
+			mToggle->_setWidth(optimalSize.x);
+			mToggle->_setHeight(optimalSize.y);
 			mToggle->_setAreaDepth(areaDepth);
 			mToggle->_setWidgetDepth(widgetDepth);
 
@@ -114,9 +114,9 @@ namespace BansheeEngine
 			INT32 yOffset = Math::roundToInt(((INT32)height - optimalSize.y) * 0.5f);
 
 			Vector2I offset(x + toggleOffset, y + yOffset);
-			mLabel->setOffset(offset);
-			mLabel->setWidth(optimalSize.x);
-			mLabel->setHeight(optimalSize.y);
+			mLabel->_setPosition(offset);
+			mLabel->_setWidth(optimalSize.x);
+			mLabel->_setHeight(optimalSize.y);
 			mLabel->_setAreaDepth(areaDepth);
 			mLabel->_setWidgetDepth(widgetDepth);
 

+ 1 - 1
BansheeEditor/Source/BsGUIIntField.cpp

@@ -21,7 +21,7 @@ namespace BansheeEngine
 	const INT32 GUIIntField::DRAG_SPEED = 5;
 
 	GUIIntField::GUIIntField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-		const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:TGUIField(dummy, labelContent, labelWidth, style, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
 		mLastDragPos(0), mIsDragCursorSet(false), mHasInputFocus(false), mMinValue(std::numeric_limits<INT32>::lowest()), 
 		mMaxValue(std::numeric_limits<INT32>::max())

+ 3 - 3
BansheeEditor/Source/BsGUIResourceTreeView.cpp

@@ -32,7 +32,7 @@ namespace BansheeEngine
 
 	GUIResourceTreeView::GUIResourceTreeView(const String& backgroundStyle, const String& elementBtnStyle, 
 		const String& foldoutBtnStyle, const String& selectionBackgroundStyle, const String& editBoxStyle, 
-		const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUILayoutOptions& layoutOptions)
+		const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUIDimensions& layoutOptions)
 		:GUITreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle,
 		dragSepHighlightStyle, layoutOptions), mDraggedResources(nullptr), mCurrentWindow(nullptr), mDropTarget(nullptr), mDropTargetDragActive(false)
 	{
@@ -63,7 +63,7 @@ namespace BansheeEngine
 		const String& dragSepHighlightStyle)
 	{
 		return new (bs_alloc<GUIResourceTreeView, PoolAlloc>()) GUIResourceTreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, 
-			selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create());
+			selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUIDimensions::create());
 	}
 
 	GUIResourceTreeView* GUIResourceTreeView::create(const GUIOptions& options, const String& backgroundStyle,
@@ -71,7 +71,7 @@ namespace BansheeEngine
 		const String& editBoxStyle, const String& dragHighlightStyle, const String& dragSepHighlightStyle)
 	{
 		return new (bs_alloc<GUIResourceTreeView, PoolAlloc>()) GUIResourceTreeView(backgroundStyle, elementBtnStyle, 
-			foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create(options));
+			foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUIDimensions::create(options));
 	}
 
 	void GUIResourceTreeView::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect2I clipRect, UINT8 widgetDepth, UINT16 areaDepth)

+ 3 - 3
BansheeEditor/Source/BsGUISceneTreeView.cpp

@@ -25,7 +25,7 @@ namespace BansheeEngine
 
 	GUISceneTreeView::GUISceneTreeView(const String& backgroundStyle, const String& elementBtnStyle, 
 		const String& foldoutBtnStyle, const String& selectionBackgroundStyle, const String& editBoxStyle, 
-		const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUILayoutOptions& layoutOptions)
+		const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUIDimensions& layoutOptions)
 		:GUITreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle,
 		dragSepHighlightStyle, layoutOptions)
 	{
@@ -42,7 +42,7 @@ namespace BansheeEngine
 		const String& dragSepHighlightStyle)
 	{
 		return new (bs_alloc<GUISceneTreeView, PoolAlloc>()) GUISceneTreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, 
-			selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create());
+			selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUIDimensions::create());
 	}
 
 	GUISceneTreeView* GUISceneTreeView::create(const GUIOptions& options, const String& backgroundStyle,
@@ -50,7 +50,7 @@ namespace BansheeEngine
 		const String& editBoxStyle, const String& dragHighlightStyle, const String& dragSepHighlightStyle)
 	{
 		return new (bs_alloc<GUISceneTreeView, PoolAlloc>()) GUISceneTreeView(backgroundStyle, elementBtnStyle, 
-			foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create(options));
+			foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUIDimensions::create(options));
 	}
 
 	void GUISceneTreeView::updateTreeElement(SceneTreeElement* element)

+ 6 - 6
BansheeEditor/Source/BsGUITabButton.cpp

@@ -1,7 +1,7 @@
 #include "BsGUITabButton.h"
 #include "BsGUIWidget.h"
 #include "BsGUISkin.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUITabbedTitleBar.h"
 
@@ -16,7 +16,7 @@ namespace BansheeEngine
 	}
 
 	GUITabButton::GUITabButton(const String& styleName, const GUIToggleGroupPtr& toggleGroup, 
-		UINT32 index, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+		UINT32 index, const GUIContent& content, const GUIDimensions& layoutOptions)
 		:GUIToggle(styleName, content, toggleGroup, layoutOptions), mIndex(index), mDraggedState(false)
 	{
 
@@ -26,28 +26,28 @@ namespace BansheeEngine
 		const HString& text, const String& styleName)
 	{
 		return new (bs_alloc<GUITabButton, PoolAlloc>()) GUITabButton(
-			getStyleName<GUITabButton>(styleName), toggleGroup, index, GUIContent(text), GUILayoutOptions::create());
+			getStyleName<GUITabButton>(styleName), toggleGroup, index, GUIContent(text), GUIDimensions::create());
 	}
 
 	GUITabButton* GUITabButton::create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, 
 		const HString& text, const GUIOptions& layoutOptions, const String& styleName)
 	{
 		return new (bs_alloc<GUITabButton, PoolAlloc>()) GUITabButton(
-			getStyleName<GUITabButton>(styleName), toggleGroup, index, GUIContent(text), GUILayoutOptions::create(layoutOptions));
+			getStyleName<GUITabButton>(styleName), toggleGroup, index, GUIContent(text), GUIDimensions::create(layoutOptions));
 	}
 
 	GUITabButton* GUITabButton::create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, 
 		const GUIContent& content, const String& styleName)
 	{
 		return new (bs_alloc<GUITabButton, PoolAlloc>()) GUITabButton(
-			getStyleName<GUITabButton>(styleName), toggleGroup, index, content, GUILayoutOptions::create());
+			getStyleName<GUITabButton>(styleName), toggleGroup, index, content, GUIDimensions::create());
 	}
 
 	GUITabButton* GUITabButton::create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, 
 		const GUIContent& content, const GUIOptions& layoutOptions, const String& styleName)
 	{
 		return new (bs_alloc<GUITabButton, PoolAlloc>()) GUITabButton(
-			getStyleName<GUITabButton>(styleName), toggleGroup, index, content, GUILayoutOptions::create(layoutOptions));
+			getStyleName<GUITabButton>(styleName), toggleGroup, index, content, GUIDimensions::create(layoutOptions));
 	}
 
 	void GUITabButton::_setDraggedState(bool active) 

+ 15 - 15
BansheeEditor/Source/BsGUITabbedTitleBar.cpp

@@ -22,7 +22,7 @@ namespace BansheeEngine
 	const UINT32 GUITabbedTitleBar::OPTION_BTN_SPACING = 3;
 
 	GUITabbedTitleBar::GUITabbedTitleBar(const String& backgroundStyle, const String& tabBtnStyle, 
-		const String& minBtnStyle, const String& closeBtnStyle, const GUILayoutOptions& layoutOptions)
+		const String& minBtnStyle, const String& closeBtnStyle, const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions), mMinBtn(nullptr), 
 		mCloseBtn(nullptr), mBackgroundImage(nullptr), mUniqueTabIdx(0), mActiveTabIdx(0),
 		mDragInProgress(false), mDraggedBtn(nullptr), mDragBtnOffset(0), mInitialDragOffset(0), mBackgroundStyle(backgroundStyle),
@@ -67,10 +67,10 @@ namespace BansheeEngine
 		const String& minBtnStyle, const String& closeBtnStyle)
 	{
 		return new (bs_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(backgroundStyle, tabBtnStyle, 
-			minBtnStyle, closeBtnStyle, GUILayoutOptions::create());
+			minBtnStyle, closeBtnStyle, GUIDimensions::create());
 	}
 
-	GUITabbedTitleBar* GUITabbedTitleBar::create(const GUILayoutOptions& layoutOptions, const String& backgroundStyle, 
+	GUITabbedTitleBar* GUITabbedTitleBar::create(const GUIDimensions& layoutOptions, const String& backgroundStyle, 
 		const String& tabBtnStyle, const String& minBtnStyle, const String& closeBtnStyle)
 	{
 		return new (bs_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(backgroundStyle, tabBtnStyle, 
@@ -248,9 +248,9 @@ namespace BansheeEngine
 		{
 			Vector2I optimalSize = mBackgroundImage->_getOptimalSize();
 			Vector2I offset(x + 1, y + 1);
-			mBackgroundImage->setOffset(offset);
-			mBackgroundImage->setWidth(width - 2);
-			mBackgroundImage->setHeight(optimalSize.y);
+			mBackgroundImage->_setPosition(offset);
+			mBackgroundImage->_setWidth(width - 2);
+			mBackgroundImage->_setHeight(optimalSize.y);
 			mBackgroundImage->_setAreaDepth(areaDepth);
 			mBackgroundImage->_setWidgetDepth(widgetDepth);
 
@@ -280,9 +280,9 @@ namespace BansheeEngine
 				offset.x = mDragBtnOffset;
 			}
 
-			btn->setOffset(offset);
-			btn->setWidth(optimalSize.x);
-			btn->setHeight(optimalSize.y);
+			btn->_setPosition(offset);
+			btn->_setWidth(optimalSize.x);
+			btn->_setHeight(optimalSize.y);
 			btn->_setAreaDepth(areaDepth);
 			btn->_setWidgetDepth(widgetDepth);
 
@@ -297,9 +297,9 @@ namespace BansheeEngine
 			INT32 optionBtnYPos = curY + Math::floorToInt((tabBtnHeight - minBtnOptimalSize.y) * 0.5f);
 
 			Vector2I offset(optionBtnXPos, optionBtnYPos);
-			mMinBtn->setOffset(offset);
-			mMinBtn->setWidth(minBtnOptimalSize.x);
-			mMinBtn->setHeight(minBtnOptimalSize.y);
+			mMinBtn->_setPosition(offset);
+			mMinBtn->_setWidth(minBtnOptimalSize.x);
+			mMinBtn->_setHeight(minBtnOptimalSize.y);
 			mMinBtn->_setAreaDepth(areaDepth);
 			mMinBtn->_setWidgetDepth(widgetDepth);
 
@@ -312,9 +312,9 @@ namespace BansheeEngine
 			INT32 optionBtnYPos = curY + Math::floorToInt((tabBtnHeight - closeBtnOptimalSize.y) * 0.5f);
 
 			Vector2I offset(optionBtnXPos, optionBtnYPos);
-			mCloseBtn->setOffset(offset);
-			mCloseBtn->setWidth(closeBtnOptimalSize.x);
-			mCloseBtn->setHeight(closeBtnOptimalSize.y);
+			mCloseBtn->_setPosition(offset);
+			mCloseBtn->_setWidth(closeBtnOptimalSize.x);
+			mCloseBtn->_setHeight(closeBtnOptimalSize.y);
 			mCloseBtn->_setAreaDepth(areaDepth);
 			mCloseBtn->_setWidgetDepth(widgetDepth);
 

+ 11 - 11
BansheeEditor/Source/BsGUITextField.cpp

@@ -16,7 +16,7 @@ namespace BansheeEngine
 	const UINT32 GUITextField::DEFAULT_LABEL_WIDTH = 100;
 
 	GUITextField::GUITextField(const PrivatelyConstruct& dummy, bool multiline, const GUIContent& labelContent, 
-		UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		UINT32 labelWidth, const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:GUIElementContainer(layoutOptions, style),
 		mInputBox(nullptr), mValue(L""), mHasInputFocus(false), mLayout(nullptr), mLabel(nullptr)
 	{
@@ -50,7 +50,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, labelContent, labelWidth, *curStyle,
-			GUILayoutOptions::create(layoutOptions), true);
+			GUIDimensions::create(layoutOptions), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const GUIContent& labelContent, const GUIOptions& layoutOptions,
@@ -61,7 +61,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
-			GUILayoutOptions::create(layoutOptions), true);
+			GUIDimensions::create(layoutOptions), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
@@ -72,7 +72,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, GUIContent(labelText), labelWidth, *curStyle,
-			GUILayoutOptions::create(layoutOptions), true);
+			GUIDimensions::create(layoutOptions), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const HString& labelText, const GUIOptions& layoutOptions,
@@ -83,7 +83,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
-			GUILayoutOptions::create(layoutOptions), true);
+			GUIDimensions::create(layoutOptions), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const GUIOptions& layoutOptions, const String& style)
@@ -93,7 +93,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, GUIContent(), 0, *curStyle,
-			GUILayoutOptions::create(layoutOptions), false);
+			GUIDimensions::create(layoutOptions), false);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const GUIContent& labelContent, UINT32 labelWidth,
@@ -104,7 +104,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, labelContent, labelWidth, *curStyle,
-			GUILayoutOptions::create(), true);
+			GUIDimensions::create(), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const GUIContent& labelContent,
@@ -115,7 +115,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
-			GUILayoutOptions::create(), true);
+			GUIDimensions::create(), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const HString& labelText, UINT32 labelWidth,
@@ -126,7 +126,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, GUIContent(labelText), labelWidth, *curStyle,
-			GUILayoutOptions::create(), true);
+			GUIDimensions::create(), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const HString& labelText,
@@ -137,7 +137,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
-			GUILayoutOptions::create(), true);
+			GUIDimensions::create(), true);
 	}
 
 	GUITextField* GUITextField::create(bool multiline, const String& style)
@@ -147,7 +147,7 @@ namespace BansheeEngine
 			curStyle = &GUITextField::getGUITypeName();
 
 		return bs_new<GUITextField>(PrivatelyConstruct(), multiline, GUIContent(), 0, *curStyle,
-			GUILayoutOptions::create(), false);
+			GUIDimensions::create(), false);
 	}
 
 	void GUITextField::setValue(const WString& value)

+ 1 - 1
BansheeEditor/Source/BsGUIToggleField.cpp

@@ -14,7 +14,7 @@ using namespace std::placeholders;
 namespace BansheeEngine
 {
 	GUIToggleField::GUIToggleField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
-		UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		UINT32 labelWidth, const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:TGUIField(dummy, labelContent, labelWidth, style, layoutOptions, withLabel), mToggle(nullptr), mValue(false)
 	{
 		mToggle = GUIToggle::create(HString(L""), getSubStyleName(getToggleStyleType()));

+ 34 - 34
BansheeEditor/Source/BsGUITreeView.cpp

@@ -82,7 +82,7 @@ namespace BansheeEngine
 
 	GUITreeView::GUITreeView(const String& backgroundStyle, const String& elementBtnStyle, 
 		const String& foldoutBtnStyle, const String& selectionBackgroundStyle, const String& editBoxStyle, 
-		const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUILayoutOptions& layoutOptions)
+		const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions), mBackgroundStyle(backgroundStyle),
 		mElementBtnStyle(elementBtnStyle), mFoldoutBtnStyle(foldoutBtnStyle), mEditBoxStyle(editBoxStyle), mEditElement(nullptr), mIsElementSelected(false),
 		mNameEditBox(nullptr), mSelectionBackgroundStyle(selectionBackgroundStyle), mDragInProgress(nullptr), mDragHighlightStyle(dragHighlightStyle),
@@ -757,10 +757,10 @@ namespace BansheeEngine
 
 		Vector2I optimalSize;
 
-		if(_getLayoutOptions().fixedWidth && _getLayoutOptions().fixedHeight)
+		if (_getDimensions().fixedWidth() && _getDimensions().fixedHeight())
 		{
-			optimalSize.x = _getLayoutOptions().width;
-			optimalSize.y = _getLayoutOptions().height;
+			optimalSize.x = _getDimensions().minWidth;
+			optimalSize.y = _getDimensions().minHeight;
 		}
 		else
 		{
@@ -793,26 +793,26 @@ namespace BansheeEngine
 				}
 			}
 
-			if(_getLayoutOptions().fixedWidth)
-				optimalSize.x = _getLayoutOptions().width;
+			if(_getDimensions().fixedWidth())
+				optimalSize.x = _getDimensions().minWidth;
 			else
 			{
-				if(_getLayoutOptions().minWidth > 0)
-					optimalSize.x = std::max((INT32)_getLayoutOptions().minWidth, optimalSize.x);
+				if(_getDimensions().minWidth > 0)
+					optimalSize.x = std::max((INT32)_getDimensions().minWidth, optimalSize.x);
 
-				if(_getLayoutOptions().maxWidth > 0)
-					optimalSize.x = std::min((INT32)_getLayoutOptions().maxWidth, optimalSize.x);
+				if(_getDimensions().maxWidth > 0)
+					optimalSize.x = std::min((INT32)_getDimensions().maxWidth, optimalSize.x);
 			}
 
-			if(_getLayoutOptions().fixedHeight)
-				optimalSize.y = _getLayoutOptions().height;
+			if (_getDimensions().fixedHeight())
+				optimalSize.y = _getDimensions().minHeight;
 			else
 			{
-				if(_getLayoutOptions().minHeight > 0)
-					optimalSize.y = std::max((INT32)_getLayoutOptions().minHeight, optimalSize.y);
+				if(_getDimensions().minHeight > 0)
+					optimalSize.y = std::max((INT32)_getDimensions().minHeight, optimalSize.y);
 
-				if(_getLayoutOptions().maxHeight > 0)
-					optimalSize.y = std::min((INT32)_getLayoutOptions().maxHeight, optimalSize.y);
+				if(_getDimensions().maxHeight > 0)
+					optimalSize.y = std::min((INT32)_getDimensions().maxHeight, optimalSize.y);
 			}
 		}
 
@@ -873,9 +873,9 @@ namespace BansheeEngine
 				offset.x = x + INITIAL_INDENT_OFFSET + indent * INDENT_SIZE;
 				offset.y += ELEMENT_EXTRA_SPACING;
 
-				current->mElement->setOffset(offset);
-				current->mElement->setWidth(elementSize.x);
-				current->mElement->setHeight(elementSize.y);
+				current->mElement->_setPosition(offset);
+				current->mElement->_setWidth(elementSize.x);
+				current->mElement->_setHeight(elementSize.y);
 				current->mElement->_setAreaDepth(areaDepth);
 				current->mElement->_setWidgetDepth(widgetDepth);
 
@@ -901,9 +901,9 @@ namespace BansheeEngine
 					myOffset.y -= Math::floorToInt(half);
 				}
 
-				current->mFoldoutBtn->setOffset(myOffset);
-				current->mFoldoutBtn->setWidth(elementSize.x);
-				current->mFoldoutBtn->setHeight(elementSize.y);
+				current->mFoldoutBtn->_setPosition(myOffset);
+				current->mFoldoutBtn->_setWidth(elementSize.x);
+				current->mFoldoutBtn->_setHeight(elementSize.y);
 				current->mFoldoutBtn->_setAreaDepth(areaDepth);
 				current->mFoldoutBtn->_setWidgetDepth(widgetDepth);
 
@@ -942,9 +942,9 @@ namespace BansheeEngine
 			Vector2I offset = targetElement->_getOffset();
 			offset.x = x;
 
-			selectedElem.background->setOffset(offset);
-			selectedElem.background->setWidth(width);
-			selectedElem.background->setHeight(targetElement->_getHeight());
+			selectedElem.background->_setPosition(offset);
+			selectedElem.background->_setWidth(width);
+			selectedElem.background->_setHeight(targetElement->_getHeight());
 			selectedElem.background->_setAreaDepth(areaDepth);
 			selectedElem.background->_setWidgetDepth(widgetDepth);
 
@@ -959,9 +959,9 @@ namespace BansheeEngine
 			Vector2I offset = targetElement->_getOffset();
 			UINT32 remainingWidth = (UINT32)std::max(0, (((INT32)width) - (offset.x - x)));
 
-			mNameEditBox->setOffset(offset);
-			mNameEditBox->setWidth(remainingWidth);
-			mNameEditBox->setHeight(targetElement->_getHeight());
+			mNameEditBox->_setPosition(offset);
+			mNameEditBox->_setWidth(remainingWidth);
+			mNameEditBox->_setHeight(targetElement->_getHeight());
 			mNameEditBox->_setAreaDepth(areaDepth);
 			mNameEditBox->_setWidgetDepth(widgetDepth);
 
@@ -993,9 +993,9 @@ namespace BansheeEngine
 						mDragHighlight->enableRecursively();
 
 					Vector2I offset(interactableElement->bounds.x, interactableElement->bounds.y);
-					mDragHighlight->setOffset(offset);
-					mDragHighlight->setWidth(interactableElement->bounds.width);
-					mDragHighlight->setHeight(interactableElement->bounds.height);
+					mDragHighlight->_setPosition(offset);
+					mDragHighlight->_setWidth(interactableElement->bounds.width);
+					mDragHighlight->_setHeight(interactableElement->bounds.height);
 					mDragHighlight->_setAreaDepth(areaDepth);
 					mDragHighlight->_setWidgetDepth(widgetDepth);
 
@@ -1011,9 +1011,9 @@ namespace BansheeEngine
 						mDragSepHighlight->enableRecursively();
 
 					Vector2I offset(interactableElement->bounds.x, interactableElement->bounds.y);
-					mDragSepHighlight->setOffset(offset);
-					mDragSepHighlight->setWidth(interactableElement->bounds.width);
-					mDragSepHighlight->setHeight(interactableElement->bounds.height);
+					mDragSepHighlight->_setPosition(offset);
+					mDragSepHighlight->_setWidth(interactableElement->bounds.width);
+					mDragSepHighlight->_setHeight(interactableElement->bounds.height);
 					mDragSepHighlight->_setAreaDepth(areaDepth);
 					mDragSepHighlight->_setWidgetDepth(widgetDepth);
 

+ 3 - 3
BansheeEditor/Source/BsGUITreeViewEditBox.cpp

@@ -13,15 +13,15 @@ namespace BansheeEngine
 
 	GUITreeViewEditBox* GUITreeViewEditBox::create(const String& styleName)
 	{
-		return new (bs_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(getStyleName<GUITreeViewEditBox>(styleName), GUILayoutOptions::create());
+		return new (bs_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(getStyleName<GUITreeViewEditBox>(styleName), GUIDimensions::create());
 	}
 
 	GUITreeViewEditBox* GUITreeViewEditBox::create(const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(getStyleName<GUITreeViewEditBox>(styleName), GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(getStyleName<GUITreeViewEditBox>(styleName), GUIDimensions::create(layoutOptions));
 	}
 
-	GUITreeViewEditBox::GUITreeViewEditBox(const String& styleName, const GUILayoutOptions& layoutOptions)
+	GUITreeViewEditBox::GUITreeViewEditBox(const String& styleName, const GUIDimensions& layoutOptions)
 		:GUIInputBox(styleName, layoutOptions, false)
 	{
 

+ 2 - 2
BansheeEditor/Source/BsGUIVector2Field.cpp

@@ -17,7 +17,7 @@ namespace BansheeEngine
 	const UINT32 GUIVector2Field::ELEMENT_LABEL_WIDTH = 10;
 
 	GUIVector2Field::GUIVector2Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
-		UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		UINT32 labelWidth, const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:TGUIField(dummy, labelContent, labelWidth, style, layoutOptions, withLabel), 
 		mFieldX(nullptr), mFieldY(nullptr)
 	{
@@ -32,7 +32,7 @@ namespace BansheeEngine
 		GUILayout* layout = mLayout->addNewElement<GUILayoutY>();
 
 		layout->addElement(mLabel);
-		mLabel->setLayoutOptions(GUIOptions());
+		mLabel->resetDimensions();
 
 		GUILayout* elementLayout = layout->addNewElement<GUILayoutX>();
 

+ 2 - 2
BansheeEditor/Source/BsGUIVector3Field.cpp

@@ -17,7 +17,7 @@ namespace BansheeEngine
 	const UINT32 GUIVector3Field::ELEMENT_LABEL_WIDTH = 10;
 
 	GUIVector3Field::GUIVector3Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
-		UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		UINT32 labelWidth, const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:TGUIField(dummy, labelContent, labelWidth, style, layoutOptions, withLabel), 
 		mFieldX(nullptr), mFieldY(nullptr), mFieldZ(nullptr)
 	{
@@ -33,7 +33,7 @@ namespace BansheeEngine
 
 		GUILayout* layout = mLayout->addNewElement<GUILayoutY>();
 		layout->addElement(mLabel);
-		mLabel->setLayoutOptions(GUIOptions());
+		mLabel->resetDimensions();
 
 		GUILayout* elementLayout = layout->addNewElement<GUILayoutX>();
 

+ 2 - 2
BansheeEditor/Source/BsGUIVector4Field.cpp

@@ -17,7 +17,7 @@ namespace BansheeEngine
 	const UINT32 GUIVector4Field::ELEMENT_LABEL_WIDTH = 10;
 
 	GUIVector4Field::GUIVector4Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
-		UINT32 labelWidth, const String& style, const GUILayoutOptions& layoutOptions, bool withLabel)
+		UINT32 labelWidth, const String& style, const GUIDimensions& layoutOptions, bool withLabel)
 		:TGUIField(dummy, labelContent, labelWidth, style, layoutOptions, withLabel), mFieldX(nullptr), mFieldY(nullptr)
 	{
 		mFieldX = GUIFloatField::create(HString(L"X"), ELEMENT_LABEL_WIDTH, getSubStyleName(getFloatFieldStyleType()));
@@ -34,7 +34,7 @@ namespace BansheeEngine
 
 		GUILayout* layout = mLayout->addNewElement<GUILayoutY>();
 		layout->addElement(mLabel);
-		mLabel->setLayoutOptions(GUIOptions());
+		mLabel->resetDimensions();
 
 		GUILayout* elementLayout = layout->addNewElement<GUILayoutX>();
 

+ 4 - 4
BansheeEditor/Source/BsGUIWindowDropArea.cpp

@@ -4,7 +4,7 @@
 #include "BsGUIWidget.h"
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 
 namespace BansheeEngine
@@ -15,7 +15,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIWindowDropArea::GUIWindowDropArea(const String& styleName, const GUILayoutOptions& layoutOptions)
+	GUIWindowDropArea::GUIWindowDropArea(const String& styleName, const GUIDimensions& layoutOptions)
 		:GUITexture(styleName, HSpriteTexture(), GUIImageScaleMode::ScaleToFit, true, layoutOptions)
 	{ }
 
@@ -25,13 +25,13 @@ namespace BansheeEngine
 	GUIWindowDropArea* GUIWindowDropArea::create(const String& styleName)
 	{
 		return new (bs_alloc<GUIWindowDropArea, PoolAlloc>()) 
-			GUIWindowDropArea(getStyleName<GUIWindowDropArea>(styleName), GUILayoutOptions::create());
+			GUIWindowDropArea(getStyleName<GUIWindowDropArea>(styleName), GUIDimensions::create());
 	}
 
 	GUIWindowDropArea* GUIWindowDropArea::create(const GUIOptions& layoutOptions, const String& styleName)
 	{
 		return new (bs_alloc<GUIWindowDropArea, PoolAlloc>()) 
-			GUIWindowDropArea(getStyleName<GUIWindowDropArea>(styleName), GUILayoutOptions::create(layoutOptions));
+			GUIWindowDropArea(getStyleName<GUIWindowDropArea>(styleName), GUIDimensions::create(layoutOptions));
 	}
 
 	void GUIWindowDropArea::setFocused(bool focused)

+ 4 - 4
BansheeEditor/Source/BsGUIWindowFrame.cpp

@@ -3,7 +3,7 @@
 #include "BsGUIWidget.h"
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsCoreApplication.h"
 #include "BsPlatform.h"
@@ -18,7 +18,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIWindowFrame::GUIWindowFrame(const String& styleName, const GUILayoutOptions& layoutOptions)
+	GUIWindowFrame::GUIWindowFrame(const String& styleName, const GUIDimensions& layoutOptions)
 		:GUITexture(styleName, HSpriteTexture(), GUIImageScaleMode::StretchToFit, true, layoutOptions)
 	{
 
@@ -29,12 +29,12 @@ namespace BansheeEngine
 
 	GUIWindowFrame* GUIWindowFrame::create(const String& styleName)
 	{
-		return new (bs_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(getStyleName<GUIWindowFrame>(styleName), GUILayoutOptions::create());
+		return new (bs_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(getStyleName<GUIWindowFrame>(styleName), GUIDimensions::create());
 	}
 
 	GUIWindowFrame* GUIWindowFrame::create(const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(getStyleName<GUIWindowFrame>(styleName), GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(getStyleName<GUIWindowFrame>(styleName), GUIDimensions::create(layoutOptions));
 	}
 
 	void GUIWindowFrame::setFocused(bool focused)

+ 2 - 2
BansheeEngine/BansheeEngine.vcxproj

@@ -306,7 +306,7 @@
     <ClInclude Include="Include\BsGUITextInputEvent.h" />
     <ClInclude Include="Include\BsGUIInputCaret.h" />
     <ClInclude Include="Include\BsGUIInputSelection.h" />
-    <ClInclude Include="Include\BsGUILayoutOptions.h" />
+    <ClInclude Include="Include\BsGUIDimensions.h" />
     <ClInclude Include="Include\BsGUILayoutX.h" />
     <ClInclude Include="Include\BsGUILayout.h" />
     <ClInclude Include="Include\BsGUILayoutY.h" />
@@ -370,7 +370,7 @@
     <ClCompile Include="Source\BsGUIDropDownHitBox.cpp" />
     <ClCompile Include="Source\BsGUIElementContainer.cpp" />
     <ClCompile Include="Source\BsGUIHelper.cpp" />
-    <ClCompile Include="Source\BsGUILayoutOptions.cpp" />
+    <ClCompile Include="Source\BsGUIDimensions.cpp" />
     <ClCompile Include="Source\BsGUIListBox.cpp" />
     <ClCompile Include="Source\BsGUIElement.cpp" />
     <ClCompile Include="Source\BsGUIElementBase.cpp" />

+ 6 - 6
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -113,9 +113,6 @@
     <ClInclude Include="Include\BsGUILayoutY.h">
       <Filter>Header Files\GUI</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsGUILayoutOptions.h">
-      <Filter>Header Files\GUI</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsGUISpace.h">
       <Filter>Header Files\GUI</Filter>
     </ClInclude>
@@ -332,6 +329,9 @@
     <ClInclude Include="Include\BsGUISkinRTTI.h">
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsGUIDimensions.h">
+      <Filter>Header Files\GUI</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsGUIElement.cpp">
@@ -478,9 +478,6 @@
     <ClCompile Include="Source\BsGUIOptions.cpp">
       <Filter>Source Files\GUI</Filter>
     </ClCompile>
-    <ClCompile Include="Source\BsGUILayoutOptions.cpp">
-      <Filter>Source Files\GUI</Filter>
-    </ClCompile>
     <ClCompile Include="Source\BsGUIRenderTexture.cpp">
       <Filter>Source Files\GUI</Filter>
     </ClCompile>
@@ -577,5 +574,8 @@
     <ClCompile Include="Source\BsGUISkinRTTI.cpp">
       <Filter>Source Files\RTTI</Filter>
     </ClCompile>
+    <ClCompile Include="Source\BsGUIDimensions.cpp">
+      <Filter>Source Files\GUI</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 1 - 1
BansheeEngine/Include/BsGUIButton.h

@@ -70,6 +70,6 @@ namespace BansheeEngine
 		 */
 		virtual ElementType _getElementType() const { return ElementType::Button; }
 	private:
-		GUIButton(const String& styleName, const GUIContent& content, const GUILayoutOptions& layoutOptions);
+		GUIButton(const String& styleName, const GUIContent& content, const GUIDimensions& layoutOptions);
 	};
 }

+ 1 - 1
BansheeEngine/Include/BsGUIButtonBase.h

@@ -84,7 +84,7 @@ namespace BansheeEngine
 		 */
 		Event<void()> onDoubleClick;
 	protected:
-		GUIButtonBase(const String& styleName, const GUIContent& content, const GUILayoutOptions& layoutOptions);
+		GUIButtonBase(const String& styleName, const GUIContent& content, const GUIDimensions& layoutOptions);
 		virtual ~GUIButtonBase();
 
 		/**

+ 83 - 0
BansheeEngine/Include/BsGUIDimensions.h

@@ -0,0 +1,83 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsVector2I.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Contains valid size range for a GUI element in a GUI layout.
+	 */
+	struct BS_EXPORT LayoutSizeRange
+	{
+		Vector2I optimal;
+		Vector2I min;
+		Vector2I max;
+	};
+
+	/**
+	 * @brief	Flags that identify the type of data stored in a GUIDimensions structure.
+	 */
+	enum GUIDimensionFlags
+	{
+		GUIDF_FixedWidth = 0x01, 
+		GUIDF_FixedHeight = 0x02, 
+		GUIDF_OverWidth = 0x04, 
+		GUIDF_OverHeight = 0x08
+	};
+
+	/**
+	 * @brief	Options that control how an element is positioned and sized.
+	 */
+	struct BS_EXPORT GUIDimensions
+	{
+		/**
+		 * @brief	Creates new default layout options.
+		 */
+		static GUIDimensions create();
+
+		/**
+		 * @brief	Creates layout options with user defined options.
+		 */
+		static GUIDimensions create(const GUIOptions& options);
+
+		GUIDimensions();
+
+		/**
+		 * @brief	Updates layout options from the provided style. If user has not manually
+		 *			set a specific layout property, that property will be inherited from style.
+		 */
+		void updateWithStyle(const GUIElementStyle* style);
+
+		/**
+		 * @brief	Calculates size range for a GUI element using this layout.
+		 *
+		 * @param	optimal	Preferred size of the GUI element.
+		 */
+		LayoutSizeRange calculateSizeRange(const Vector2I& optimal) const;
+
+		/**
+		 * @brief	Checks do the dimensions override the style height.
+		 */
+		bool overridenHeight() const { return (flags & GUIDF_OverHeight) != 0; }
+
+		/**
+		 * @brief	Checks do the dimensions override the style width.
+		 */
+		bool overridenWidth() const { return (flags & GUIDF_OverWidth) != 0; }
+
+		/**
+		 * @brief	Checks do the dimensions contain fixed width.
+		 */
+		bool fixedWidth() const { return (flags & GUIDF_FixedWidth) != 0; }
+
+		/**
+		 * @brief	Checks do the dimensions contain fixed height.
+		 */
+		bool fixedHeight() const { return (flags & GUIDF_FixedHeight) != 0; }
+
+		INT32 x, y;
+		UINT32 minWidth, maxWidth, minHeight, maxHeight;
+		UINT32 flags;
+	};
+}

+ 1 - 1
BansheeEngine/Include/BsGUIDropDownContent.h

@@ -77,7 +77,7 @@ namespace BansheeEngine
 		static const String SEPARATOR_STYLE_TYPE;
 	protected:
 		GUIDropDownContent(GUIDropDownBox::DropDownSubMenu* parent, const GUIDropDownData& dropDownData, 
-			const String& style, const GUILayoutOptions& layoutOptions);
+			const String& style, const GUIDimensions& layoutOptions);
 		~GUIDropDownContent() override;
 
 		/**

+ 1 - 1
BansheeEngine/Include/BsGUIDropDownHitBox.h

@@ -58,7 +58,7 @@ namespace BansheeEngine
 		Event<void()> onFocusGained;
 
 	private:
-		GUIDropDownHitBox(bool captureMouse, const GUILayoutOptions& layoutOptions);
+		GUIDropDownHitBox(bool captureMouse, const GUIDimensions& layoutOptions);
 
 		virtual bool _commandEvent(const GUICommandEvent& ev);
 		virtual bool _mouseEvent(const GUIMouseEvent& ev);

+ 27 - 38
BansheeEngine/Include/BsGUIElement.h

@@ -32,7 +32,7 @@ namespace BansheeEngine
 		};
 
 	public:
-		GUIElement(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIElement(const String& styleName, const GUIDimensions& dimensions);
 		virtual ~GUIElement();
 
 		/**
@@ -46,33 +46,15 @@ namespace BansheeEngine
 		virtual void setTint(const Color& color) { }
 
 		/**
-		 * @brief	Sets new layout options for the element.
-		 *
-		 * @param	layoutOptions	Options that allows you to control how is the element positioned in
-		 *							GUI layout. This will override any similar options set by style.
+		 * @copydoc	GUIElementBase::resetDimensions
 		 */
-		void setLayoutOptions(const GUIOptions& layoutOptions);
+		virtual void resetDimensions() override;
 
 		/**
 		 * @brief	Sets new style to be used by the element.
 		 */
 		void setStyle(const String& styleName);
 
-		/**
-		 * @copydoc	GUIElementBase::setWidth
-		 */
-		void setWidth(UINT32 width) override;
-
-		/**
-		 * @copydoc	GUIElementBase::setHeight
-		 */
-		void setHeight(UINT32 height) override;
-
-		/**
-		 * @copydoc	GUIElementBase::setOffset
-		 */
-		void setOffset(const Vector2I& offset) override;
-
 		/**
 		 * @copydoc	GUIElementBase::getVisibleBounds
 		 */
@@ -88,6 +70,27 @@ namespace BansheeEngine
 		/* 							INTERNAL METHODS                      		*/
 		/************************************************************************/
 
+		/**
+		 * @brief	Sets element position relative to widget origin. This will be the position used directly for rendering.
+		 *
+		 * @note	Internal method.
+		 */
+		virtual void _setPosition(const Vector2I& offset);
+
+		/**
+		 * @brief	Sets element width in pixels. This will be the width used directly for rendering.
+		 *
+		 * @note	Internal method.
+		 */
+		virtual void _setWidth(UINT32 width);
+
+		/**
+		 * @brief	Sets element height in pixels. This will be the height used directly for rendering.
+		 *
+		 * @note	Internal method.
+		 */
+		virtual void _setHeight(UINT32 height);
+
 		/**
 		 * @brief	Returns the number of separate render elements in the GUI element.
 		 * 			
@@ -362,11 +365,6 @@ namespace BansheeEngine
 		 */
 		virtual bool _hasCustomCursor(const Vector2I position, CursorType& type) const { return false; }
 
-		/**
-		 * @copydoc	GUIElementBase::_calculateLayoutSizeRange
-		 */
-		virtual LayoutSizeRange _calculateLayoutSizeRange() const;
-
 		/**
 		 * @brief	Checks if the GUI element accepts a drag and drop operation of the specified type.
 		 *
@@ -397,12 +395,6 @@ namespace BansheeEngine
 		 */
 		virtual Rect2I _getTextInputRect() const { return Rect2I(); }
 
-		/**
-		 * @brief	Returns layout options that determine how is the element positioned within a GUILayout.
-		 *
-		 * @note	Internal method.
-		 */
-		const GUILayoutOptions& _getLayoutOptions() const { return mLayoutOptions; }
 	protected:
 		/**
 		 * @brief	Called whenever render elements are dirty and need to be rebuilt.
@@ -415,11 +407,6 @@ namespace BansheeEngine
 		 */
 		virtual void updateClippedBounds() = 0;
 
-		/**
-		 * @brief	Sets layout options that determine how is the element positioned within a GUILayout.
-		 */
-		void setLayoutOptions(const GUILayoutOptions& layoutOptions);
-		
 		/**
 		 * @brief	Helper method that returns style name used by an element of a certain type.
 		 *			If override style is empty, default style for that type is returned.
@@ -466,12 +453,14 @@ namespace BansheeEngine
 		Rect2I getCachedContentClipRect() const;
 
 		bool mIsDestroyed;
-		GUILayoutOptions mLayoutOptions;
 		Rect2I mClippedBounds;
 
 		UINT32 mDepth;
 		Rect2I mClipRect;
 
+		Vector2I mOffset;
+		UINT32 mWidth, mHeight;
+
 	private:
 		const GUIElementStyle* mStyle;
 		String mStyleName;

+ 43 - 20
BansheeEngine/Include/BsGUIElementBase.h

@@ -2,7 +2,7 @@
 
 #include "BsPrerequisites.h"
 #include "BsGUIMaterialInfo.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsRect2I.h"
 #include "BsVector2I.h"
 #include "BsRectOffset.h"
@@ -28,38 +28,55 @@ namespace BansheeEngine
 
 	public:
 		GUIElementBase();
+		GUIElementBase(const GUIDimensions& dimensions);
 		virtual ~GUIElementBase();
 
 		/**
-		 * @brief	Enables (default) this element and all its children.
+		 * @brief	Sets element position relative to parent GUI panel.
+		 *
+		 * @note	Be aware that this value will be ignored if GUI element is part of a layout since then
+		 *			the layout controls its placement.
 		 */
-		void enableRecursively();
+		void setPosition(INT32 x, INT32 y);
 
 		/**
-		 * @brief	Disables this element and all its children.
+		 * @brief	Sets element width in pixels. 
 		 */
-		void disableRecursively();
+		void setWidth(UINT32 width);
 
 		/**
-		 * @brief	Sets element position relative to widget origin.
-		 *
-		 * @note	Be aware that this value will get overwritten if your element is part of a non-explicit layout.
+		 * @brief	Sets element width in pixels. Element will be resized according to its 
+		 *			contents and parent layout but will always stay within the provided range.
+		 *			If maximum width is zero, the element is allowed to expand as much as it needs.
 		 */
-		virtual void setOffset(const Vector2I& offset);
+		void setFlexibleWidth(UINT32 minWidth = 0, UINT32 maxWidth = 0);
 
 		/**
-		 * @brief	Sets element width in pixels.
-		 *
-		 * @note	Be aware that this value will get overwritten if your element is part of a non-explicit layout.
+		 * @brief	Sets element height in pixels.
 		 */
-		virtual void setWidth(UINT32 width);
+		void setHeight(UINT32 height);
 
 		/**
-		 * @brief	Sets element height in pixels.
-		 *
-		 * @note	Be aware that this value will get overwritten if your element is part of a non-explicit layout.
+		 * @brief	Sets element height in pixels. Element will be resized according to its 
+		 *			contents and parent layout but will always stay within the provided range.
+		 *			If maximum height is zero, the element is allowed to expand as much as it needs.
+		 */
+		void setFlexibleHeight(UINT32 minHeight = 0, UINT32 maxHeight = 0);
+
+		/**
+		 * @brief	Resets element dimensions to their initial values dictated by the elements style.
+		 */
+		virtual void resetDimensions();
+
+		/**
+		 * @brief	Enables (default) this element and all its children.
+		 */
+		void enableRecursively();
+
+		/**
+		 * @brief	Disables this element and all its children.
 		 */
-		virtual void setHeight(UINT32 height);
+		void disableRecursively();
 
 		/**
 		 * @brief	Returns non-clipped bounds of the GUI element. Relative to the parent widget.
@@ -155,12 +172,19 @@ namespace BansheeEngine
 		 */
 		virtual Vector2I _getOptimalSize() const = 0;
 
+		/**
+		 * @brief	Returns layout options that determine how is the element positioned and sized.
+		 *
+		 * @note	Internal method.
+		 */
+		const GUIDimensions& _getDimensions() const { return mDimensions; }
+
 		/**
 		 * @brief	Returns element size range constrained by its layout options.
 		 *
 		 * @note	Internal method.
 		 */
-		virtual LayoutSizeRange _calculateLayoutSizeRange() const = 0;
+		virtual LayoutSizeRange _calculateLayoutSizeRange() const ;
 
 		/**
 		 * @brief	Returns element padding that determines how far apart to space out this element
@@ -262,7 +286,6 @@ namespace BansheeEngine
 		UINT8 mIsDirty;
 		bool mIsDisabled;
 
-		Vector2I mOffset;
-		UINT32 mWidth, mHeight;
+		GUIDimensions mDimensions;
 	};
 }

+ 2 - 2
BansheeEngine/Include/BsGUIElementContainer.h

@@ -15,10 +15,10 @@ namespace BansheeEngine
 		/**
 		 * @copydoc	GUIElementBase::setOffset
 		 */
-		void setOffset(const Vector2I& offset) override;
+		void _setPosition(const Vector2I& offset) override;
 
 	protected:
-		GUIElementContainer(const GUILayoutOptions& layoutOptions, const String& style = StringUtil::BLANK);
+		GUIElementContainer(const GUIDimensions& layoutOptions, const String& style = StringUtil::BLANK);
 		virtual ~GUIElementContainer();
 
 		/**

+ 3 - 3
BansheeEngine/Include/BsGUIHelper.h

@@ -19,7 +19,7 @@ namespace BansheeEngine
 		 * @param	style			Style to use for determining size constraints.
 		 * @param	layoutOptions	Layout options to use for determining size constraints.
 		 */
-		static Vector2I calcOptimalContentsSize(const Vector2I& contentSize, const GUIElementStyle& style, const GUILayoutOptions& layoutOptions);
+		static Vector2I calcOptimalContentsSize(const Vector2I& contentSize, const GUIElementStyle& style, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @brief	Calculates optimal content size for the provided content using the provided style and layout options for constraints.
@@ -28,7 +28,7 @@ namespace BansheeEngine
 		 * @param	style			Style to use for determining size constraints.
 		 * @param	layoutOptions	Layout options to use for determining size constraints.
 		 */
-		static Vector2I calcOptimalContentsSize(const GUIContent& content, const GUIElementStyle& style, const GUILayoutOptions& layoutOptions);
+		static Vector2I calcOptimalContentsSize(const GUIContent& content, const GUIElementStyle& style, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @brief	Calculates optimal content size for the provided text using the provided style and layout options for constraints.
@@ -37,6 +37,6 @@ namespace BansheeEngine
 		 * @param	style			Style to use for determining size constraints.
 		 * @param	layoutOptions	Layout options to use for determining size constraints.
 		 */
-		static Vector2I calcOptimalContentsSize(const WString& text, const GUIElementStyle& style, const GUILayoutOptions& layoutOptions);
+		static Vector2I calcOptimalContentsSize(const WString& text, const GUIElementStyle& style, const GUIDimensions& layoutOptions);
 	};
 }

+ 1 - 1
BansheeEngine/Include/BsGUIInputBox.h

@@ -111,7 +111,7 @@ namespace BansheeEngine
 		 */
 		Event<void()> onFocusLost;
 	protected:
-		GUIInputBox(const String& styleName, const GUILayoutOptions& layoutOptions, bool multiline);
+		GUIInputBox(const String& styleName, const GUIDimensions& layoutOptions, bool multiline);
 		virtual ~GUIInputBox();
 
 		/**

+ 1 - 1
BansheeEngine/Include/BsGUILabel.h

@@ -115,7 +115,7 @@ namespace BansheeEngine
 		 */
 		virtual void updateClippedBounds();
 	private:
-		GUILabel(const String& styleName, const GUIContent& content, const GUILayoutOptions& layoutOptions);
+		GUILabel(const String& styleName, const GUIContent& content, const GUIDimensions& layoutOptions);
 
 		TextSprite* mTextSprite;
 		GUIContent mContent;

+ 6 - 1
BansheeEngine/Include/BsGUILayout.h

@@ -112,12 +112,17 @@ namespace BansheeEngine
 
 		/**
 		 * @brief	Calculates the actual size of the layout taken up by all of its elements.
+		 *
+		 * @param	x				Origin based on which to calculate the size.
+		 * @param	y				Origin based on which to calculate the size.
+		 * @param	elementAreas	Array containing areas of all child elements.
+		 * @param	numElements		Number of elements in the elements array.
 		 *			
 		 * @note	Actual size means the bounds might be smaller or larger than the layout area itself.
 		 *			If larger that means certain portions of the child elements will be clipped, and if
 		 *			smaller certain portions of the layout area will be empty.
 		 */
-		virtual Vector2I _calcActualSize(Rect2I* elementAreas, UINT32 numElements) const = 0;
+		virtual Vector2I _calcActualSize(INT32 x, INT32 y, Rect2I* elementAreas, UINT32 numElements) const = 0;
 
 		/**
 		 * @brief	Destroy the layout. Removes it from parent and widget, and deletes it.

+ 1 - 1
BansheeEngine/Include/BsGUILayoutExplicit.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 		/**
 		 * @copydoc	GUILayout::_calcActualSize
 		 */
-		virtual Vector2I _calcActualSize(Rect2I* elementAreas, UINT32 numElements) const;
+		virtual Vector2I _calcActualSize(INT32 x, INT32 y, Rect2I* elementAreas, UINT32 numElements) const;
 
 		/**
 		 * @brief	Creates a new GUI panel.

+ 0 - 53
BansheeEngine/Include/BsGUILayoutOptions.h

@@ -1,53 +0,0 @@
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsVector2I.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Contains valid size range for a GUI element in a GUI layout
-	 */
-	struct BS_EXPORT LayoutSizeRange
-	{
-		Vector2I optimal;
-		Vector2I min;
-		Vector2I max;
-	};
-
-	/**
-	 * @brief	Options that control how an element is positioned and sized in a GUI layout.
-	 */
-	struct BS_EXPORT GUILayoutOptions
-	{
-		/**
-		 * @brief	Creates new default layout options.
-		 */
-		static GUILayoutOptions create();
-
-		/**
-		 * @brief	Creates layout options with user defined options.
-		 */
-		static GUILayoutOptions create(const GUIOptions& options);
-
-		GUILayoutOptions();
-
-		/**
-		 * @brief	Updates layout options from the provided style. If user has not manually
-		 *			set a specific layout property, that property will be inherited from style.
-		 */
-		void updateWithStyle(const GUIElementStyle* style);
-
-		/**
-		 * @brief	Calculates size range for a GUI element using this layout.
-		 *
-		 * @param	optimal	Preferred size of the GUI element.
-		 */
-		LayoutSizeRange calculateSizeRange(const Vector2I& optimal) const;
-
-		UINT32 width, height;
-		UINT32 minWidth, maxWidth, minHeight, maxHeight;
-		bool fixedWidth, fixedHeight;
-		bool overridenWidth, overridenHeight;
-	};
-}

+ 1 - 1
BansheeEngine/Include/BsGUILayoutX.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 		/**
 		 * @copydoc	GUILayout::_calcActualSize
 		 */
-		virtual Vector2I _calcActualSize(Rect2I* elementAreas, UINT32 numElements) const;
+		virtual Vector2I _calcActualSize(INT32 x, INT32 y, Rect2I* elementAreas, UINT32 numElements) const;
 
 		/**
 		 * @brief	Creates a new horizontal layout.

+ 1 - 1
BansheeEngine/Include/BsGUILayoutY.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 		/**
 		 * @copydoc	GUILayout::_calcActualSize
 		 */
-		virtual Vector2I _calcActualSize(Rect2I* elementAreas, UINT32 numElements) const;
+		virtual Vector2I _calcActualSize(INT32 x, INT32 y, Rect2I* elementAreas, UINT32 numElements) const;
 
 		/**
 		 * @brief	Creates a new vertical layout.

+ 1 - 1
BansheeEngine/Include/BsGUIListBox.h

@@ -66,7 +66,7 @@ namespace BansheeEngine
 		~GUIListBox();
 
 	private:
-		GUIListBox(const String& styleName, const Vector<HString>& elements, const GUILayoutOptions& layoutOptions);
+		GUIListBox(const String& styleName, const Vector<HString>& elements, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @copydoc	GUIButtonBase::mouseEvent

+ 11 - 3
BansheeEngine/Include/BsGUIOptions.h

@@ -18,12 +18,20 @@ namespace BansheeEngine
 			FixedWidth,
 			FlexibleWidth,
 			FixedHeight,
-			FlexibleHeight
+			FlexibleHeight,
+			Position
 		};
 
 	public:
 		GUIOption();
 
+		/**
+		 * @brief	Constructs a GUI option notifying the GUI layout that this element should be positioned
+		 *			at this offset from the parent GUI panel. This option is ignored if element is part of a 
+		 layout since it controls its placement.
+		 */
+		static GUIOption position(INT32 x, INT32 y);
+
 		/**
 		 * @brief	Constructs a GUI option notifying the GUI layout that this element has a fixed width.
 		 *			This will override width property set in element style.
@@ -51,7 +59,7 @@ namespace BansheeEngine
 		static GUIOption flexibleHeight(UINT32 min = 0, UINT32 max = 0);
 
 	private:
-		friend struct GUILayoutOptions;
+		friend struct GUIDimensions;
 
 		UINT32 min, max;
 		Type type;
@@ -111,7 +119,7 @@ namespace BansheeEngine
 		}
 
 	private:
-		friend struct GUILayoutOptions;
+		friend struct GUIDimensions;
 
 		Vector<GUIOption> mOptions;
 	};

+ 1 - 1
BansheeEngine/Include/BsGUIProgressBar.h

@@ -72,7 +72,7 @@ namespace BansheeEngine
 
 		Event<void(float percent)> onChanged;
 	protected:
-		GUIProgressBar(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIProgressBar(const String& styleName, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @copydoc	GUIElementContainer::_getOptimalSize

+ 1 - 1
BansheeEngine/Include/BsGUIRenderTexture.h

@@ -47,7 +47,7 @@ namespace BansheeEngine
 		void setRenderTexture(const RenderTexturePtr& texture);
 
 	protected:
-		GUIRenderTexture(const String& styleName, const RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions);
+		GUIRenderTexture(const String& styleName, const RenderTexturePtr& texture, const GUIDimensions& layoutOptions);
 		virtual ~GUIRenderTexture();
 
 		/**

+ 1 - 1
BansheeEngine/Include/BsGUIScrollArea.h

@@ -129,7 +129,7 @@ namespace BansheeEngine
 		virtual void updateClippedBounds();
 	private:
 		GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, 
-			const String& scrollBarStyle, const String& scrollAreaStyle, const GUILayoutOptions& layoutOptions);
+			const String& scrollBarStyle, const String& scrollAreaStyle, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @copydoc	GUIElementContainer::mouseEvent

+ 1 - 1
BansheeEngine/Include/BsGUIScrollBar.h

@@ -71,7 +71,7 @@ namespace BansheeEngine
 		 * @param	layoutOptions	Options that allows you to control how is the element positioned in
 		 *							GUI layout. This will override any similar options set by style.
 		 */
-		GUIScrollBar(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIScrollBar(bool horizontal, const String& styleName, const GUIDimensions& layoutOptions);
 		virtual ~GUIScrollBar();
 
 		/**

+ 1 - 1
BansheeEngine/Include/BsGUIScrollBarHorz.h

@@ -37,7 +37,7 @@ namespace BansheeEngine
 		 */
 		static GUIScrollBarHorz* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 	protected:
-		GUIScrollBarHorz(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIScrollBarHorz(const String& styleName, const GUIDimensions& layoutOptions);
 		~GUIScrollBarHorz();
 	};
 }

+ 1 - 1
BansheeEngine/Include/BsGUIScrollBarVert.h

@@ -37,7 +37,7 @@ namespace BansheeEngine
 		 */
 		static GUIScrollBarVert* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 	protected:
-		GUIScrollBarVert(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUIScrollBarVert(const String& styleName, const GUIDimensions& layoutOptions);
 		~GUIScrollBarVert();
 	};
 }

+ 3 - 3
BansheeEngine/Include/BsGUISlider.h

@@ -46,7 +46,7 @@ namespace BansheeEngine
 
 		Event<void(float percent)> onChanged;
 	protected:
-		GUISlider(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUISlider(bool horizontal, const String& styleName, const GUIDimensions& layoutOptions);
 		virtual ~GUISlider();
 
 		/**
@@ -104,7 +104,7 @@ namespace BansheeEngine
 		static GUISliderHorz* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 
 	private:
-		GUISliderHorz(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUISliderHorz(const String& styleName, const GUIDimensions& layoutOptions);
 	};
 
 	/**
@@ -139,6 +139,6 @@ namespace BansheeEngine
 		static GUISliderVert* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 
 	private:
-		GUISliderVert(const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUISliderVert(const String& styleName, const GUIDimensions& layoutOptions);
 	};
 }

+ 1 - 1
BansheeEngine/Include/BsGUISliderHandle.h

@@ -128,7 +128,7 @@ namespace BansheeEngine
 		 */
 		virtual void updateClippedBounds();
 	private:
-		GUISliderHandle(bool horizontal, bool jumpOnClick, const String& styleName, const GUILayoutOptions& layoutOptions);
+		GUISliderHandle(bool horizontal, bool jumpOnClick, const String& styleName, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @brief	Returns the position of the slider handle, in pixels.

+ 1 - 1
BansheeEngine/Include/BsGUITexture.h

@@ -171,7 +171,7 @@ namespace BansheeEngine
 		virtual Vector2I _getOptimalSize() const;
 	protected:
 		GUITexture(const String& styleName, const HSpriteTexture& texture, GUIImageScaleMode scale, 
-			bool transparent, const GUILayoutOptions& layoutOptions);
+			bool transparent, const GUIDimensions& layoutOptions);
 		virtual ~GUITexture();
 
 		/**

+ 1 - 1
BansheeEngine/Include/BsGUIToggle.h

@@ -134,7 +134,7 @@ namespace BansheeEngine
 
 	protected:
 		GUIToggle(const String& styleName, const GUIContent& content, 
-			std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions);
+			std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @copydoc	GUIButtonBase::mouseEvent

+ 1 - 1
BansheeEngine/Include/BsGUIViewport.h

@@ -90,7 +90,7 @@ namespace BansheeEngine
 		virtual void updateRenderElementsInternal();
 
 	private:
-		GUIViewport(const String& styleName, const HCamera& camera, float aspectRatio, Degree fieldOfView, const GUILayoutOptions& layoutOptions);
+		GUIViewport(const String& styleName, const HCamera& camera, float aspectRatio, Degree fieldOfView, const GUIDimensions& layoutOptions);
 
 		/**
 		 * @copydoc	GUIElement::_changeParentWidget

+ 1 - 1
BansheeEngine/Include/BsPrerequisites.h

@@ -64,7 +64,7 @@ namespace BansheeEngine
 	class GUIFlexibleSpace;
 	class GUIInputCaret;
 	class GUIInputSelection;
-	struct GUILayoutOptions;
+	struct GUIDimensions;
 	class GUIOptions;
 	class GUIToggleGroup;
 	class GUIListBox;

+ 0 - 4
BansheeEngine/Source/BsGUIArea.cpp

@@ -152,10 +152,6 @@ namespace BansheeEngine
 				clipRect = newClipRect;
 			}
 
-			mLayout->setOffset(Vector2I(mLeft, mTop));
-			mLayout->setWidth(mWidth);
-			mLayout->setHeight(mHeight);
-
 			mLayout->_updateLayout(mLeft, mTop, mWidth, mHeight, clipRect, mWidget->getDepth(), mDepth);
 			mIsDirty = false;
 		}

+ 4 - 4
BansheeEngine/Source/BsGUIButton.cpp

@@ -4,7 +4,7 @@
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
 #include "BsTextSprite.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUIHelper.h"
 #include "BsTexture.h"
@@ -17,7 +17,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIButton::GUIButton(const String& styleName, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+	GUIButton::GUIButton(const String& styleName, const GUIContent& content, const GUIDimensions& layoutOptions)
 		:GUIButtonBase(styleName, content, layoutOptions)
 	{ }
 
@@ -33,11 +33,11 @@ namespace BansheeEngine
 
 	GUIButton* GUIButton::create(const GUIContent& content, const String& styleName)
 	{
-		return new (bs_alloc<GUIButton, PoolAlloc>()) GUIButton(getStyleName<GUIButton>(styleName), content, GUILayoutOptions::create());
+		return new (bs_alloc<GUIButton, PoolAlloc>()) GUIButton(getStyleName<GUIButton>(styleName), content, GUIDimensions::create());
 	}
 
 	GUIButton* GUIButton::create(const GUIContent& content, const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIButton, PoolAlloc>()) GUIButton(getStyleName<GUIButton>(styleName), content, GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIButton, PoolAlloc>()) GUIButton(getStyleName<GUIButton>(styleName), content, GUIDimensions::create(layoutOptions));
 	}
 }

+ 3 - 3
BansheeEngine/Source/BsGUIButtonBase.cpp

@@ -4,14 +4,14 @@
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
 #include "BsTextSprite.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUIHelper.h"
 #include "BsTexture.h"
 
 namespace BansheeEngine
 {
-	GUIButtonBase::GUIButtonBase(const String& styleName, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+	GUIButtonBase::GUIButtonBase(const String& styleName, const GUIContent& content, const GUIDimensions& layoutOptions)
 		:GUIElement(styleName, layoutOptions), mContent(content), mContentImageSprite(nullptr), mActiveState(GUIButtonState::Normal)
 	{
 		mImageSprite = bs_new<ImageSprite, PoolAlloc>();
@@ -157,7 +157,7 @@ namespace BansheeEngine
 			imageHeight = activeTex->getHeight();
 		}
 
-		Vector2I contentSize = GUIHelper::calcOptimalContentsSize(mContent, *_getStyle(), _getLayoutOptions());
+		Vector2I contentSize = GUIHelper::calcOptimalContentsSize(mContent, *_getStyle(), _getDimensions());
 		UINT32 contentWidth = std::max(imageWidth, (UINT32)contentSize.x);
 		UINT32 contentHeight = std::max(imageHeight, (UINT32)contentSize.y);
 

+ 142 - 0
BansheeEngine/Source/BsGUIDimensions.cpp

@@ -0,0 +1,142 @@
+#include "BsGUIDimensions.h"
+#include "BsGUIElementStyle.h"
+#include "BsGUIOptions.h"
+
+namespace BansheeEngine
+{
+	GUIDimensions GUIDimensions::create()
+	{
+		return GUIDimensions();
+	}
+
+	GUIDimensions GUIDimensions::create(const GUIOptions& options)
+	{
+		GUIDimensions dimensions;
+
+		for(auto& option : options.mOptions)
+		{
+			switch(option.type)
+			{
+			case GUIOption::Type::Position:
+				dimensions.x = (INT32)option.min;
+				dimensions.y = (INT32)option.max;
+				break;
+			case GUIOption::Type::FixedWidth:
+				dimensions.flags |= GUIDF_FixedWidth | GUIDF_OverWidth;
+				dimensions.minWidth = dimensions.maxWidth = option.min;
+				break;
+			case GUIOption::Type::FixedHeight:
+				dimensions.flags |= GUIDF_FixedHeight | GUIDF_OverHeight;
+				dimensions.minHeight = dimensions.maxHeight = option.min;
+				break;
+			case GUIOption::Type::FlexibleWidth:
+				dimensions.flags |= GUIDF_OverWidth;
+				dimensions.flags &= ~GUIDF_FixedWidth;
+				dimensions.minWidth = option.min;
+				dimensions.maxWidth = option.max;
+				break;
+			case GUIOption::Type::FlexibleHeight:
+				dimensions.flags |= GUIDF_OverHeight;
+				dimensions.flags &= ~GUIDF_FixedHeight;
+				dimensions.minHeight = option.min;
+				dimensions.maxHeight = option.max;
+				break;
+			}
+		}
+
+		return dimensions;
+	}
+
+	void GUIDimensions::updateWithStyle(const GUIElementStyle* style)
+	{
+		if(!overridenWidth())
+		{
+			if (style->fixedWidth)
+			{
+				flags |= GUIDF_FixedWidth;
+				minWidth = maxWidth = style->width;
+			}
+			else
+			{
+				flags &= ~GUIDF_FixedWidth;
+				minWidth = style->minWidth;
+				maxWidth = style->maxWidth;
+			}
+		}
+
+		if(!overridenHeight())
+		{
+			if (style->fixedHeight)
+			{
+				flags |= GUIDF_FixedHeight;
+				minHeight = maxHeight = style->height;
+			}
+			else
+			{
+				flags &= ~GUIDF_FixedHeight;
+				minHeight = style->minHeight;
+				maxHeight = style->maxHeight;
+			}
+		}
+	}
+
+	GUIDimensions::GUIDimensions()
+		:x(0), y(0), minWidth(0), maxWidth(0),
+		 minHeight(0), maxHeight(0), flags(0)
+	{
+
+	}
+
+	LayoutSizeRange GUIDimensions::calculateSizeRange(const Vector2I& optimal) const
+	{
+		LayoutSizeRange sizeRange;
+
+		if (fixedHeight())
+		{
+			sizeRange.optimal.y = minHeight;
+			sizeRange.min.y = minHeight;
+			sizeRange.max.y = minHeight;
+		}
+		else
+		{
+			sizeRange.optimal.y = optimal.y;
+
+			if (minHeight > 0)
+			{
+				sizeRange.optimal.y = std::max((INT32)minHeight, sizeRange.optimal.y);
+				sizeRange.min.y = minHeight;
+			}
+
+			if (maxHeight > 0)
+			{
+				sizeRange.optimal.y = std::min((INT32)maxHeight, sizeRange.optimal.y);
+				sizeRange.max.y = maxHeight;
+			}
+		}
+
+		if (fixedWidth())
+		{
+			sizeRange.optimal.x = minWidth;
+			sizeRange.min.x = minWidth;
+			sizeRange.max.x = minWidth;
+		}
+		else
+		{
+			sizeRange.optimal.x = optimal.x;
+
+			if (minWidth > 0)
+			{
+				sizeRange.optimal.x = std::max((INT32)minWidth, sizeRange.optimal.x);
+				sizeRange.min.x = minWidth;
+			}
+
+			if (maxWidth > 0)
+			{
+				sizeRange.optimal.x = std::min((INT32)maxWidth, sizeRange.optimal.x);
+				sizeRange.max.x = maxWidth;
+			}
+		}
+
+		return sizeRange;
+	}
+}

+ 9 - 9
BansheeEngine/Source/BsGUIDropDownContent.cpp

@@ -20,7 +20,7 @@ namespace BansheeEngine
 	const String GUIDropDownContent::SEPARATOR_STYLE_TYPE = "DropDownSeparator";
 
 	GUIDropDownContent::GUIDropDownContent(GUIDropDownBox::DropDownSubMenu* parent, const GUIDropDownData& dropDownData, 
-		const String& style, const GUILayoutOptions& layoutOptions)
+		const String& style, const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions, style), mDropDownData(dropDownData), 
 		mSelectedIdx(UINT_MAX), mRangeStart(0), mRangeEnd(0), mParent(parent)
 	{
@@ -39,7 +39,7 @@ namespace BansheeEngine
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &GUIDropDownContent::getGUITypeName();
 
-		return new (bs_alloc<GUIDropDownContent>()) GUIDropDownContent(parent, dropDownData, *curStyle, GUILayoutOptions::create());
+		return new (bs_alloc<GUIDropDownContent>()) GUIDropDownContent(parent, dropDownData, *curStyle, GUIDimensions::create());
 	}
 
 	GUIDropDownContent* GUIDropDownContent::create(GUIDropDownBox::DropDownSubMenu* parent, 
@@ -50,7 +50,7 @@ namespace BansheeEngine
 		if (*curStyle == StringUtil::BLANK)
 			curStyle = &GUIDropDownContent::getGUITypeName();
 
-		return new (bs_alloc<GUIDropDownContent>()) GUIDropDownContent(parent, dropDownData, *curStyle, GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIDropDownContent>()) GUIDropDownContent(parent, dropDownData, *curStyle, GUIDimensions::create(layoutOptions));
 	}
 
 	void GUIDropDownContent::styleUpdated()
@@ -352,9 +352,9 @@ namespace BansheeEngine
 			Vector2I offset(x, yOffset);
 			yOffset += elemHeight;
 
-			guiMainElement->setOffset(offset);
-			guiMainElement->setWidth(width);
-			guiMainElement->setHeight(elemHeight);
+			guiMainElement->_setPosition(offset);
+			guiMainElement->_setWidth(width);
+			guiMainElement->_setHeight(elemHeight);
 			guiMainElement->_setAreaDepth(areaDepth);
 			guiMainElement->_setWidgetDepth(widgetDepth);
 
@@ -365,9 +365,9 @@ namespace BansheeEngine
 			GUILabel* shortcutLabel = visElem.shortcutLabel;
 			if (shortcutLabel != nullptr)
 			{
-				shortcutLabel->setOffset(offset);
-				shortcutLabel->setWidth(width);
-				shortcutLabel->setHeight(elemHeight);
+				shortcutLabel->_setPosition(offset);
+				shortcutLabel->_setWidth(width);
+				shortcutLabel->_setHeight(elemHeight);
 				shortcutLabel->_setAreaDepth(areaDepth);
 				shortcutLabel->_setWidgetDepth(widgetDepth);
 				shortcutLabel->_setClipRect(elemClipRect);

+ 3 - 3
BansheeEngine/Source/BsGUIDropDownHitBox.cpp

@@ -14,15 +14,15 @@ namespace BansheeEngine
 
 	GUIDropDownHitBox* GUIDropDownHitBox::create(bool captureMouse)
 	{
-		return new (bs_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(captureMouse, GUILayoutOptions::create());
+		return new (bs_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(captureMouse, GUIDimensions::create());
 	}
 
 	GUIDropDownHitBox* GUIDropDownHitBox::create(bool captureMouse, const GUIOptions& layoutOptions)
 	{
-		return new (bs_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(captureMouse, GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(captureMouse, GUIDimensions::create(layoutOptions));
 	}
 
-	GUIDropDownHitBox::GUIDropDownHitBox(bool captureMouse, const GUILayoutOptions& layoutOptions)
+	GUIDropDownHitBox::GUIDropDownHitBox(bool captureMouse, const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions), mCaptureMouse(captureMouse)
 	{
 

+ 10 - 42
BansheeEngine/Source/BsGUIElement.cpp

@@ -8,9 +8,9 @@
 
 namespace BansheeEngine
 {
-	GUIElement::GUIElement(const String& styleName, const GUILayoutOptions& layoutOptions)
-		:mLayoutOptions(layoutOptions), mDepth(0), mStyle(&GUISkin::DefaultStyle),
-		mIsDestroyed(false), mStyleName(styleName)
+	GUIElement::GUIElement(const String& styleName, const GUIDimensions& dimensions)
+		:GUIElementBase(dimensions), mDepth(0), mStyle(&GUISkin::DefaultStyle),
+		mIsDestroyed(false), mStyleName(styleName), mWidth(0), mHeight(0)
 	{
 		// Style is set to default here, and the proper one is assigned once GUI element
 		// is assigned to a parent (that's when the active GUI skin becomes known)
@@ -30,7 +30,7 @@ namespace BansheeEngine
 		updateClippedBounds();
 	}
 
-	void GUIElement::setOffset(const Vector2I& offset)
+	void GUIElement::_setPosition(const Vector2I& offset)
 	{
 		if (mOffset != offset)
 		{
@@ -41,7 +41,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void GUIElement::setWidth(UINT32 width)
+	void GUIElement::_setWidth(UINT32 width)
 	{
 		if (mWidth != width)
 			markContentAsDirty();
@@ -49,7 +49,7 @@ namespace BansheeEngine
 		mWidth = width;
 	}
 
-	void GUIElement::setHeight(UINT32 height)
+	void GUIElement::_setHeight(UINT32 height)
 	{
 		if (mHeight != height)
 			markContentAsDirty();
@@ -57,23 +57,6 @@ namespace BansheeEngine
 		mHeight = height;
 	}
 
-	void GUIElement::setLayoutOptions(const GUILayoutOptions& layoutOptions) 
-	{
-		if(layoutOptions.maxWidth < layoutOptions.minWidth)
-		{
-			BS_EXCEPT(InvalidParametersException, "Maximum width is less than minimum width! Max width: " + 
-			toString(layoutOptions.maxWidth) + ". Min width: " + toString(layoutOptions.minWidth));
-		}
-
-		if(layoutOptions.maxHeight < layoutOptions.minHeight)
-		{
-			BS_EXCEPT(InvalidParametersException, "Maximum height is less than minimum height! Max height: " + 
-			toString(layoutOptions.maxHeight) + ". Min height: " + toString(layoutOptions.minHeight));
-		}
-
-		mLayoutOptions = layoutOptions; 
-	}
-
 	void GUIElement::setStyle(const String& styleName)
 	{
 		mStyleName = styleName;
@@ -161,15 +144,6 @@ namespace BansheeEngine
 		}
 	}
 
-	LayoutSizeRange GUIElement::_calculateLayoutSizeRange() const
-	{
-		if (mIsDisabled)
-			return LayoutSizeRange();
-
-		const GUILayoutOptions& layoutOptions = _getLayoutOptions();
-		return layoutOptions.calculateSizeRange(_getOptimalSize());
-	}
-
 	Rect2I GUIElement::_getCachedBounds() const
 	{
 		return Rect2I(mOffset.x, mOffset.y, mWidth, mHeight);
@@ -180,10 +154,10 @@ namespace BansheeEngine
 		GUIManager::instance().setFocus(this, enabled);
 	}
 
-	void GUIElement::setLayoutOptions(const GUIOptions& layoutOptions)
+	void GUIElement::resetDimensions()
 	{
-		mLayoutOptions = GUILayoutOptions::create(layoutOptions);
-		mLayoutOptions.updateWithStyle(mStyle);
+		mDimensions = GUIDimensions::create();
+		mDimensions.updateWithStyle(mStyle);
 
 		markContentAsDirty();
 	}
@@ -248,15 +222,9 @@ namespace BansheeEngine
 		if(newStyle != mStyle)
 		{
 			mStyle = newStyle;
-			mLayoutOptions.updateWithStyle(mStyle);
+			mDimensions.updateWithStyle(mStyle);
 			styleUpdated();
 
-			// Immediately update size, in case element is part of an explicit layout
-			// (In which case it would never get updated unless user set it explicitly)
-			LayoutSizeRange sizeRange = _calculateLayoutSizeRange();
-			mWidth = (UINT32)sizeRange.optimal.x;
-			mHeight = (UINT32)sizeRange.optimal.y;
-
 			markContentAsDirty();
 		}
 	}

+ 60 - 9
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -13,7 +13,14 @@ namespace BansheeEngine
 {
 	GUIElementBase::GUIElementBase()
 		:mIsDirty(true), mParentElement(nullptr), mIsDisabled(false), 
-		mParentWidget(nullptr), mWidth(0), mHeight(0)
+		mParentWidget(nullptr)
+	{
+
+	}
+
+	GUIElementBase::GUIElementBase(const GUIDimensions& dimensions)
+		:mIsDirty(true), mParentElement(nullptr), mIsDisabled(false),
+		mParentWidget(nullptr), mDimensions(dimensions)
 	{
 
 	}
@@ -46,25 +53,60 @@ namespace BansheeEngine
 		}
 	}
 
-	void GUIElementBase::setOffset(const Vector2I& offset)
+	void GUIElementBase::setPosition(INT32 x, INT32 y)
 	{
-		mOffset = offset;
+		mDimensions.x = x;
+		mDimensions.y = y;
+
+		markMeshAsDirty();
 	}
 
 	void GUIElementBase::setWidth(UINT32 width)
 	{
-		if (mWidth != width)
-			markContentAsDirty();
+		mDimensions.flags |= GUIDF_FixedWidth | GUIDF_OverWidth;
+		mDimensions.minWidth = mDimensions.maxWidth = width;
+
+		markContentAsDirty();
+	}
+
+	void GUIElementBase::setFlexibleWidth(UINT32 minWidth, UINT32 maxWidth)
+	{
+		if (maxWidth < minWidth)
+			std::swap(minWidth, maxWidth);
+
+		mDimensions.flags |= GUIDF_OverWidth;
+		mDimensions.flags &= ~GUIDF_FixedWidth;
+		mDimensions.minWidth = minWidth;
+		mDimensions.maxWidth = maxWidth;
 
-		mWidth = width;
+		markContentAsDirty();
 	}
 
 	void GUIElementBase::setHeight(UINT32 height)
 	{
-		if (mHeight != height)
-			markContentAsDirty();
+		mDimensions.flags |= GUIDF_FixedHeight | GUIDF_OverHeight;
+		mDimensions.minHeight = mDimensions.maxHeight = height;
+
+		markContentAsDirty();
+	}
+
+	void GUIElementBase::setFlexibleHeight(UINT32 minHeight, UINT32 maxHeight)
+	{
+		if (maxHeight < minHeight)
+			std::swap(minHeight, maxHeight);
+
+		mDimensions.flags |= GUIDF_OverHeight;
+		mDimensions.flags &= ~GUIDF_FixedHeight;
+		mDimensions.minHeight = minHeight;
+		mDimensions.maxHeight = maxHeight;
+
+		markContentAsDirty();
+	}
 
-		mHeight = height;
+	void GUIElementBase::resetDimensions()
+	{
+		mDimensions = GUIDimensions::create();
+		markContentAsDirty();
 	}
 
 	Rect2I GUIElementBase::getBounds() const
@@ -160,6 +202,15 @@ namespace BansheeEngine
 		}
 	}
 
+	LayoutSizeRange GUIElementBase::_calculateLayoutSizeRange() const
+	{
+		if (mIsDisabled)
+			return LayoutSizeRange();
+
+		const GUIDimensions& layoutOptions = _getDimensions();
+		return layoutOptions.calculateSizeRange(_getOptimalSize());
+	}
+
 	void GUIElementBase::_getElementAreas(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect2I* elementAreas, UINT32 numElements,
 		const Vector<LayoutSizeRange>& sizeRanges, const LayoutSizeRange& mySizeRange) const
 	{

+ 3 - 3
BansheeEngine/Source/BsGUIElementContainer.cpp

@@ -3,19 +3,19 @@
 
 namespace BansheeEngine
 {
-	GUIElementContainer::GUIElementContainer(const GUILayoutOptions& layoutOptions, const String& style)
+	GUIElementContainer::GUIElementContainer(const GUIDimensions& layoutOptions, const String& style)
 		:GUIElement(style, layoutOptions)
 	{ }
 
 	GUIElementContainer::~GUIElementContainer()
 	{ }
 
-	void GUIElementContainer::setOffset(const Vector2I& offset)
+	void GUIElementContainer::_setPosition(const Vector2I& offset)
 	{
 		if (mOffset != offset)
 			markContentAsDirty();
 
-		GUIElement::setOffset(offset);
+		GUIElement::_setPosition(offset);
 	}
 
 	UINT32 GUIElementContainer::_getNumRenderElements() const

+ 5 - 10
BansheeEngine/Source/BsGUIHelper.cpp

@@ -1,12 +1,12 @@
 #include "BsGUIHelper.h"
 #include "BsSpriteTexture.h"
 #include "BsGUIElementStyle.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsTexture.h"
 
 namespace BansheeEngine
 {
-	Vector2I GUIHelper::calcOptimalContentsSize(const Vector2I& contentSize, const GUIElementStyle& style, const GUILayoutOptions& layoutOptions)
+	Vector2I GUIHelper::calcOptimalContentsSize(const Vector2I& contentSize, const GUIElementStyle& style, const GUIDimensions& layoutOptions)
 	{
 		UINT32 contentWidth = style.margins.left + style.margins.right + style.contentOffset.left + style.contentOffset.right;
 		UINT32 contentHeight = style.margins.top + style.margins.bottom + style.contentOffset.top + style.contentOffset.bottom;
@@ -14,7 +14,7 @@ namespace BansheeEngine
 		return Vector2I(std::max((UINT32)contentSize.x, contentWidth), std::max((UINT32)contentSize.y, contentHeight));
 	}
 
-	Vector2I GUIHelper::calcOptimalContentsSize(const GUIContent& content, const GUIElementStyle& style, const GUILayoutOptions& layoutOptions)
+	Vector2I GUIHelper::calcOptimalContentsSize(const GUIContent& content, const GUIElementStyle& style, const GUIDimensions& layoutOptions)
 	{
 		Vector2I textContentBounds = calcOptimalContentsSize(content.getText(), style, layoutOptions);
 
@@ -29,17 +29,12 @@ namespace BansheeEngine
 		return Vector2I(std::max((UINT32)textContentBounds.x, contentWidth), std::max((UINT32)textContentBounds.y, contentHeight));
 	}
 
-	Vector2I GUIHelper::calcOptimalContentsSize(const WString& text, const GUIElementStyle& style, const GUILayoutOptions& layoutOptions)
+	Vector2I GUIHelper::calcOptimalContentsSize(const WString& text, const GUIElementStyle& style, const GUIDimensions& layoutOptions)
 	{
 		UINT32 wordWrapWidth = 0;
 
 		if(style.wordWrap)
-		{
-			if(layoutOptions.fixedWidth)
-				wordWrapWidth = layoutOptions.width;
-			else
-				wordWrapWidth = layoutOptions.maxWidth;
-		}
+			wordWrapWidth = layoutOptions.maxWidth;
 
 		UINT32 contentWidth = style.margins.left + style.margins.right + style.contentOffset.left + style.contentOffset.right;
 		UINT32 contentHeight = style.margins.top + style.margins.bottom + style.contentOffset.top + style.contentOffset.bottom;

+ 6 - 6
BansheeEngine/Source/BsGUIInputBox.cpp

@@ -5,7 +5,7 @@
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
 #include "BsTextSprite.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUITextInputEvent.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUICommandEvent.h"
@@ -32,7 +32,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIInputBox::GUIInputBox(const String& styleName, const GUILayoutOptions& layoutOptions, bool multiline)
+	GUIInputBox::GUIInputBox(const String& styleName, const GUIDimensions& layoutOptions, bool multiline)
 		:GUIElement(styleName, layoutOptions), mDragInProgress(false),
 		mCaretShown(false), mSelectionShown(false), mIsMultiline(multiline), mHasFocus(false), mIsMouseOver(false),
 		mState(State::Normal)
@@ -49,17 +49,17 @@ namespace BansheeEngine
 
 	GUIInputBox* GUIInputBox::create(bool multiline, const String& styleName)
 	{
-		return new (bs_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(getStyleName<GUIInputBox>(styleName), GUILayoutOptions::create(), multiline);
+		return new (bs_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(getStyleName<GUIInputBox>(styleName), GUIDimensions::create(), multiline);
 	}
 
 	GUIInputBox* GUIInputBox::create(bool multiline, const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(getStyleName<GUIInputBox>(styleName), GUILayoutOptions::create(layoutOptions), multiline);
+		return new (bs_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(getStyleName<GUIInputBox>(styleName), GUIDimensions::create(layoutOptions), multiline);
 	}
 
 	GUIInputBox* GUIInputBox::create(const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(getStyleName<GUIInputBox>(styleName), GUILayoutOptions::create(layoutOptions), false);
+		return new (bs_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(getStyleName<GUIInputBox>(styleName), GUIDimensions::create(layoutOptions), false);
 	}
 
 	void GUIInputBox::setText(const WString& text)
@@ -327,7 +327,7 @@ namespace BansheeEngine
 			imageHeight = activeTex->getHeight();
 		}
 
-		Vector2I contentSize = GUIHelper::calcOptimalContentsSize(mText, *_getStyle(), _getLayoutOptions());
+		Vector2I contentSize = GUIHelper::calcOptimalContentsSize(mText, *_getStyle(), _getDimensions());
 		UINT32 contentWidth = std::max(imageWidth, (UINT32)contentSize.x);
 		UINT32 contentHeight = std::max(imageHeight, (UINT32)contentSize.y);
 

+ 5 - 5
BansheeEngine/Source/BsGUILabel.cpp

@@ -3,13 +3,13 @@
 #include "BsTextSprite.h"
 #include "BsGUISkin.h"
 #include "BsGUIWidget.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIHelper.h"
 #include "BsTextData.h"
 
 namespace BansheeEngine
 {
-	GUILabel::GUILabel(const String& styleName, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+	GUILabel::GUILabel(const String& styleName, const GUIContent& content, const GUIDimensions& layoutOptions)
 		:GUIElement(styleName, layoutOptions), mContent(content)
 	{
 		mTextSprite = bs_new<TextSprite, PoolAlloc>();
@@ -62,7 +62,7 @@ namespace BansheeEngine
 
 	Vector2I GUILabel::_getOptimalSize() const
 	{
-		return GUIHelper::calcOptimalContentsSize(mContent, *_getStyle(), _getLayoutOptions());
+		return GUIHelper::calcOptimalContentsSize(mContent, *_getStyle(), _getDimensions());
 	}
 
 	void GUILabel::_fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, 
@@ -100,12 +100,12 @@ namespace BansheeEngine
 
 	GUILabel* GUILabel::create(const GUIContent& content, const String& styleName)
 	{
-		return new (bs_alloc<GUILabel, PoolAlloc>()) GUILabel(getStyleName<GUILabel>(styleName), content, GUILayoutOptions::create());
+		return new (bs_alloc<GUILabel, PoolAlloc>()) GUILabel(getStyleName<GUILabel>(styleName), content, GUIDimensions::create());
 	}
 
 	GUILabel* GUILabel::create(const GUIContent& content, const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUILabel, PoolAlloc>()) GUILabel(getStyleName<GUILabel>(styleName), content, GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUILabel, PoolAlloc>()) GUILabel(getStyleName<GUILabel>(styleName), content, GUIDimensions::create(layoutOptions));
 	}
 
 	const String& GUILabel::getGUITypeName()

+ 120 - 23
BansheeEngine/Source/BsGUILayoutExplicit.cpp

@@ -12,55 +12,123 @@ namespace BansheeEngine
 
 	LayoutSizeRange GUILayoutExplicit::_calculateLayoutSizeRange() const
 	{
-		return LayoutSizeRange();
+		if (mIsDisabled)
+			return LayoutSizeRange();
+
+		Vector2I optimalSize;
+
+		for (auto& child : mChildren)
+		{
+			LayoutSizeRange sizeRange = child->_calculateLayoutSizeRange();
+
+			if (child->_getType() == GUIElementBase::Type::FixedSpace)
+				sizeRange.optimal.x = sizeRange.optimal.y = 0;
+
+			UINT32 paddingX = child->_getPadding().left + child->_getPadding().right;
+			UINT32 paddingY = child->_getPadding().top + child->_getPadding().bottom;
+
+			Vector2I childMax(child->_getDimensions().x, child->_getDimensions().y);
+			childMax.x += sizeRange.optimal.x + paddingX;
+			childMax.y += sizeRange.optimal.y + paddingY;
+
+			optimalSize.x = std::max(optimalSize.x, childMax.x);
+			optimalSize.y = std::max(optimalSize.y, childMax.y);
+		}
+
+		return _getDimensions().calculateSizeRange(optimalSize);
 	}
 
 	void GUILayoutExplicit::_updateOptimalLayoutSizes()
 	{
+		// Update all children first, otherwise we can't determine our own optimal size
+		GUIElementBase::_updateOptimalLayoutSizes();
 
-	}
+		if (mChildren.size() != mChildSizeRanges.size())
+			mChildSizeRanges.resize(mChildren.size());
 
-	void GUILayoutExplicit::_getElementAreas(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect2I* elementAreas, UINT32 numElements,
-		const Vector<LayoutSizeRange>& sizeRanges, const LayoutSizeRange& mySizeRange) const
-	{
-		assert(mChildren.size() == numElements);
+		Vector2I optimalSize;
 
-		// Compute offsets and height
 		UINT32 childIdx = 0;
 		for (auto& child : mChildren)
 		{
-			if (child->_getType() == GUIElementBase::Type::Element)
+			LayoutSizeRange& childSizeRange = mChildSizeRanges[childIdx];
+
+			if (child->_getType() == GUIElementBase::Type::FixedSpace)
 			{
-				GUIElement* element = static_cast<GUIElement*>(child);
+				GUIFixedSpace* fixedSpace = static_cast<GUIFixedSpace*>(child);
 
-				elementAreas[childIdx].x = element->_getOffset().x;
-				elementAreas[childIdx].y = element->_getOffset().y;
-				elementAreas[childIdx].width = element->_getWidth();
-				elementAreas[childIdx].height = element->_getHeight();
+				childSizeRange = fixedSpace->_calculateLayoutSizeRange();
+				childSizeRange.optimal.x = 0;
+				childSizeRange.optimal.y = 0;
+			}
+			else if (child->_getType() == GUIElementBase::Type::Element)
+			{
+				childSizeRange = child->_calculateLayoutSizeRange();
 			}
 			else if (child->_getType() == GUIElementBase::Type::Layout)
 			{
 				GUILayout* layout = static_cast<GUILayout*>(child);
-
-				elementAreas[childIdx].height = height;
-				elementAreas[childIdx].width = width;
-				elementAreas[childIdx].x = x;
-				elementAreas[childIdx].y = y;
+				childSizeRange = layout->_getCachedSizeRange();
 			}
 
+			UINT32 paddingX = child->_getPadding().left + child->_getPadding().right;
+			UINT32 paddingY = child->_getPadding().top + child->_getPadding().bottom;
+
+			Vector2I childMax(child->_getDimensions().x, child->_getDimensions().y);
+			childMax.x += childSizeRange.optimal.x + paddingX;
+			childMax.y += childSizeRange.optimal.y + paddingY;
+
+			optimalSize.x = std::max(optimalSize.x, childMax.x);
+			optimalSize.y = std::max(optimalSize.y, childMax.y);
+
+			childIdx++;
+		}
+
+		mSizeRange = _getDimensions().calculateSizeRange(optimalSize);
+	}
+
+	void GUILayoutExplicit::_getElementAreas(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect2I* elementAreas, UINT32 numElements,
+		const Vector<LayoutSizeRange>& sizeRanges, const LayoutSizeRange& mySizeRange) const
+	{
+		assert(mChildren.size() == numElements);
+
+		// Panel always uses optimal sizes and explicit positions
+		UINT32 childIdx = 0;
+		for (auto& child : mChildren)
+		{
+			elementAreas[childIdx].x = x + child->_getDimensions().x;
+			elementAreas[childIdx].y = y + child->_getDimensions().y;
+			elementAreas[childIdx].width = (UINT32)sizeRanges[childIdx].optimal.x;
+			elementAreas[childIdx].height = (UINT32)sizeRanges[childIdx].optimal.y;
+
 			childIdx++;
 		}
 	}
 
 	void GUILayoutExplicit::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect2I clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 	{
+		UINT32 numElements = (UINT32)mChildren.size();
+		Rect2I* elementAreas = nullptr;
+
+		if (numElements > 0)
+			elementAreas = stackConstructN<Rect2I>(numElements);
+
+		_getElementAreas(x, y, width, height, elementAreas, numElements, mChildSizeRanges, mSizeRange);
+
 		UINT32 childIdx = 0;
+		Rect2I* actualSizes = elementAreas; // We re-use the same array
 
 		for (auto& child : mChildren)
 		{
+			Rect2I childArea = elementAreas[childIdx];
+
+			Vector2I offset(childArea.x, childArea.y);
 			if (child->_getType() == GUIElementBase::Type::Element)
 			{
 				GUIElement* element = static_cast<GUIElement*>(child);
+				element->_setPosition(offset);
+				element->_setWidth(childArea.width);
+				element->_setHeight(childArea.height);
 				element->_setWidgetDepth(widgetDepth);
 				element->_setAreaDepth(areaDepth);
 
@@ -71,26 +139,55 @@ namespace BansheeEngine
 				Rect2I newClipRect(offset.x, offset.y, element->_getWidth(), element->_getHeight());
 				newClipRect.clip(clipRect);
 				element->_updateLayoutInternal(offset.x, offset.y, element->_getWidth(), element->_getHeight(), newClipRect, widgetDepth, areaDepth);
+
+				actualSizes[childIdx].width = childArea.width + child->_getPadding().top + child->_getPadding().bottom;
+				actualSizes[childIdx].height = childArea.height + child->_getPadding().top + child->_getPadding().bottom;
 			}
 			else if (child->_getType() == GUIElementBase::Type::Layout)
 			{
 				GUILayout* layout = static_cast<GUILayout*>(child);
 
-				layout->_updateLayoutInternal(x, y, width, height, clipRect, widgetDepth, areaDepth);
+				Rect2I newClipRect(childArea.x, childArea.y, childArea.width, childArea.height);
+				newClipRect.clip(clipRect);
+				layout->_updateLayoutInternal(offset.x, offset.y, childArea.width, childArea.height, clipRect, widgetDepth, areaDepth);
+
+				actualSizes[childIdx].width = layout->_getActualWidth();
+				actualSizes[childIdx].height = layout->_getActualHeight();
+			}
+			else
+			{
+				actualSizes[childIdx].width = childArea.width;
+				actualSizes[childIdx].height = childArea.height;
 			}
 
 			childIdx++;
 		}
 
-		mActualWidth = 0; // Not relevant
-		mActualHeight = 0;
+		Vector2I actualSize = _calcActualSize(x, y, actualSizes, numElements);
+		mActualWidth = (UINT32)actualSize.x;
+		mActualHeight = (UINT32)actualSize.y;
+
+		if (elementAreas != nullptr)
+			stackDeallocLast(elementAreas);
 
 		_markAsClean();
 	}
 
-	Vector2I GUILayoutExplicit::_calcActualSize(Rect2I* elementAreas, UINT32 numElements) const
+	Vector2I GUILayoutExplicit::_calcActualSize(INT32 x, INT32 y, Rect2I* elementAreas, UINT32 numElements) const
 	{
-		return Vector2I(0, 0); // Not relevant
+		Vector2I actualArea;
+		for (UINT32 i = 0; i < numElements; i++)
+		{
+			Rect2I childArea = elementAreas[i];
+
+			INT32 diffX = (childArea.x - childArea.width) - x;
+			INT32 diffY = (childArea.y - childArea.height) - y;
+
+			actualArea.x = std::max(actualArea.x, diffX);
+			actualArea.y = std::max(actualArea.y, diffY);
+		}
+
+		return actualArea;
 	}
 
 	GUILayoutExplicit* GUILayoutExplicit::create()

+ 0 - 127
BansheeEngine/Source/BsGUILayoutOptions.cpp

@@ -1,127 +0,0 @@
-#include "BsGUILayoutOptions.h"
-#include "BsGUIElementStyle.h"
-#include "BsGUIOptions.h"
-
-namespace BansheeEngine
-{
-	GUILayoutOptions GUILayoutOptions::create()
-	{
-		return GUILayoutOptions();
-	}
-
-	GUILayoutOptions GUILayoutOptions::create(const GUIOptions& options)
-	{
-		GUILayoutOptions layoutOptions;
-
-		for(auto& option : options.mOptions)
-		{
-			switch(option.type)
-			{
-			case GUIOption::Type::FixedWidth:
-				layoutOptions.fixedWidth = true;
-				layoutOptions.width = option.min;
-				layoutOptions.overridenWidth = true;
-				break;
-			case GUIOption::Type::FixedHeight:
-				layoutOptions.fixedHeight = true;
-				layoutOptions.height = option.min;
-				layoutOptions.overridenHeight = true;
-				break;
-			case GUIOption::Type::FlexibleWidth:
-				layoutOptions.fixedWidth = false;
-				layoutOptions.minWidth = option.min;
-				layoutOptions.maxWidth = option.max;
-				layoutOptions.overridenWidth = true;
-				break;
-			case GUIOption::Type::FlexibleHeight:
-				layoutOptions.fixedHeight = false;
-				layoutOptions.minHeight = option.min;
-				layoutOptions.maxHeight = option.max;
-				layoutOptions.overridenHeight = true;
-				break;
-			}
-		}
-
-		return layoutOptions;
-	}
-
-	void GUILayoutOptions::updateWithStyle(const GUIElementStyle* style)
-	{
-		if(!overridenWidth)
-		{
-			fixedWidth = style->fixedWidth;
-			width = style->width;
-			minWidth = style->minWidth;
-			maxWidth = style->maxWidth;
-		}
-
-		if(!overridenHeight)
-		{
-			fixedHeight = style->fixedHeight;
-			height = style->height;
-			minHeight = style->minHeight;
-			maxHeight = style->maxHeight;
-		}
-	}
-
-	GUILayoutOptions::GUILayoutOptions()
-		:width(0), height(0), minWidth(0), maxWidth(0),
-		minHeight(0), maxHeight(0), fixedWidth(false), fixedHeight(false),
-		overridenWidth(false), overridenHeight(false)
-	{
-
-	}
-
-	LayoutSizeRange GUILayoutOptions::calculateSizeRange(const Vector2I& optimal) const
-	{
-		LayoutSizeRange sizeRange;
-
-		if (fixedHeight)
-		{
-			sizeRange.optimal.y = height;
-			sizeRange.min.y = height;
-			sizeRange.max.y = height;
-		}
-		else
-		{
-			sizeRange.optimal.y = optimal.y;
-
-			if (minHeight > 0)
-			{
-				sizeRange.optimal.y = std::max((INT32)minHeight, sizeRange.optimal.y);
-				sizeRange.min.y = minHeight;
-			}
-
-			if (maxHeight > 0)
-			{
-				sizeRange.optimal.y = std::min((INT32)maxHeight, sizeRange.optimal.y);
-				sizeRange.max.y = maxHeight;
-			}
-		}
-
-		if (fixedWidth)
-		{
-			sizeRange.optimal.x = width;
-			sizeRange.min.x = width;
-			sizeRange.max.x = width;
-		}
-		else
-		{
-			sizeRange.optimal.x = optimal.x;
-
-			if (minWidth > 0)
-			{
-				sizeRange.optimal.x = std::max((INT32)minWidth, sizeRange.optimal.x);
-				sizeRange.min.x = minWidth;
-			}
-
-			if (maxWidth > 0)
-			{
-				sizeRange.optimal.x = std::min((INT32)maxWidth, sizeRange.optimal.x);
-				sizeRange.max.x = maxWidth;
-			}
-		}
-
-		return sizeRange;
-	}
-}

+ 1 - 1
BansheeEngine/Source/BsGUILayoutUtility.cpp

@@ -106,7 +106,7 @@ namespace BansheeEngine
 			}
 		}
 
-		Vector2I actualSize = layout->_calcActualSize(actualAreas, numElements);
+		Vector2I actualSize = layout->_calcActualSize(0, 0, actualAreas, numElements);
 
 		if (elementAreas != nullptr)
 			stackDeallocLast(elementAreas);

+ 34 - 64
BansheeEngine/Source/BsGUILayoutX.cpp

@@ -12,33 +12,25 @@ namespace BansheeEngine
 
 	LayoutSizeRange GUILayoutX::_calculateLayoutSizeRange() const
 	{
-		LayoutSizeRange layoutSizeRange;
-
 		if (mIsDisabled)
-			return layoutSizeRange;
+			return LayoutSizeRange();
 
+		Vector2I optimalSize;
 		for (auto& child : mChildren)
 		{
 			LayoutSizeRange sizeRange = child->_calculateLayoutSizeRange();
 
 			if (child->_getType() == GUIElementBase::Type::FixedSpace)
-				sizeRange.optimal.y = sizeRange.min.y = sizeRange.max.y = 0;
+				sizeRange.optimal.y = 0;
 
 			UINT32 paddingX = child->_getPadding().left + child->_getPadding().right;
 			UINT32 paddingY = child->_getPadding().top + child->_getPadding().bottom;
 
-			layoutSizeRange.optimal.x += sizeRange.optimal.x + paddingX;
-			layoutSizeRange.optimal.y = std::max((UINT32)layoutSizeRange.optimal.y, sizeRange.optimal.y + paddingY);
+			optimalSize.x += sizeRange.optimal.x + paddingX;
+			optimalSize.y = std::max((UINT32)optimalSize.y, sizeRange.optimal.y + paddingY);
 		}
 
-		// Layout has no min or max, it respects the bounds of its parent element and
-		// child elements
-		layoutSizeRange.min.x = 0;
-		layoutSizeRange.min.y = 0;
-		layoutSizeRange.max.x = 0;
-		layoutSizeRange.max.y = 0;
-
-		return layoutSizeRange;
+		return _getDimensions().calculateSizeRange(optimalSize);
 	}
 
 	void GUILayoutX::_updateOptimalLayoutSizes()
@@ -49,7 +41,7 @@ namespace BansheeEngine
 		if(mChildren.size() != mChildSizeRanges.size())
 			mChildSizeRanges.resize(mChildren.size());
 
-		mSizeRange = LayoutSizeRange();
+		Vector2I optimalSize;
 
 		UINT32 childIdx = 0;
 		for(auto& child : mChildren)
@@ -62,14 +54,9 @@ namespace BansheeEngine
 
 				childSizeRange = fixedSpace->_calculateLayoutSizeRange();
 				childSizeRange.optimal.y = 0;
-				childSizeRange.min.y = 0;
-				childSizeRange.max.y = 0;
 			}
 			else if (child->_getType() == GUIElementBase::Type::Element)
 			{
-				GUIElement* element = static_cast<GUIElement*>(child);
-				const GUILayoutOptions& layoutOptions = element->_getLayoutOptions();
-
 				childSizeRange = child->_calculateLayoutSizeRange();
 			}
 			else if(child->_getType() == GUIElementBase::Type::Layout)
@@ -81,18 +68,13 @@ namespace BansheeEngine
 			UINT32 paddingX = child->_getPadding().left + child->_getPadding().right;
 			UINT32 paddingY = child->_getPadding().top + child->_getPadding().bottom;
 
-			mSizeRange.optimal.x += childSizeRange.optimal.x + paddingX;
-			mSizeRange.optimal.y = std::max((UINT32)mSizeRange.optimal.y, childSizeRange.optimal.y + paddingY);
+			optimalSize.x += childSizeRange.optimal.x + paddingX;
+			optimalSize.y = std::max((UINT32)optimalSize.y, childSizeRange.optimal.y + paddingY);
 
 			childIdx++;
 		}
 
-		// Layout has no min or max, it respects the bounds of its parent element and
-		// child elements
-		mSizeRange.min.x = 0;
-		mSizeRange.min.y = 0;
-		mSizeRange.max.x = 0;
-		mSizeRange.max.y = 0;
+		mSizeRange = _getDimensions().calculateSizeRange(optimalSize);
 	}
 
 	void GUILayoutX::_getElementAreas(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect2I* elementAreas, UINT32 numElements, 
@@ -127,12 +109,11 @@ namespace BansheeEngine
 			{
 				processedElements[childIdx] = true;
 			}
-			else if (child->_getType() == GUIElementBase::Type::Element)
+			else if (child->_getType() == GUIElementBase::Type::Element || child->_getType() == GUIElementBase::Type::Layout)
 			{
-				GUIElement* element = static_cast<GUIElement*>(child);
-				const GUILayoutOptions& layoutOptions = element->_getLayoutOptions();
+				const GUIDimensions& dimensions = child->_getDimensions();
 
-				if (layoutOptions.fixedWidth)
+				if (dimensions.fixedWidth())
 					processedElements[childIdx] = true;
 				else
 				{
@@ -140,11 +121,6 @@ namespace BansheeEngine
 					totalNonClampedSize += elementAreas[childIdx].width;
 				}
 			}
-			else if (child->_getType() == GUIElementBase::Type::Layout)
-			{
-				numNonClampedElements++;
-				totalNonClampedSize += elementAreas[childIdx].width;
-			}
 			else if (child->_getType() == GUIElementBase::Type::FlexibleSpace)
 			{
 				numFlexibleSpaces++;
@@ -336,24 +312,23 @@ namespace BansheeEngine
 			UINT32 elemWidth = elementAreas[childIdx].width;
 			xOffset += child->_getPadding().left;
 
-			if (child->_getType() == GUIElementBase::Type::Element)
+			UINT32 elemHeight = (UINT32)sizeRanges[childIdx].optimal.y;
+			const GUIDimensions& layoutOptions = child->_getDimensions();
+			if (!layoutOptions.fixedHeight())
 			{
-				GUIElement* element = static_cast<GUIElement*>(child);
-				element->setWidth(elemWidth);
+				elemHeight = height;
+				if (layoutOptions.minHeight > 0 && elemHeight < layoutOptions.minHeight)
+					elemHeight = layoutOptions.minHeight;
 
-				UINT32 elemHeight = (UINT32)sizeRanges[childIdx].optimal.y;
-				const GUILayoutOptions& layoutOptions = element->_getLayoutOptions();
-				if (!layoutOptions.fixedHeight)
-				{
-					elemHeight = height;
-					if (layoutOptions.minHeight > 0 && elemHeight < layoutOptions.minHeight)
-						elemHeight = layoutOptions.minHeight;
+				if (layoutOptions.maxHeight > 0 && elemHeight > layoutOptions.maxHeight)
+					elemHeight = layoutOptions.maxHeight;
+			}
 
-					if (layoutOptions.maxHeight > 0 && elemHeight > layoutOptions.maxHeight)
-						elemHeight = layoutOptions.maxHeight;
-				}
+			elementAreas[childIdx].height = elemHeight;
 
-				elementAreas[childIdx].height = elemHeight;
+			if (child->_getType() == GUIElementBase::Type::Element)
+			{
+				GUIElement* element = static_cast<GUIElement*>(child);
 
 				UINT32 yPadding = element->_getPadding().top + element->_getPadding().bottom;
 				INT32 yOffset = Math::ceilToInt(((INT32)height - (INT32)(elemHeight + yPadding)) * 0.5f);
@@ -366,7 +341,6 @@ namespace BansheeEngine
 			{
 				GUILayout* layout = static_cast<GUILayout*>(child);
 
-				elementAreas[childIdx].height = height;
 				elementAreas[childIdx].x = x + xOffset;
 				elementAreas[childIdx].y = y;
 			}
@@ -401,14 +375,13 @@ namespace BansheeEngine
 			Rect2I childArea = elementAreas[childIdx];
 
 			Vector2I offset(childArea.x, childArea.y);
-			child->setOffset(offset);
-			child->setWidth(childArea.width);
-
 			if(child->_getType() == GUIElementBase::Type::Element)
 			{
 				GUIElement* element = static_cast<GUIElement*>(child);
 
-				element->setHeight(childArea.height);
+				element->_setPosition(offset);
+				element->_setWidth(childArea.width);
+				element->_setHeight(childArea.height);
 				element->_setWidgetDepth(widgetDepth);
 				element->_setAreaDepth(areaDepth);
 
@@ -425,8 +398,6 @@ namespace BansheeEngine
 			{
 				GUILayout* layout = static_cast<GUILayout*>(child);
 
-				layout->setHeight(height);
-
 				Rect2I newClipRect(childArea.x, childArea.y, childArea.width, height);
 				newClipRect.clip(clipRect);
 				layout->_updateLayoutInternal(childArea.x, childArea.y, childArea.width, height, newClipRect, widgetDepth, areaDepth);
@@ -435,15 +406,14 @@ namespace BansheeEngine
 			}
 			else
 			{
-				child->setHeight(childArea.height);
 				actualSizes[childIdx].height = childArea.height;
 			}
 
-			actualSizes[childIdx].x = childArea.width + child->_getPadding().left + child->_getPadding().right;
+			actualSizes[childIdx].width = childArea.width + child->_getPadding().left + child->_getPadding().right;
 			childIdx++;
 		}
 
-		Vector2I actualSize = _calcActualSize(actualSizes, numElements);
+		Vector2I actualSize = _calcActualSize(x, y, actualSizes, numElements);
 		mActualWidth = (UINT32)actualSize.x;
 		mActualHeight = (UINT32)actualSize.y;
 
@@ -453,15 +423,15 @@ namespace BansheeEngine
 		_markAsClean();
 	}
 
-	Vector2I GUILayoutX::_calcActualSize(Rect2I* elementAreas, UINT32 numElements) const
+	Vector2I GUILayoutX::_calcActualSize(INT32 x, INT32 y, Rect2I* elementAreas, UINT32 numElements) const
 	{
 		Vector2I actualArea;
 		for (UINT32 i = 0; i < numElements; i++)
 		{
 			Rect2I childArea = elementAreas[i];
 
-			actualArea.x = childArea.width;
-			actualArea.y += std::max(actualArea.x, childArea.width);
+			actualArea.x += childArea.width;
+			actualArea.y = std::max(actualArea.y, childArea.height);
 		}
 
 		return actualArea;

+ 32 - 59
BansheeEngine/Source/BsGUILayoutY.cpp

@@ -12,33 +12,25 @@ namespace BansheeEngine
 
 	LayoutSizeRange GUILayoutY::_calculateLayoutSizeRange() const
 	{
-		LayoutSizeRange layoutSizeRange;
-
 		if (mIsDisabled)
-			return layoutSizeRange;
+			return LayoutSizeRange();
 
+		Vector2I optimalSize;
 		for (auto& child : mChildren)
 		{
 			LayoutSizeRange sizeRange = child->_calculateLayoutSizeRange();
 			
 			if (child->_getType() == GUIElementBase::Type::FixedSpace)
-				sizeRange.optimal.x = sizeRange.min.x = sizeRange.max.x = 0;
+				sizeRange.optimal.x = 0;
 
 			UINT32 paddingX = child->_getPadding().left + child->_getPadding().right;
 			UINT32 paddingY = child->_getPadding().top + child->_getPadding().bottom;
 
-			layoutSizeRange.optimal.y += sizeRange.optimal.y + paddingY;
-			layoutSizeRange.optimal.x = std::max((UINT32)layoutSizeRange.optimal.x, sizeRange.optimal.x + paddingX);
+			optimalSize.y += sizeRange.optimal.y + paddingY;
+			optimalSize.x = std::max((UINT32)optimalSize.x, sizeRange.optimal.x + paddingX);
 		}
 
-		// Layout has no min or max, it respects the bounds of its parent element and
-		// child elements
-		layoutSizeRange.min.x = 0;
-		layoutSizeRange.min.y = 0;
-		layoutSizeRange.max.x = 0;
-		layoutSizeRange.max.y = 0;
-
-		return layoutSizeRange;
+		return _getDimensions().calculateSizeRange(optimalSize);
 	}
 
 	void GUILayoutY::_updateOptimalLayoutSizes()
@@ -49,7 +41,7 @@ namespace BansheeEngine
 		if(mChildren.size() != mChildSizeRanges.size())
 			mChildSizeRanges.resize(mChildren.size());
 
-		mSizeRange = LayoutSizeRange();
+		Vector2I optimalSize;
 
 		UINT32 childIdx = 0;
 		for(auto& child : mChildren)
@@ -62,14 +54,9 @@ namespace BansheeEngine
 
 				childSizeRange = fixedSpace->_calculateLayoutSizeRange();
 				childSizeRange.optimal.x = 0;
-				childSizeRange.min.x = 0;
-				childSizeRange.max.x = 0;
 			}
 			else if(child->_getType() == GUIElementBase::Type::Element)
 			{
-				GUIElement* element = static_cast<GUIElement*>(child);
-				const GUILayoutOptions& layoutOptions = element->_getLayoutOptions();
-
 				childSizeRange = child->_calculateLayoutSizeRange();
 			}
 			else if(child->_getType() == GUIElementBase::Type::Layout)
@@ -81,18 +68,13 @@ namespace BansheeEngine
 			UINT32 paddingX = child->_getPadding().left + child->_getPadding().right;
 			UINT32 paddingY = child->_getPadding().top + child->_getPadding().bottom;
 
-			mSizeRange.optimal.y += childSizeRange.optimal.y + paddingY;
-			mSizeRange.optimal.x = std::max((UINT32)mSizeRange.optimal.x, childSizeRange.optimal.x + paddingX);
+			optimalSize.y += childSizeRange.optimal.y + paddingY;
+			optimalSize.x = std::max((UINT32)optimalSize.x, childSizeRange.optimal.x + paddingX);
 
 			childIdx++;
 		}
 
-		// Layout has no min or max, it respects the bounds of its parent element and
-		// child elements
-		mSizeRange.min.x = 0;
-		mSizeRange.min.y = 0;
-		mSizeRange.max.x = 0;
-		mSizeRange.max.y = 0;
+		mSizeRange = _getDimensions().calculateSizeRange(optimalSize);
 	}
 
 	void GUILayoutY::_getElementAreas(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect2I* elementAreas, UINT32 numElements, 
@@ -127,12 +109,11 @@ namespace BansheeEngine
 			{
 				processedElements[childIdx] = true;
 			}
-			else if (child->_getType() == GUIElementBase::Type::Element)
+			else if (child->_getType() == GUIElementBase::Type::Element || child->_getType() == GUIElementBase::Type::Layout)
 			{
-				GUIElement* element = static_cast<GUIElement*>(child);
-				const GUILayoutOptions& layoutOptions = element->_getLayoutOptions();
+				const GUIDimensions& layoutOptions = child->_getDimensions();
 
-				if (layoutOptions.fixedHeight)
+				if (layoutOptions.fixedHeight())
 					processedElements[childIdx] = true;
 				else
 				{
@@ -140,11 +121,6 @@ namespace BansheeEngine
 					totalNonClampedSize += elementAreas[childIdx].height;
 				}
 			}
-			else if (child->_getType() == GUIElementBase::Type::Layout)
-			{
-				numNonClampedElements++;
-				totalNonClampedSize += elementAreas[childIdx].height;
-			}
 			else if (child->_getType() == GUIElementBase::Type::FlexibleSpace)
 			{
 				numFlexibleSpaces++;
@@ -342,22 +318,23 @@ namespace BansheeEngine
 			UINT32 elemHeight = elementAreas[childIdx].height;
 			yOffset += child->_getPadding().top;
 
-			if (child->_getType() == GUIElementBase::Type::Element)
+			UINT32 elemWidth = (UINT32)sizeRanges[childIdx].optimal.x;
+			const GUIDimensions& layoutOptions = child->_getDimensions();
+			if (!layoutOptions.fixedWidth())
 			{
-				GUIElement* element = static_cast<GUIElement*>(child);
-				UINT32 elemWidth = (UINT32)sizeRanges[childIdx].optimal.x;
-				const GUILayoutOptions& layoutOptions = element->_getLayoutOptions();
-				if (!layoutOptions.fixedWidth)
-				{
-					elemWidth = width;
-					if (layoutOptions.minWidth > 0 && elemWidth < layoutOptions.minWidth)
-						elemWidth = layoutOptions.minWidth;
+				elemWidth = width;
+				if (layoutOptions.minWidth > 0 && elemWidth < layoutOptions.minWidth)
+					elemWidth = layoutOptions.minWidth;
 
-					if (layoutOptions.maxWidth > 0 && elemWidth > layoutOptions.maxWidth)
-						elemWidth = layoutOptions.maxWidth;
-				}
+				if (layoutOptions.maxWidth > 0 && elemWidth > layoutOptions.maxWidth)
+					elemWidth = layoutOptions.maxWidth;
+			}
 
-				elementAreas[childIdx].width = elemWidth;
+			elementAreas[childIdx].width = elemWidth;
+
+			if (child->_getType() == GUIElementBase::Type::Element)
+			{
+				GUIElement* element = static_cast<GUIElement*>(child);
 
 				UINT32 xPadding = element->_getPadding().left + element->_getPadding().right;
 				INT32 xOffset = Math::ceilToInt((INT32)(width - (INT32)(elemWidth + xPadding)) * 0.5f);
@@ -368,7 +345,6 @@ namespace BansheeEngine
 			}
 			else if (child->_getType() == GUIElementBase::Type::Layout)
 			{
-				elementAreas[childIdx].width = width;
 				elementAreas[childIdx].x = x;
 				elementAreas[childIdx].y = y + yOffset;
 			}
@@ -397,14 +373,14 @@ namespace BansheeEngine
 			Rect2I childArea = elementAreas[childIdx];
 
 			Vector2I offset(childArea.x, childArea.y);
-			child->setOffset(offset);
-			child->setHeight(childArea.height);
 
 			if(child->_getType() == GUIElementBase::Type::Element)
 			{
 				GUIElement* element = static_cast<GUIElement*>(child);
 
-				element->setWidth(childArea.width);
+				element->_setPosition(offset);
+				element->_setHeight(childArea.height);
+				element->_setWidth(childArea.width);
 				element->_setWidgetDepth(widgetDepth);
 				element->_setAreaDepth(areaDepth);
 
@@ -421,8 +397,6 @@ namespace BansheeEngine
 			{
 				GUILayout* layout = static_cast<GUILayout*>(child);
 
-				child->setWidth(width);
-
 				Rect2I newClipRect(childArea.x, childArea.y, width, childArea.height);
 				newClipRect.clip(clipRect);
 				layout->_updateLayoutInternal(childArea.x, childArea.y, width, childArea.height, newClipRect, widgetDepth, areaDepth);
@@ -431,7 +405,6 @@ namespace BansheeEngine
 			}
 			else
 			{
-				child->setWidth(childArea.width);
 				actualSizes[childIdx].width = childArea.width;
 			}
 
@@ -439,7 +412,7 @@ namespace BansheeEngine
 			childIdx++;
 		}
 
-		Vector2I actualSize = _calcActualSize(actualSizes, numElements);
+		Vector2I actualSize = _calcActualSize(x, y, actualSizes, numElements);
 		mActualWidth = (UINT32)actualSize.x;
 		mActualHeight = (UINT32)actualSize.y;
 
@@ -449,7 +422,7 @@ namespace BansheeEngine
 		_markAsClean();
 	}
 
-	Vector2I GUILayoutY::_calcActualSize(Rect2I* elementAreas, UINT32 numElements) const
+	Vector2I GUILayoutY::_calcActualSize(INT32 x, INT32 y, Rect2I* elementAreas, UINT32 numElements) const
 	{
 		Vector2I actualArea;
 		for (UINT32 i = 0; i < numElements; i++)

+ 4 - 4
BansheeEngine/Source/BsGUIListBox.cpp

@@ -4,7 +4,7 @@
 #include "BsGUISkin.h"
 #include "BsSpriteTexture.h"
 #include "BsTextSprite.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUIMouseEvent.h"
 #include "BsGUIManager.h"
 #include "BsGUIHelper.h"
@@ -19,7 +19,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIListBox::GUIListBox(const String& styleName, const Vector<HString>& elements, const GUILayoutOptions& layoutOptions)
+	GUIListBox::GUIListBox(const String& styleName, const Vector<HString>& elements, const GUIDimensions& layoutOptions)
 		:GUIButtonBase(styleName, GUIContent(HString(L"")), layoutOptions), mElements(elements), mSelectedIdx(0), mIsListBoxOpen(false)
 	{
 		if(elements.size() > 0)
@@ -33,12 +33,12 @@ namespace BansheeEngine
 
 	GUIListBox* GUIListBox::create(const Vector<HString>& elements, const String& styleName)
 	{
-		return new (bs_alloc<GUIListBox, PoolAlloc>()) GUIListBox(getStyleName<GUIListBox>(styleName), elements, GUILayoutOptions::create());
+		return new (bs_alloc<GUIListBox, PoolAlloc>()) GUIListBox(getStyleName<GUIListBox>(styleName), elements, GUIDimensions::create());
 	}
 
 	GUIListBox* GUIListBox::create(const Vector<HString>& elements, const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIListBox, PoolAlloc>()) GUIListBox(getStyleName<GUIListBox>(styleName), elements, GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIListBox, PoolAlloc>()) GUIListBox(getStyleName<GUIListBox>(styleName), elements, GUIDimensions::create(layoutOptions));
 	}
 
 	void GUIListBox::setElements(const Vector<HString>& elements)

+ 11 - 0
BansheeEngine/Source/BsGUIOptions.cpp

@@ -8,6 +8,17 @@ namespace BansheeEngine
 
 	}
 
+	GUIOption GUIOption::position(INT32 x, INT32 y)
+	{
+		GUIOption option;
+
+		option.min = (UINT32)x;
+		option.max = (UINT32)y;
+		option.type = Type::Position;
+
+		return option;
+	}
+
 	GUIOption GUIOption::fixedWidth(UINT32 value)
 	{
 		GUIOption option;

+ 10 - 10
BansheeEngine/Source/BsGUIProgressBar.cpp

@@ -3,13 +3,13 @@
 #include "BsGUISkin.h"
 #include "BsGUITexture.h"
 #include "BsSpriteTexture.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 
 using namespace std::placeholders;
 
 namespace BansheeEngine
 {
-	GUIProgressBar::GUIProgressBar(const String& styleName, const GUILayoutOptions& layoutOptions)
+	GUIProgressBar::GUIProgressBar(const String& styleName, const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions, styleName), mPercent(0)
 	{
 		mBar = GUITexture::create(getSubStyleName(getBarStyleType()));
@@ -50,9 +50,9 @@ namespace BansheeEngine
 		Vector2I bgOffset(x, y);
 		Rect2I bgClipRect(clipRect.x - bgOffset.x, clipRect.y - bgOffset.y, clipRect.width, clipRect.height);
 
-		mBackground->setOffset(bgOffset);
-		mBackground->setWidth(width);
-		mBackground->setHeight(height);
+		mBackground->_setPosition(bgOffset);
+		mBackground->_setWidth(width);
+		mBackground->_setHeight(height);
 		mBackground->_setAreaDepth(areaDepth);
 		mBackground->_setWidgetDepth(widgetDepth);
 		mBackground->_setClipRect(bgClipRect);
@@ -65,9 +65,9 @@ namespace BansheeEngine
 		UINT32 maxProgressBarWidth = std::max((UINT32)0, (UINT32)(width - style->margins.left - style->margins.right));
 		UINT32 progressBarHeight = std::max((UINT32)0, (UINT32)(height - style->margins.top - style->margins.bottom)); 
 
-		mBar->setOffset(barOffset);
-		mBar->setWidth((UINT32)Math::floorToInt(maxProgressBarWidth * mPercent));
-		mBar->setHeight(progressBarHeight);
+		mBar->_setPosition(barOffset);
+		mBar->_setWidth((UINT32)Math::floorToInt(maxProgressBarWidth * mPercent));
+		mBar->_setHeight(progressBarHeight);
 		mBar->_setAreaDepth(areaDepth);
 		mBar->_setWidgetDepth(widgetDepth);
 		mBar->_setClipRect(barClipRect);
@@ -93,12 +93,12 @@ namespace BansheeEngine
 
 	GUIProgressBar* GUIProgressBar::create(const String& styleName)
 	{
-		return new (bs_alloc<GUIProgressBar, PoolAlloc>()) GUIProgressBar(getStyleName<GUIProgressBar>(styleName), GUILayoutOptions::create());
+		return new (bs_alloc<GUIProgressBar, PoolAlloc>()) GUIProgressBar(getStyleName<GUIProgressBar>(styleName), GUIDimensions::create());
 	}
 
 	GUIProgressBar* GUIProgressBar::create(const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIProgressBar, PoolAlloc>()) GUIProgressBar(getStyleName<GUIProgressBar>(styleName), GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIProgressBar, PoolAlloc>()) GUIProgressBar(getStyleName<GUIProgressBar>(styleName), GUIDimensions::create(layoutOptions));
 	}
 
 	const String& GUIProgressBar::getGUITypeName()

+ 3 - 3
BansheeEngine/Source/BsGUIRenderTexture.cpp

@@ -13,7 +13,7 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIRenderTexture::GUIRenderTexture(const String& styleName, const RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions)
+	GUIRenderTexture::GUIRenderTexture(const String& styleName, const RenderTexturePtr& texture, const GUIDimensions& layoutOptions)
 		:GUITexture(styleName, HSpriteTexture(), GUIImageScaleMode::StretchToFit, false, layoutOptions)
 	{
 		setRenderTexture(texture);
@@ -27,12 +27,12 @@ namespace BansheeEngine
 
 	GUIRenderTexture* GUIRenderTexture::create(const RenderTexturePtr& texture, const String& styleName)
 	{
-		return new (bs_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(getStyleName<GUIRenderTexture>(styleName), texture, GUILayoutOptions::create());
+		return new (bs_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(getStyleName<GUIRenderTexture>(styleName), texture, GUIDimensions::create());
 	}
 
 	GUIRenderTexture* GUIRenderTexture::create(const RenderTexturePtr& texture, const GUIOptions& layoutOptions, const String& styleName)
 	{
-		return new (bs_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(getStyleName<GUIRenderTexture>(styleName), texture, GUILayoutOptions::create(layoutOptions));
+		return new (bs_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(getStyleName<GUIRenderTexture>(styleName), texture, GUIDimensions::create(layoutOptions));
 	}
 
 	void GUIRenderTexture::setRenderTexture(const RenderTexturePtr& texture)

+ 12 - 12
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -2,7 +2,7 @@
 #include "BsGUIElementStyle.h"
 #include "BsGUISkin.h"
 #include "BsGUIWidget.h"
-#include "BsGUILayoutOptions.h"
+#include "BsGUIDimensions.h"
 #include "BsGUILayoutY.h"
 #include "BsGUISkin.h"
 #include "BsGUIScrollBarVert.h"
@@ -20,7 +20,7 @@ namespace BansheeEngine
 	const UINT32 GUIScrollArea::WheelScrollAmount = 50;
 
 	GUIScrollArea::GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, 
-		const String& scrollBarStyle, const String& scrollAreaStyle, const GUILayoutOptions& layoutOptions)
+		const String& scrollBarStyle, const String& scrollAreaStyle, const GUIDimensions& layoutOptions)
 		:GUIElementContainer(layoutOptions), mVertScroll(nullptr), mHorzScroll(nullptr), mVertOffset(0), mHorzOffset(0),
 		mVertBarType(vertBarType), mHorzBarType(horzBarType), mScrollBarStyle(scrollBarStyle)
 	{
@@ -231,9 +231,9 @@ namespace BansheeEngine
 
 		// Vertical scrollbar
 		{
-			mVertScroll->setOffset(Vector2I(vertScrollBounds.x, vertScrollBounds.y));
-			mVertScroll->setWidth(vertScrollBounds.width);
-			mVertScroll->setHeight(vertScrollBounds.height);
+			mVertScroll->_setPosition(Vector2I(vertScrollBounds.x, vertScrollBounds.y));
+			mVertScroll->_setWidth(vertScrollBounds.width);
+			mVertScroll->_setHeight(vertScrollBounds.height);
 			mVertScroll->_setAreaDepth(areaDepth);
 			mVertScroll->_setWidgetDepth(widgetDepth);
 
@@ -261,9 +261,9 @@ namespace BansheeEngine
 
 		// Horizontal scrollbar
 		{
-			mHorzScroll->setOffset(Vector2I(horzScrollBounds.x, horzScrollBounds.y));
-			mHorzScroll->setWidth(horzScrollBounds.width);
-			mHorzScroll->setHeight(horzScrollBounds.height);
+			mHorzScroll->_setPosition(Vector2I(horzScrollBounds.x, horzScrollBounds.y));
+			mHorzScroll->_setWidth(horzScrollBounds.width);
+			mHorzScroll->_setHeight(horzScrollBounds.height);
 			mHorzScroll->_setAreaDepth(areaDepth);
 			mHorzScroll->_setWidgetDepth(widgetDepth);
 
@@ -421,20 +421,20 @@ namespace BansheeEngine
 		const String& scrollBarStyle, const String& scrollAreaStyle)
 	{
 		return new (bs_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(vertBarType, horzBarType, scrollBarStyle, 
-			getStyleName<GUIScrollArea>(scrollAreaStyle), GUILayoutOptions::create());
+			getStyleName<GUIScrollArea>(scrollAreaStyle), GUIDimensions::create());
 	}
 
 	GUIScrollArea* GUIScrollArea::create(const GUIOptions& layoutOptions, const String& scrollBarStyle, 
 		const String& scrollAreaStyle)
 	{
 		return new (bs_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(ScrollBarType::ShowIfDoesntFit, 
-			ScrollBarType::ShowIfDoesntFit, scrollBarStyle, getStyleName<GUIScrollArea>(scrollAreaStyle), GUILayoutOptions::create(layoutOptions));
+			ScrollBarType::ShowIfDoesntFit, scrollBarStyle, getStyleName<GUIScrollArea>(scrollAreaStyle), GUIDimensions::create(layoutOptions));
 	}
 
 	GUIScrollArea* GUIScrollArea::create(const String& scrollBarStyle, const String& scrollAreaStyle)
 	{
 		return new (bs_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(ScrollBarType::ShowIfDoesntFit, ScrollBarType::ShowIfDoesntFit, scrollBarStyle, 
-			getStyleName<GUIScrollArea>(scrollAreaStyle), GUILayoutOptions::create());
+			getStyleName<GUIScrollArea>(scrollAreaStyle), GUIDimensions::create());
 	}
 
 	GUIScrollArea* GUIScrollArea::create(ScrollBarType vertBarType, 
@@ -442,7 +442,7 @@ namespace BansheeEngine
 		const String& scrollAreaStyle)
 	{
 		return new (bs_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(vertBarType, horzBarType, scrollBarStyle, 
-			getStyleName<GUIScrollArea>(scrollAreaStyle), GUILayoutOptions::create(layoutOptions));
+			getStyleName<GUIScrollArea>(scrollAreaStyle), GUIDimensions::create(layoutOptions));
 	}
 
 	const String& GUIScrollArea::getGUITypeName()

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor