2
0
Эх сурвалжийг харах

GUI elements refactor (removing GUIWidget from constructor) stage 1

Marko Pintera 12 жил өмнө
parent
commit
d601e2c843
95 өөрчлөгдсөн 560 нэмэгдсэн , 949 устгасан
  1. 2 2
      BansheeEditor/Include/BsDockManager.h
  2. 3 3
      BansheeEditor/Include/BsGUIColor.h
  3. 12 13
      BansheeEditor/Include/BsGUIColorField.h
  4. 3 3
      BansheeEditor/Include/BsGUIDockSlider.h
  5. 3 3
      BansheeEditor/Include/BsGUIDropButton.h
  6. 23 23
      BansheeEditor/Include/BsGUIFieldBase.h
  7. 1 1
      BansheeEditor/Include/BsGUIFloatField.h
  8. 3 3
      BansheeEditor/Include/BsGUIFoldout.h
  9. 11 11
      BansheeEditor/Include/BsGUIGameObjectField.h
  10. 1 1
      BansheeEditor/Include/BsGUIIntField.h
  11. 3 3
      BansheeEditor/Include/BsGUIResourceTreeView.h
  12. 3 3
      BansheeEditor/Include/BsGUISceneTreeView.h
  13. 5 5
      BansheeEditor/Include/BsGUITabButton.h
  14. 4 4
      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. 3 3
      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. 3 3
      BansheeEditor/Include/BsGUIWindowDropArea.h
  23. 3 3
      BansheeEditor/Include/BsGUIWindowFrame.h
  24. 15 15
      BansheeEditor/Source/BsDockManager.cpp
  25. 1 1
      BansheeEditor/Source/BsEditorWidgetContainer.cpp
  26. 6 18
      BansheeEditor/Source/BsGUIColor.cpp
  27. 19 33
      BansheeEditor/Source/BsGUIColorField.cpp
  28. 6 18
      BansheeEditor/Source/BsGUIDockSlider.cpp
  29. 6 18
      BansheeEditor/Source/BsGUIDropButton.cpp
  30. 3 7
      BansheeEditor/Source/BsGUIFieldBase.cpp
  31. 8 12
      BansheeEditor/Source/BsGUIFloatField.cpp
  32. 6 6
      BansheeEditor/Source/BsGUIFoldout.cpp
  33. 25 25
      BansheeEditor/Source/BsGUIGameObjectField.cpp
  34. 8 12
      BansheeEditor/Source/BsGUIIntField.cpp
  35. 9 9
      BansheeEditor/Source/BsGUIMenuBar.cpp
  36. 6 12
      BansheeEditor/Source/BsGUIResourceTreeView.cpp
  37. 6 6
      BansheeEditor/Source/BsGUISceneTreeView.cpp
  38. 10 34
      BansheeEditor/Source/BsGUITabButton.cpp
  39. 12 12
      BansheeEditor/Source/BsGUITabbedTitleBar.cpp
  40. 3 8
      BansheeEditor/Source/BsGUITextField.cpp
  41. 3 8
      BansheeEditor/Source/BsGUIToggleField.cpp
  42. 9 9
      BansheeEditor/Source/BsGUITreeView.cpp
  43. 6 18
      BansheeEditor/Source/BsGUITreeViewEditBox.cpp
  44. 4 4
      BansheeEditor/Source/BsGUIVector2Field.cpp
  45. 5 5
      BansheeEditor/Source/BsGUIVector3Field.cpp
  46. 6 6
      BansheeEditor/Source/BsGUIVector4Field.cpp
  47. 6 18
      BansheeEditor/Source/BsGUIWindowDropArea.cpp
  48. 6 18
      BansheeEditor/Source/BsGUIWindowFrame.cpp
  49. 2 2
      BansheeEditor/Source/BsGUIWindowFrameWidget.cpp
  50. 1 1
      BansheeEditor/Source/BsMainEditorWindow.cpp
  51. 4 4
      BansheeEditor/Source/DbgEditorWidget1.cpp
  52. 11 11
      BansheeEditor/Source/DbgEditorWidget2.cpp
  53. 0 1
      BansheeEngine/BansheeEngine.vcxproj
  54. 0 3
      BansheeEngine/BansheeEngine.vcxproj.filters
  55. 5 5
      BansheeEngine/Include/BsGUIButton.h
  56. 1 1
      BansheeEngine/Include/BsGUIButtonBase.h
  57. 3 3
      BansheeEngine/Include/BsGUIDropDownHitBox.h
  58. 1 3
      BansheeEngine/Include/BsGUIElement.h
  59. 3 1
      BansheeEngine/Include/BsGUIElementBase.h
  60. 1 1
      BansheeEngine/Include/BsGUIElementContainer.h
  61. 0 56
      BansheeEngine/Include/BsGUIFoldout.h
  62. 4 4
      BansheeEngine/Include/BsGUIInputBox.h
  63. 5 5
      BansheeEngine/Include/BsGUILabel.h
  64. 3 3
      BansheeEngine/Include/BsGUIListBox.h
  65. 3 3
      BansheeEngine/Include/BsGUIRenderTexture.h
  66. 5 5
      BansheeEngine/Include/BsGUIScrollArea.h
  67. 1 1
      BansheeEngine/Include/BsGUIScrollBar.h
  68. 3 3
      BansheeEngine/Include/BsGUIScrollBarHandle.h
  69. 3 3
      BansheeEngine/Include/BsGUIScrollBarHorz.h
  70. 3 3
      BansheeEngine/Include/BsGUIScrollBarVert.h
  71. 9 9
      BansheeEngine/Include/BsGUITexture.h
  72. 9 9
      BansheeEngine/Include/BsGUIToggle.h
  73. 3 3
      BansheeEngine/Include/BsGUIViewport.h
  74. 1 0
      BansheeEngine/Source/BsGUIArea.cpp
  75. 10 22
      BansheeEngine/Source/BsGUIButton.cpp
  76. 2 2
      BansheeEngine/Source/BsGUIButtonBase.cpp
  77. 6 18
      BansheeEngine/Source/BsGUIDropDownHitBox.cpp
  78. 8 10
      BansheeEngine/Source/BsGUIElement.cpp
  79. 17 1
      BansheeEngine/Source/BsGUIElementBase.cpp
  80. 2 2
      BansheeEngine/Source/BsGUIElementContainer.cpp
  81. 8 26
      BansheeEngine/Source/BsGUIInputBox.cpp
  82. 10 22
      BansheeEngine/Source/BsGUILabel.cpp
  83. 1 1
      BansheeEngine/Source/BsGUILayout.cpp
  84. 9 21
      BansheeEngine/Source/BsGUIListBox.cpp
  85. 9 9
      BansheeEngine/Source/BsGUIManager.cpp
  86. 6 18
      BansheeEngine/Source/BsGUIRenderTexture.cpp
  87. 13 37
      BansheeEngine/Source/BsGUIScrollArea.cpp
  88. 6 6
      BansheeEngine/Source/BsGUIScrollBar.cpp
  89. 6 18
      BansheeEngine/Source/BsGUIScrollBarHandle.cpp
  90. 6 18
      BansheeEngine/Source/BsGUIScrollBarHorz.cpp
  91. 6 18
      BansheeEngine/Source/BsGUIScrollBarVert.cpp
  92. 18 66
      BansheeEngine/Source/BsGUITexture.cpp
  93. 18 42
      BansheeEngine/Source/BsGUIToggle.cpp
  94. 6 18
      BansheeEngine/Source/BsGUIViewport.cpp
  95. 23 6
      Inspector.txt

+ 2 - 2
BansheeEditor/Include/BsDockManager.h

@@ -74,7 +74,7 @@ namespace BansheeEditor
 			None
 		};
 	public:
-		static DockManager* create(BS::GUIWidget& parent, CM::RenderWindow* parentWindow);
+		static DockManager* create(CM::RenderWindow* parentWindow);
 
 		/**
 		 * @brief	Internal method. Called once every frame.
@@ -95,7 +95,7 @@ namespace BansheeEditor
 		void updateClippedBounds();
 
 	private:
-		DockManager(BS::GUIWidget& parent, CM::RenderWindow* parentWindow, const BS::GUILayoutOptions& layoutOptions);
+		DockManager(CM::RenderWindow* parentWindow, const BS::GUILayoutOptions& layoutOptions);
 
 		static const CM::Color TINT_COLOR;
 		static const CM::Color HIGHLIGHT_COLOR;

+ 3 - 3
BansheeEditor/Include/BsGUIColor.h

@@ -12,8 +12,8 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIColor* create(BS::GUIWidget& parent, const BS::GUIElementStyle* style = nullptr);
-		static GUIColor* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUIColor* create(const BS::GUIElementStyle* style = nullptr);
+		static GUIColor* create(const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 
 		virtual CM::Vector2I _getOptimalSize() const;
 
@@ -21,7 +21,7 @@ namespace BansheeEditor
 		CM::Color getColor() const { return mColor; }
 
 	protected:
-		GUIColor(BS::GUIWidget& parent, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
+		GUIColor(const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
 		virtual ~GUIColor();
 
 		/**

+ 12 - 13
BansheeEditor/Include/BsGUIColorField.h

@@ -12,29 +12,28 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIColorField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+		static GUIColorField* create(const BS::GUIContent& labelContent, 
 			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
 
-		static GUIColorField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
+		static GUIColorField* create(const CM::HString& labelText, 
 			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
 
-		static GUIColorField* create(BS::GUIWidget& parent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
+		static GUIColorField* create(const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, 
+			BS::GUIElementStyle* toggleStyle = nullptr);
 
-		static GUIColorField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
+		static GUIColorField* create(const BS::GUIContent& labelContent, BS::GUIElementStyle* labelStyle = nullptr, 
+			BS::GUIElementStyle* toggleStyle = nullptr);
 
-		static GUIColorField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
+		static GUIColorField* create(const CM::HString& labelText, BS::GUIElementStyle* labelStyle = nullptr,
+			BS::GUIElementStyle* toggleStyle = nullptr);
 
-		static GUIColorField* create(BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
+		static GUIColorField* create(BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
 
-		GUIColorField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+		GUIColorField(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, 
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* toggleStyle, const BS::GUILayoutOptions& layoutOptions);
 
-		GUIColorField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* toggleStyle, const BS::GUILayoutOptions& layoutOptions);
+		GUIColorField(const PrivatelyConstruct& dummy, BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* toggleStyle, 
+			const BS::GUILayoutOptions& layoutOptions);
 
 		CM::Color getValue() const;
 		void setValue(const CM::Color& value);

+ 3 - 3
BansheeEditor/Include/BsGUIDockSlider.h

@@ -12,8 +12,8 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIDockSlider* create(BS::GUIWidget& parent, bool horizontal, const BS::GUIElementStyle* style = nullptr);
-		static GUIDockSlider* create(BS::GUIWidget& parent, bool horizontal, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUIDockSlider* create(bool horizontal, const BS::GUIElementStyle* style = nullptr);
+		static GUIDockSlider* create(bool horizontal, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 
 		boost::signal<void(const CM::Vector2I&)> onDragged;
 	protected:
@@ -26,6 +26,6 @@ namespace BansheeEditor
 		bool mIsCursorSet;
 		bool mDragInProgress;
 
-		GUIDockSlider(BS::GUIWidget& parent, bool horizontal, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
+		GUIDockSlider(bool horizontal, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
 	};
 }

+ 3 - 3
BansheeEditor/Include/BsGUIDropButton.h

@@ -15,15 +15,15 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIDropButton* create(BS::GUIWidget& parent, CM::UINT32 dragType, const BS::GUIElementStyle* style = nullptr);
-		static GUIDropButton* create(BS::GUIWidget& parent, CM::UINT32 dragType, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUIDropButton* create(CM::UINT32 dragType, const BS::GUIElementStyle* style = nullptr);
+		static GUIDropButton* create(CM::UINT32 dragType, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 
 		boost::signal<void(void*)> onDataDropped;
 	protected:
 		virtual ~GUIDropButton();
 
 	protected:
-		GUIDropButton(BS::GUIWidget& parent, CM::UINT32 dragType, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
+		GUIDropButton(CM::UINT32 dragType, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
 
 		virtual bool mouseEvent(const BS::GUIMouseEvent& ev);
 

+ 23 - 23
BansheeEditor/Include/BsGUIFieldBase.h

@@ -11,7 +11,7 @@ namespace BansheeEditor
 		struct PrivatelyConstruct {};
 
 	public:
-		GUIFieldBase(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUIFieldBase(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
@@ -32,77 +32,77 @@ namespace BansheeEditor
 	class TGUIField : public GUIFieldBase
 	{
 	public:
-		static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
+		static T* create(const BS::GUIContent& labelContent, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, labelContent, labelWidth, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), labelContent, labelWidth, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, const BS::GUIOptions& layoutOptions, 
+		static T* create(const BS::GUIContent& labelContent, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, labelContent, DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
+		static T* create(const CM::HString& labelText, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), labelWidth, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), BS::GUIContent(labelText), labelWidth, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, const CM::HString& labelText, const BS::GUIOptions& layoutOptions, 
+		static T* create(const CM::HString& labelText, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* entryElementStyle = nullptr)
+		static T* create(const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(), 0, nullptr, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), BS::GUIContent(), 0, nullptr, entryElementStyle, 
 				GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), false);
 		}
 
-		static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth, 
+		static T* create(const BS::GUIContent& labelContent, CM::UINT32 labelWidth, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, labelContent, labelWidth, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), labelContent, labelWidth, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+		static T* create(const BS::GUIContent& labelContent, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, labelContent, DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth, 
+		static T* create(const CM::HString& labelText, CM::UINT32 labelWidth, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), labelWidth, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), BS::GUIContent(labelText), labelWidth, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, const CM::HString& labelText, 
+		static T* create(const CM::HString& labelText, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, entryElementStyle, 
 				GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 		}
 
-		static T* create(BS::GUIWidget& parent, BS::GUIElementStyle* entryElementStyle = nullptr)
+		static T* create(BS::GUIElementStyle* entryElementStyle = nullptr)
 		{
-			return cm_new<T>(PrivatelyConstruct(), parent, BS::GUIContent(), 0, nullptr, entryElementStyle, 
+			return cm_new<T>(PrivatelyConstruct(), BS::GUIContent(), 0, nullptr, entryElementStyle, 
 				GUILayoutOptions::create(&GUISkin::DefaultStyle), false);
 		}
 
-		TGUIField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		TGUIField(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel)
-			:GUIFieldBase(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel)
+			:GUIFieldBase(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel)
 		{ }
 	};
 }

+ 1 - 1
BansheeEditor/Include/BsGUIFloatField.h

@@ -10,7 +10,7 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		GUIFloatField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUIFloatField(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		float getValue() const;

+ 3 - 3
BansheeEditor/Include/BsGUIFoldout.h

@@ -12,13 +12,13 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIFoldout* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, 
+		static GUIFoldout* create(const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* buttonStyle = nullptr, BS::GUIElementStyle* backgroundStyle = nullptr);
 
-		static GUIFoldout* create(BS::GUIWidget& parent, BS::GUIElementStyle* labelStyle = nullptr,
+		static GUIFoldout* create(BS::GUIElementStyle* labelStyle = nullptr,
 			BS::GUIElementStyle* backgroundStyle = nullptr);
 
-		GUIFoldout(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, BS::GUIElementStyle* buttonStyle, 
+		GUIFoldout(const PrivatelyConstruct& dummy, BS::GUIElementStyle* buttonStyle, 
 			BS::GUIElementStyle* backgroundStyle, const BS::GUILayoutOptions& layoutOptions);
 
 		bool isExpanded() const { return mIsExpanded; }

+ 11 - 11
BansheeEditor/Include/BsGUIGameObjectField.h

@@ -12,45 +12,45 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
+		static GUIGameObjectField* create(const BS::GUIContent& labelContent, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, const BS::GUIOptions& layoutOptions, 
+		static GUIGameObjectField* create(const BS::GUIContent& labelContent, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
+		static GUIGameObjectField* create(const CM::HString& labelText, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const CM::HString& labelText, const BS::GUIOptions& layoutOptions, 
+		static GUIGameObjectField* create(const CM::HString& labelText, const BS::GUIOptions& layoutOptions, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* dropButtonStyle = nullptr,
+		static GUIGameObjectField* create(const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth, 
+		static GUIGameObjectField* create(const BS::GUIContent& labelContent, CM::UINT32 labelWidth, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+		static GUIGameObjectField* create(const BS::GUIContent& labelContent, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth, 
+		static GUIGameObjectField* create(const CM::HString& labelText, CM::UINT32 labelWidth, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
+		static GUIGameObjectField* create(const CM::HString& labelText, 
 			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		static GUIGameObjectField* create(BS::GUIWidget& parent, BS::GUIElementStyle* dropButtonStyle = nullptr,
+		static GUIGameObjectField* create(BS::GUIElementStyle* dropButtonStyle = nullptr,
 			BS::GUIElementStyle* clearButtonStyle = nullptr);
 
-		GUIGameObjectField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+		GUIGameObjectField(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, 
 			CM::UINT32 labelWidth, BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle,
 			BS::GUIElementStyle* clearButtonStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 

+ 1 - 1
BansheeEditor/Include/BsGUIIntField.h

@@ -10,7 +10,7 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		GUIIntField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUIIntField(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		CM::INT32 getValue() const;

+ 3 - 3
BansheeEditor/Include/BsGUIResourceTreeView.h

@@ -32,13 +32,13 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIResourceTreeView* create(BS::GUIWidget& parent,
+		static GUIResourceTreeView* create(
 			BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* elementBtnStyle = nullptr, 
 			BS::GUIElementStyle* foldoutBtnStyle = nullptr, BS::GUIElementStyle* selectionBackgroundStyle = nullptr,
 			BS::GUIElementStyle* editBoxStyle = nullptr, BS::GUIElementStyle* dragHighlightStyle = nullptr, 
 			BS::GUIElementStyle* dragSepHighlightStyle = nullptr);
 
-		static GUIResourceTreeView* create(BS::GUIWidget& parent, const BS::GUIOptions& options, 
+		static GUIResourceTreeView* create(const BS::GUIOptions& options, 
 			BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* elementBtnStyle = nullptr, 
 			BS::GUIElementStyle* foldoutBtnStyle = nullptr, BS::GUIElementStyle* selectionBackgroundStyle = nullptr,
 			BS::GUIElementStyle* editBoxStyle = nullptr, BS::GUIElementStyle* dragHighlightStyle = nullptr, 
@@ -60,7 +60,7 @@ namespace BansheeEditor
 		boost::signals::connection mDropTargetLeaveConn;
 		boost::signals::connection mDropTargetDroppedConn;
 
-		GUIResourceTreeView(BS::GUIWidget& parent, BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle, 
+		GUIResourceTreeView(BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle, 
 			BS::GUIElementStyle* foldoutBtnStyle, BS::GUIElementStyle* selectionBackgroundStyle, BS::GUIElementStyle* editBoxStyle, 
 			BS::GUIElementStyle* dragHighlightStyle, BS::GUIElementStyle* dragSepHighlightStyle, const BS::GUILayoutOptions& layoutOptions);
 

+ 3 - 3
BansheeEditor/Include/BsGUISceneTreeView.h

@@ -30,13 +30,13 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUISceneTreeView* create(BS::GUIWidget& parent,
+		static GUISceneTreeView* create(
 			BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* elementBtnStyle = nullptr, 
 			BS::GUIElementStyle* foldoutBtnStyle = nullptr, BS::GUIElementStyle* selectionBackgroundStyle = nullptr,
 			BS::GUIElementStyle* editBoxStyle = nullptr, BS::GUIElementStyle* dragHighlightStyle = nullptr, 
 			BS::GUIElementStyle* dragSepHighlightStyle = nullptr);
 
-		static GUISceneTreeView* create(BS::GUIWidget& parent, const BS::GUIOptions& options, 
+		static GUISceneTreeView* create(const BS::GUIOptions& options, 
 			BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* elementBtnStyle = nullptr, 
 			BS::GUIElementStyle* foldoutBtnStyle = nullptr, BS::GUIElementStyle* selectionBackgroundStyle = nullptr,
 			BS::GUIElementStyle* editBoxStyle = nullptr, BS::GUIElementStyle* dragHighlightStyle = nullptr, 
@@ -49,7 +49,7 @@ namespace BansheeEditor
 	protected:
 		SceneTreeElement mRootElement;
 
-		GUISceneTreeView(BS::GUIWidget& parent, BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle, 
+		GUISceneTreeView(BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle, 
 			BS::GUIElementStyle* foldoutBtnStyle, BS::GUIElementStyle* selectionBackgroundStyle, BS::GUIElementStyle* editBoxStyle, 
 			BS::GUIElementStyle* dragHighlightStyle, BS::GUIElementStyle* dragSepHighlightStyle, const BS::GUILayoutOptions& layoutOptions);
 

+ 5 - 5
BansheeEditor/Include/BsGUITabButton.h

@@ -13,11 +13,11 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUITabButton* create(BS::GUIWidget& parent, const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const CM::HString& text, const BS::GUIElementStyle* style = nullptr);
-		static GUITabButton* create(BS::GUIWidget& parent, const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const CM::HString& text, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUITabButton* create(const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const CM::HString& text, const BS::GUIElementStyle* style = nullptr);
+		static GUITabButton* create(const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const CM::HString& text, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 	
-		static GUITabButton* create(BS::GUIWidget& parent, const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const BS::GUIContent& content, const BS::GUIElementStyle* style = nullptr);
-		static GUITabButton* create(BS::GUIWidget& parent, const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const BS::GUIContent& content, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUITabButton* create(const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const BS::GUIContent& content, const BS::GUIElementStyle* style = nullptr);
+		static GUITabButton* create(const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const BS::GUIContent& content, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 
 		CM::UINT32 getIndex() const { return mIndex; }
 		void _setDraggedState(bool active);
@@ -35,6 +35,6 @@ namespace BansheeEditor
 
 		static const CM::UINT32 DRAG_MIN_DISTANCE;
 
-		GUITabButton(BS::GUIWidget& parent, const BS::GUIElementStyle* style, const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const BS::GUIContent& content, const BS::GUILayoutOptions& layoutOptions);
+		GUITabButton(const BS::GUIElementStyle* style, const BS::GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const BS::GUIContent& content, const BS::GUILayoutOptions& layoutOptions);
 	};
 }

+ 4 - 4
BansheeEditor/Include/BsGUITabbedTitleBar.h

@@ -12,12 +12,12 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUITabbedTitleBar* create(BS::GUIWidget& parent, CM::RenderWindow* parentWindow,
+		static GUITabbedTitleBar* create(CM::RenderWindow* parentWindow,
 			BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* tabBtnStyle = nullptr, 
 			BS::GUIElementStyle* minBtnStyle = nullptr, BS::GUIElementStyle* closeBtnStyle = nullptr);
 
-		static GUITabbedTitleBar* create(BS::GUIWidget& parent, CM::RenderWindow* parentWindow, const BS::GUILayoutOptions& layoutOptions);
-		static GUITabbedTitleBar* create(BS::GUIWidget& parent, CM::RenderWindow* parentWindow, const BS::GUILayoutOptions& layoutOptions, 
+		static GUITabbedTitleBar* create(CM::RenderWindow* parentWindow, const BS::GUILayoutOptions& layoutOptions);
+		static GUITabbedTitleBar* create(CM::RenderWindow* parentWindow, const BS::GUILayoutOptions& layoutOptions, 
 			BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* tabBtnStyle = nullptr, 
 			BS::GUIElementStyle* minBtnStyle = nullptr, BS::GUIElementStyle* closeBtnStyle = nullptr);
 
@@ -69,7 +69,7 @@ namespace BansheeEditor
 		const BS::GUIElementStyle* mMinimizeBtnStyle;
 		const BS::GUIElementStyle* mTabBtnStyle;
 
-		GUITabbedTitleBar(BS::GUIWidget& parent, CM::RenderWindow* parentWindow, BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* tabBtnStyle, 
+		GUITabbedTitleBar(CM::RenderWindow* parentWindow, BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* tabBtnStyle, 
 			BS::GUIElementStyle* minBtnStyle, BS::GUIElementStyle* closeBtnStyle, const BS::GUILayoutOptions& layoutOptions);
 
 		virtual bool mouseEvent(const BS::GUIMouseEvent& ev);

+ 1 - 1
BansheeEditor/Include/BsGUITextField.h

@@ -10,7 +10,7 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		GUITextField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUITextField(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		CM::WString getValue() const;

+ 1 - 1
BansheeEditor/Include/BsGUIToggleField.h

@@ -10,7 +10,7 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		GUIToggleField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUIToggleField(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* toggleStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		bool getValue() const;

+ 1 - 1
BansheeEditor/Include/BsGUITreeView.h

@@ -122,7 +122,7 @@ namespace BansheeEditor
 		static BS::VirtualButton mRenameVB;
 		static BS::VirtualButton mDeleteVB;
 
-		GUITreeView(BS::GUIWidget& parent, BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle, 
+		GUITreeView(BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle, 
 			BS::GUIElementStyle* foldoutBtnStyle, BS::GUIElementStyle* selectionBackgroundStyle, BS::GUIElementStyle* editBoxStyle, 
 			BS::GUIElementStyle* dragHighlightStyle, BS::GUIElementStyle* dragSepHighlightStyle, const BS::GUILayoutOptions& layoutOptions);
 

+ 3 - 3
BansheeEditor/Include/BsGUITreeViewEditBox.h

@@ -10,14 +10,14 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUITreeViewEditBox* create(BS::GUIWidget& parent, const BS::GUIElementStyle* style = nullptr);
-		static GUITreeViewEditBox* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUITreeViewEditBox* create(const BS::GUIElementStyle* style = nullptr);
+		static GUITreeViewEditBox* create(const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 
 		boost::signal<void()> onInputConfirmed;
 		boost::signal<void()> onInputCanceled;
 
 	private:
-		GUITreeViewEditBox(BS::GUIWidget& parent, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
+		GUITreeViewEditBox(const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
 
 		virtual bool commandEvent(const BS::GUICommandEvent& ev);
 	};

+ 1 - 1
BansheeEditor/Include/BsGUIVector2Field.h

@@ -11,7 +11,7 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		GUIVector2Field(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUIVector2Field(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		CM::Vector2 getValue() const;

+ 1 - 1
BansheeEditor/Include/BsGUIVector3Field.h

@@ -11,7 +11,7 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		GUIVector3Field(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUIVector3Field(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		CM::Vector3 getValue() const;

+ 1 - 1
BansheeEditor/Include/BsGUIVector4Field.h

@@ -11,7 +11,7 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		GUIVector4Field(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
+		GUIVector4Field(const PrivatelyConstruct& dummy, const BS::GUIContent& labelContent, CM::UINT32 labelWidth,
 			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions, bool withLabel);
 
 		CM::Vector4 getValue() const;

+ 3 - 3
BansheeEditor/Include/BsGUIWindowDropArea.h

@@ -11,15 +11,15 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIWindowDropArea* create(BS::GUIWidget& parent, const BS::GUIElementStyle* style = nullptr);
-		static GUIWindowDropArea* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUIWindowDropArea* create(const BS::GUIElementStyle* style = nullptr);
+		static GUIWindowDropArea* create(const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 
 		void setFocused(bool focused);
 
 		boost::signal<void()> onDraggedItemDropped;
 	protected:
 		~GUIWindowDropArea();
-		GUIWindowDropArea(BS::GUIWidget& parent, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
+		GUIWindowDropArea(const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
 
 		virtual bool mouseEvent(const BS::GUIMouseEvent& ev);
 	};

+ 3 - 3
BansheeEditor/Include/BsGUIWindowFrame.h

@@ -11,12 +11,12 @@ namespace BansheeEditor
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIWindowFrame* create(BS::GUIWidget& parent, const BS::GUIElementStyle* style = nullptr);
-		static GUIWindowFrame* create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
+		static GUIWindowFrame* create(const BS::GUIElementStyle* style = nullptr);
+		static GUIWindowFrame* create(const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style = nullptr);
 
 		void setFocused(bool focused);
 	protected:
 		~GUIWindowFrame();
-		GUIWindowFrame(BS::GUIWidget& parent, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
+		GUIWindowFrame(const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions);
 	};
 }

+ 15 - 15
BansheeEditor/Source/BsDockManager.cpp

@@ -220,12 +220,12 @@ namespace BansheeEditor
 
 		if(horizontal)
 		{
-			mSlider = GUIDockSlider::create(*widgetParent, true, widgetParent->getSkin().getStyle("DockSliderBtn"));
+			mSlider = GUIDockSlider::create(true, widgetParent->getSkin().getStyle("DockSliderBtn"));
 			mSlider->_setWidgetDepth(widgetParent->getDepth());
 		}
 		else
 		{
-			mSlider = GUIDockSlider::create(*widgetParent, false, widgetParent->getSkin().getStyle("DockSliderBtn"));
+			mSlider = GUIDockSlider::create(false, widgetParent->getSkin().getStyle("DockSliderBtn"));
 			mSlider->_setWidgetDepth(widgetParent->getDepth());
 		}
 
@@ -355,8 +355,8 @@ namespace BansheeEditor
 		return mWidgets->getContentBounds();
 	}
 
-	DockManager::DockManager(BS::GUIWidget& parent, CM::RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mParentWindow(parentWindow), mMouseOverContainer(nullptr), mHighlightedDropLoc(DockLocation::None),
+	DockManager::DockManager(CM::RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions)
+		:GUIElementContainer(layoutOptions), mParentWindow(parentWindow), mMouseOverContainer(nullptr), mHighlightedDropLoc(DockLocation::None),
 		mShowOverlay(false)
 	{
 		mTopDropPolygon = cm_newN<Vector2>(4);
@@ -377,9 +377,9 @@ namespace BansheeEditor
 		cm_deleteN(mRightDropPolygon, 4);
 	}
 
-	DockManager* DockManager::create(GUIWidget& parent, RenderWindow* parentWindow)
+	DockManager* DockManager::create(RenderWindow* parentWindow)
 	{
-		return new (cm_alloc<DockManager, PoolAlloc>()) DockManager(parent, parentWindow, GUILayoutOptions::create(&GUISkin::DefaultStyle));
+		return new (cm_alloc<DockManager, PoolAlloc>()) DockManager(parentWindow, GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 
 	void DockManager::update()
@@ -447,16 +447,16 @@ namespace BansheeEditor
 			switch(location)
 			{
 			case DockLocation::Left:
-				container->addLeft(mParent, mParentWindow, widgetToInsert);
+				container->addLeft(_getParentWidget(), mParentWindow, widgetToInsert);
 				break;
 			case DockLocation::Right:
-				container->addRight(mParent, mParentWindow, widgetToInsert);
+				container->addRight(_getParentWidget(), mParentWindow, widgetToInsert);
 				break;
 			case DockLocation::Top:
-				container->addTop(mParent, mParentWindow, widgetToInsert);
+				container->addTop(_getParentWidget(), mParentWindow, widgetToInsert);
 				break;
 			case DockLocation::Bottom:
-				container->addBottom(mParent, mParentWindow, widgetToInsert);
+				container->addBottom(_getParentWidget(), mParentWindow, widgetToInsert);
 				break;
 			}
 		}
@@ -465,7 +465,7 @@ namespace BansheeEditor
 			if(mRootContainer.mWidgets != nullptr)
 				CM_EXCEPT(InternalErrorException, "Trying to insert a widget into dock manager root container but one already exists.");
 
-			mRootContainer.makeLeaf(mParent, mParentWindow);
+			mRootContainer.makeLeaf(_getParentWidget(), mParentWindow);
 			mRootContainer.addWidget(widgetToInsert);
 		}
 	}
@@ -633,7 +633,7 @@ namespace BansheeEditor
 
 		if(leafEntry->widgetNames.size() > 0) // If zero, entire layout is empty
 		{
-			mRootContainer.makeLeaf(mParent, mParentWindow);
+			mRootContainer.makeLeaf(_getParentWidget(), mParentWindow);
 			OpenWidgets(&mRootContainer, leafEntry->widgetNames);
 
 			if(!rootEntry->isLeaf)
@@ -648,7 +648,7 @@ namespace BansheeEditor
 
 					leafEntry = GetLeafEntry(curEntry.layoutEntry->children[1], 0);
 
-					curEntry.container->splitContainer(mParent, mParentWindow, curEntry.layoutEntry->horizontalSplit, false, curEntry.layoutEntry->splitPosition);
+					curEntry.container->splitContainer(_getParentWidget(), mParentWindow, curEntry.layoutEntry->horizontalSplit, false, curEntry.layoutEntry->splitPosition);
 
 					DockContainer* otherChild = curEntry.container->mChildren[1];
 					OpenWidgets(otherChild, leafEntry->widgetNames);
@@ -858,7 +858,7 @@ namespace BansheeEditor
 
 			const Vector2I& widgetRelPos = event.getPosition();
 
-			const Matrix4& worldTfrm = mParent->SO()->getWorldTfrm();
+			const Matrix4& worldTfrm = _getParentWidget()->SO()->getWorldTfrm();
 
 			Vector4 tfrmdPos = worldTfrm.multiply3x4(Vector4((float)widgetRelPos.x, (float)widgetRelPos.y, 0.0f, 1.0f));
 			Vector2 windowPosVec(tfrmdPos.x, tfrmdPos.y);
@@ -916,7 +916,7 @@ namespace BansheeEditor
 			EditorWidgetBase* draggedWidget = reinterpret_cast<EditorWidgetBase*>(DragAndDropManager::instance().getDragData());
 
 			const Vector2I& widgetRelPos = event.getPosition();
-			const Matrix4& worldTfrm = mParent->SO()->getWorldTfrm();
+			const Matrix4& worldTfrm = _getParentWidget()->SO()->getWorldTfrm();
 
 			Vector4 tfrmdPos = worldTfrm.multiply3x4(Vector4((float)widgetRelPos.x, (float)widgetRelPos.y, 0.0f, 1.0f));
 			Vector2 windowPosVec(tfrmdPos.x, tfrmdPos.y);

+ 1 - 1
BansheeEditor/Source/BsEditorWidgetContainer.cpp

@@ -23,7 +23,7 @@ namespace BansheeEditor
 	{
 		mTitleBarArea = GUIArea::create(*parent, 0, 0, 0, 0, 9900);
 
-		mTitleBar = GUITabbedTitleBar::create(*parent, renderWindow);
+		mTitleBar = GUITabbedTitleBar::create(renderWindow);
 		mTitleBar->onTabActivated.connect(std::bind(&EditorWidgetContainer::tabActivated, this, _1));
 		mTitleBar->onTabClosed.connect(std::bind(&EditorWidgetContainer::tabClosed, this, _1));
 		mTitleBar->onTabDraggedOff.connect(std::bind(&EditorWidgetContainer::tabDraggedOff, this, _1));

+ 6 - 18
BansheeEditor/Source/BsGUIColor.cpp

@@ -16,8 +16,8 @@ namespace BansheeEditor
 {
 	const float GUIColor::ALPHA_SPLIT_POSITION = 0.75f;
 
-	GUIColor::GUIColor(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mColorSprite(nullptr), mAlphaSprite(nullptr)
+	GUIColor::GUIColor(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUIElement(style, layoutOptions), mColorSprite(nullptr), mAlphaSprite(nullptr)
 	{
 		mColorSprite = cm_new<ImageSprite, PoolAlloc>();
 		mAlphaSprite = cm_new<ImageSprite, PoolAlloc>();
@@ -38,26 +38,14 @@ namespace BansheeEditor
 		return name;
 	}
 
-	GUIColor* GUIColor::create(GUIWidget& parent, const GUIElementStyle* style)
+	GUIColor* GUIColor::create(const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIColor, PoolAlloc>()) GUIColor(parent, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIColor, PoolAlloc>()) GUIColor(style, GUILayoutOptions::create(style));
 	}
 
-	GUIColor* GUIColor::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIColor* GUIColor::create(const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIColor, PoolAlloc>()) GUIColor(parent, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIColor, PoolAlloc>()) GUIColor(style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	void GUIColor::setColor(const Color& color)

+ 19 - 33
BansheeEditor/Source/BsGUIColorField.cpp

@@ -13,36 +13,22 @@ using namespace BansheeEngine;
 
 namespace BansheeEditor
 {
-	GUIColorField::GUIColorField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
+	GUIColorField::GUIColorField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
 		GUIElementStyle* labelStyle, GUIElementStyle* colorStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mColor(nullptr), mLabelWidth(100)
+		:GUIElementContainer(layoutOptions), mLabel(nullptr), mColor(nullptr), mLabelWidth(100)
 	{
-		const GUIElementStyle* curLabelStyle = labelStyle;
-		const GUIElementStyle* curColorStyle = colorStyle;
-
-		if(curLabelStyle == nullptr)
-			curLabelStyle = parent.getSkin().getStyle("Label");
-
-		if(curColorStyle == nullptr)
-			curColorStyle = parent.getSkin().getStyle("Color");
-
-		mLabel = GUILabel::create(parent, labelContent, curLabelStyle);
-		mColor = GUIColor::create(parent, curColorStyle);
+		mLabel = GUILabel::create(labelContent, labelStyle);
+		mColor = GUIColor::create(colorStyle);
 
 		_registerChildElement(mLabel);
 		_registerChildElement(mColor);
 	}
 
-	GUIColorField::GUIColorField(const PrivatelyConstruct& dummy, GUIWidget& parent, 
+	GUIColorField::GUIColorField(const PrivatelyConstruct& dummy, 
 		GUIElementStyle* labelStyle, GUIElementStyle* colorStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mColor(nullptr), mLabelWidth(100)
+		:GUIElementContainer(layoutOptions), mLabel(nullptr), mColor(nullptr), mLabelWidth(100)
 	{
-		const GUIElementStyle* curColorStyle = colorStyle;
-
-		if(curColorStyle == nullptr)
-			curColorStyle = parent.getSkin().getStyle("Color");
-
-		mColor = GUIColor::create(parent, curColorStyle);
+		mColor = GUIColor::create(colorStyle);
 
 		_registerChildElement(mColor);
 	}
@@ -52,44 +38,44 @@ namespace BansheeEditor
 
 	}
 
-	GUIColorField* GUIColorField::create(GUIWidget& parent, const GUIContent& labelContent, const GUIOptions& layoutOptions, 
+	GUIColorField* GUIColorField::create(const GUIContent& labelContent, const GUIOptions& layoutOptions, 
 		GUIElementStyle* labelStyle, GUIElementStyle* toggleStyle)
 	{
-		return cm_new<GUIColorField>(PrivatelyConstruct(), parent, labelContent, labelStyle, toggleStyle, 
+		return cm_new<GUIColorField>(PrivatelyConstruct(), labelContent, labelStyle, toggleStyle, 
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
 	}
 
-	GUIColorField* GUIColorField::create(GUIWidget& parent, const GUIContent& labelContent, GUIElementStyle* labelStyle, 
+	GUIColorField* GUIColorField::create(const GUIContent& labelContent, GUIElementStyle* labelStyle, 
 		GUIElementStyle* toggleStyle)
 	{
-		return cm_new<GUIColorField>(PrivatelyConstruct(), parent, labelContent, labelStyle, toggleStyle, 
+		return cm_new<GUIColorField>(PrivatelyConstruct(), labelContent, labelStyle, toggleStyle, 
 			GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 
-	GUIColorField* GUIColorField::create(GUIWidget& parent, const HString& labelContent, const GUIOptions& layoutOptions, 
+	GUIColorField* GUIColorField::create(const HString& labelContent, const GUIOptions& layoutOptions, 
 		GUIElementStyle* labelStyle, GUIElementStyle* toggleStyle)
 	{
-		return cm_new<GUIColorField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, 
+		return cm_new<GUIColorField>(PrivatelyConstruct(), GUIContent(labelContent), labelStyle, 
 			toggleStyle, GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
 	}
 
-	GUIColorField* GUIColorField::create(GUIWidget& parent, const HString& labelContent, GUIElementStyle* labelStyle, 
+	GUIColorField* GUIColorField::create( const HString& labelContent, GUIElementStyle* labelStyle, 
 		GUIElementStyle* toggleStyle)
 	{
-		return cm_new<GUIColorField>(PrivatelyConstruct(), parent, GUIContent(labelContent), labelStyle, toggleStyle, 
+		return cm_new<GUIColorField>(PrivatelyConstruct(), GUIContent(labelContent), labelStyle, toggleStyle, 
 			GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 
-	GUIColorField* GUIColorField::create(GUIWidget& parent, const GUIOptions& layoutOptions, GUIElementStyle* labelStyle, 
+	GUIColorField* GUIColorField::create(const GUIOptions& layoutOptions, GUIElementStyle* labelStyle, 
 		GUIElementStyle* toggleStyle)
 	{
-		return cm_new<GUIColorField>(PrivatelyConstruct(), parent, labelStyle, toggleStyle, 
+		return cm_new<GUIColorField>(PrivatelyConstruct(), labelStyle, toggleStyle, 
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
 	}
 
-	GUIColorField* GUIColorField::create(GUIWidget& parent, GUIElementStyle* labelStyle, GUIElementStyle* toggleStyle)
+	GUIColorField* GUIColorField::create(GUIElementStyle* labelStyle, GUIElementStyle* toggleStyle)
 	{
-		return cm_new<GUIColorField>(PrivatelyConstruct(), parent, labelStyle, toggleStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
+		return cm_new<GUIColorField>(PrivatelyConstruct(), labelStyle, toggleStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 
 	Color GUIColorField::getValue() const

+ 6 - 18
BansheeEditor/Source/BsGUIDockSlider.cpp

@@ -18,33 +18,21 @@ namespace BansheeEditor
 		return name;
 	}
 
-	GUIDockSlider::GUIDockSlider(BS::GUIWidget& parent, bool horizontal, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions)
-		:GUIButtonBase(parent, style, GUIContent(HString(L"")), layoutOptions),
+	GUIDockSlider::GUIDockSlider(bool horizontal, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions)
+		:GUIButtonBase(style, GUIContent(HString(L"")), layoutOptions),
 		mDragInProgress(false), mHorizontal(horizontal), mIsCursorSet(false)
 	{
 
 	}
 
-	GUIDockSlider* GUIDockSlider::create(GUIWidget& parent, bool horizontal, const GUIElementStyle* style)
+	GUIDockSlider* GUIDockSlider::create(bool horizontal, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIDockSlider, PoolAlloc>()) GUIDockSlider(parent, horizontal, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIDockSlider, PoolAlloc>()) GUIDockSlider(horizontal, style, GUILayoutOptions::create(style));
 	}
 
-	GUIDockSlider* GUIDockSlider::create(GUIWidget& parent, bool horizontal, const GUIOptions& layoutOptions, const BS::GUIElementStyle* style)
+	GUIDockSlider* GUIDockSlider::create(bool horizontal, const GUIOptions& layoutOptions, const BS::GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIDockSlider, PoolAlloc>()) GUIDockSlider(parent, horizontal, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIDockSlider, PoolAlloc>()) GUIDockSlider(horizontal, style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	bool GUIDockSlider::_hasCustomCursor(const CM::Vector2I position, CursorType& type) const

+ 6 - 18
BansheeEditor/Source/BsGUIDropButton.cpp

@@ -21,8 +21,8 @@ namespace BansheeEditor
 		return name;
 	}
 
-	GUIDropButton::GUIDropButton(GUIWidget& parent, CM::UINT32 dragType, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUIButtonBase(parent, style, GUIContent(HString(L"None")), layoutOptions)
+	GUIDropButton::GUIDropButton(CM::UINT32 dragType, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUIButtonBase(style, GUIContent(HString(L"None")), layoutOptions)
 	{
 
 	}
@@ -30,26 +30,14 @@ namespace BansheeEditor
 	GUIDropButton::~GUIDropButton()
 	{ }
 
-	GUIDropButton* GUIDropButton::create(GUIWidget& parent, CM::UINT32 dragType, const GUIElementStyle* style)
+	GUIDropButton* GUIDropButton::create(CM::UINT32 dragType, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIDropButton, PoolAlloc>()) GUIDropButton(parent, dragType, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIDropButton, PoolAlloc>()) GUIDropButton(dragType, style, GUILayoutOptions::create(style));
 	}
 
-	GUIDropButton* GUIDropButton::create(GUIWidget& parent, CM::UINT32 dragType, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIDropButton* GUIDropButton::create(CM::UINT32 dragType, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIDropButton, PoolAlloc>()) GUIDropButton(parent, dragType, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIDropButton, PoolAlloc>()) GUIDropButton(dragType, style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	bool GUIDropButton::mouseEvent(const GUIMouseEvent& ev)

+ 3 - 7
BansheeEditor/Source/BsGUIFieldBase.cpp

@@ -11,19 +11,15 @@ namespace BansheeEditor
 {
 	const UINT32 GUIFieldBase::DEFAULT_LABEL_WIDTH = 100;
 
-	GUIFieldBase::GUIFieldBase(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, UINT32 labelWidth,
+	GUIFieldBase::GUIFieldBase(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
 		GUIElementStyle* labelStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:GUIElementContainer(parent, layoutOptions)
+		:GUIElementContainer(layoutOptions)
 	{
 		mLayout = &addLayoutXInternal(this);
 
 		if(withLabel)
 		{
-			const GUIElementStyle* curLabelStyle = labelStyle;
-			if(curLabelStyle == nullptr)
-				curLabelStyle = parent.getSkin().getStyle("Label");
-
-			mLabel = BS::GUILabel::create(parent, labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), curLabelStyle);
+			mLabel = BS::GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), labelStyle);
 			mLayout->addElement(mLabel);
 		}
 	}

+ 8 - 12
BansheeEditor/Source/BsGUIFloatField.cpp

@@ -19,16 +19,12 @@ namespace BansheeEditor
 {
 	const float GUIFloatField::DRAG_SPEED = 0.05f;
 
-	GUIFloatField::GUIFloatField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, CM::UINT32 labelWidth, 
+	GUIFloatField::GUIFloatField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, CM::UINT32 labelWidth, 
 		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
+		:TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
 		mLastDragPos(0)
 	{
-		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-		if(curInputBoxStyle == nullptr)
-			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
-
-		mInputBox = GUIInputBox::create(parent, false, GUIOptions(GUIOption::flexibleWidth()), inputBoxStyle);
+		mInputBox = GUIInputBox::create(false, GUIOptions(GUIOption::flexibleWidth()), inputBoxStyle);
 		mInputBox->setFilter(&GUIFloatField::floatFilter);
 
 		mLayout->addElement(mInputBox);
@@ -86,16 +82,16 @@ namespace BansheeEditor
 				if(event.getPosition().x < 0)
 				{
 					Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-					cursorScreenPos.x += _getParentWidget().getTarget()->getWidth();
-					jumpAmount = _getParentWidget().getTarget()->getWidth();
+					cursorScreenPos.x += _getParentWidget()->getTarget()->getWidth();
+					jumpAmount = _getParentWidget()->getTarget()->getWidth();
 
 					Cursor::instance().setScreenPosition(cursorScreenPos);
 				}
-				else if(event.getPosition().x >= _getParentWidget().getTarget()->getWidth())
+				else if(event.getPosition().x >= _getParentWidget()->getTarget()->getWidth())
 				{
 					Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-					cursorScreenPos.x -= _getParentWidget().getTarget()->getWidth();
-					jumpAmount = -_getParentWidget().getTarget()->getWidth();
+					cursorScreenPos.x -= _getParentWidget()->getTarget()->getWidth();
+					jumpAmount = -_getParentWidget()->getTarget()->getWidth();
 
 					Cursor::instance().setScreenPosition(cursorScreenPos);
 				}

+ 6 - 6
BansheeEditor/Source/BsGUIFoldout.cpp

@@ -13,9 +13,9 @@ using namespace BansheeEngine;
 
 namespace BansheeEditor
 {
-	GUIFoldout::GUIFoldout(const PrivatelyConstruct& dummy, GUIWidget& parent, BS::GUIElementStyle* buttonStyle, 
+	GUIFoldout::GUIFoldout(const PrivatelyConstruct& dummy, BS::GUIElementStyle* buttonStyle, 
 		BS::GUIElementStyle* backgroundStyle, const BS::GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mToggle(nullptr), mBackground(nullptr), mIsExpanded(false)
+		:GUIElementContainer(layoutOptions), mToggle(nullptr), mBackground(nullptr), mIsExpanded(false)
 	{
 		const GUIElementStyle* curButtonStyle = buttonStyle;
 		const GUIElementStyle* curBackgroundStyle = backgroundStyle;
@@ -38,17 +38,17 @@ namespace BansheeEditor
 
 	}
 
-	GUIFoldout* GUIFoldout::create(GUIWidget& parent, const GUIOptions& layoutOptions, 
+	GUIFoldout* GUIFoldout::create(const GUIOptions& layoutOptions, 
 		GUIElementStyle* buttonStyle, GUIElementStyle* backgroundStyle)
 	{
-		return cm_new<GUIFoldout>(PrivatelyConstruct(), parent, buttonStyle, backgroundStyle, 
+		return cm_new<GUIFoldout>(PrivatelyConstruct(), buttonStyle, backgroundStyle, 
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle));
 	}
 
-	GUIFoldout* GUIFoldout::create(GUIWidget& parent, GUIElementStyle* buttonStyle, 
+	GUIFoldout* GUIFoldout::create(GUIElementStyle* buttonStyle, 
 		GUIElementStyle* backgroundStyle)
 	{
-		return cm_new<GUIFoldout>(PrivatelyConstruct(), parent, buttonStyle, backgroundStyle, 
+		return cm_new<GUIFoldout>(PrivatelyConstruct(), buttonStyle, backgroundStyle, 
 			GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 

+ 25 - 25
BansheeEditor/Source/BsGUIGameObjectField.cpp

@@ -19,9 +19,9 @@ namespace BansheeEditor
 {
 	const UINT32 GUIGameObjectField::DEFAULT_LABEL_WIDTH = 100;
 
-	GUIGameObjectField::GUIGameObjectField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, CM::UINT32 labelWidth,
+	GUIGameObjectField::GUIGameObjectField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, CM::UINT32 labelWidth,
 		GUIElementStyle* labelStyle, GUIElementStyle* dropButtonStyle, GUIElementStyle* clearButtonStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:GUIElementContainer(parent, layoutOptions), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mInstanceId(0)
+		:GUIElementContainer(layoutOptions), mLabel(nullptr), mClearButton(nullptr), mDropButton(nullptr), mInstanceId(0)
 	{
 		mLayout = &addLayoutXInternal(this);
 
@@ -32,7 +32,7 @@ namespace BansheeEditor
 			if(curLabelStyle == nullptr)
 				curLabelStyle = parent.getSkin().getStyle("Label");
 
-			mLabel = GUILabel::create(parent, labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), curLabelStyle);
+			mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), curLabelStyle);
 			mLayout->addElement(mLabel);
 		}
 
@@ -45,8 +45,8 @@ namespace BansheeEditor
 		if(curClearButtonStyle == nullptr)
 			curClearButtonStyle = parent.getSkin().getStyle("ObjectClearButton");
 
-		mDropButton = GUIDropButton::create(parent, (UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), curDropButtonStyle);
-		mClearButton = GUIButton::create(parent, HString(L""), curClearButtonStyle);
+		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), curDropButtonStyle);
+		mClearButton = GUIButton::create(HString(L""), curClearButtonStyle);
 
 		mLayout->addElement(mDropButton);
 		mLayout->addElement(mClearButton);
@@ -59,72 +59,72 @@ namespace BansheeEditor
 
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
+	GUIGameObjectField* GUIGameObjectField::create(const BS::GUIContent& labelContent, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, labelContent, labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, const BS::GUIOptions& layoutOptions, 
+	GUIGameObjectField* GUIGameObjectField::create(const BS::GUIContent& labelContent, const BS::GUIOptions& layoutOptions, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, labelContent, DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
+	GUIGameObjectField* GUIGameObjectField::create(const CM::HString& labelText, CM::UINT32 labelWidth, const BS::GUIOptions& layoutOptions, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), BS::GUIContent(labelText), labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const CM::HString& labelText, const BS::GUIOptions& layoutOptions, 
+	GUIGameObjectField* GUIGameObjectField::create(const CM::HString& labelText, const BS::GUIOptions& layoutOptions, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle, 
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle, 
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* dropButtonStyle,
+	GUIGameObjectField* GUIGameObjectField::create(const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* dropButtonStyle,
 		BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, BS::GUIContent(), 0, nullptr, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), BS::GUIContent(), 0, nullptr, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(layoutOptions, &GUISkin::DefaultStyle), false);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, CM::UINT32 labelWidth, 
+	GUIGameObjectField* GUIGameObjectField::create(const BS::GUIContent& labelContent, CM::UINT32 labelWidth, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, labelContent, labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
+	GUIGameObjectField* GUIGameObjectField::create(const BS::GUIContent& labelContent, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, labelContent, DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), labelContent, DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const CM::HString& labelText, CM::UINT32 labelWidth, 
+	GUIGameObjectField* GUIGameObjectField::create(const CM::HString& labelText, CM::UINT32 labelWidth, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), BS::GUIContent(labelText), labelWidth, labelStyle, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, const CM::HString& labelText, 
+	GUIGameObjectField* GUIGameObjectField::create(const CM::HString& labelText, 
 		BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle, 
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), BS::GUIContent(labelText), DEFAULT_LABEL_WIDTH, labelStyle, dropButtonStyle, clearButtonStyle, 
 			GUILayoutOptions::create(&GUISkin::DefaultStyle), true);
 	}
 
-	GUIGameObjectField* GUIGameObjectField::create(BS::GUIWidget& parent, BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
+	GUIGameObjectField* GUIGameObjectField::create(BS::GUIElementStyle* dropButtonStyle, BS::GUIElementStyle* clearButtonStyle)
 	{
-		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), parent, BS::GUIContent(), 0, nullptr, dropButtonStyle, clearButtonStyle,
+		return cm_new<GUIGameObjectField>(PrivatelyConstruct(), BS::GUIContent(), 0, nullptr, dropButtonStyle, clearButtonStyle,
 			GUILayoutOptions::create(&GUISkin::DefaultStyle), false);
 	}
 

+ 8 - 12
BansheeEditor/Source/BsGUIIntField.cpp

@@ -19,16 +19,12 @@ namespace BansheeEditor
 {
 	const INT32 GUIIntField::DRAG_SPEED = 5;
 
-	GUIIntField::GUIIntField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, UINT32 labelWidth,
+	GUIIntField::GUIIntField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
 		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
+		:TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr), mIsDragging(false),
 		mLastDragPos(0), mIsDragCursorSet(false)
 	{
-		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-		if(curInputBoxStyle == nullptr)
-			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
-
-		mInputBox = GUIInputBox::create(parent, false, GUIOptions(GUIOption::flexibleWidth()), inputBoxStyle);
+		mInputBox = GUIInputBox::create(false, GUIOptions(GUIOption::flexibleWidth()), inputBoxStyle);
 		mInputBox->setFilter(&GUIIntField::intFilter);
 
 		mLayout->addElement(mInputBox);
@@ -86,16 +82,16 @@ namespace BansheeEditor
 				if(event.getPosition().x < 0)
 				{
 					Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-					cursorScreenPos.x += _getParentWidget().getTarget()->getWidth();
-					jumpAmount = _getParentWidget().getTarget()->getWidth();
+					cursorScreenPos.x += _getParentWidget()->getTarget()->getWidth();
+					jumpAmount = _getParentWidget()->getTarget()->getWidth();
 
 					Cursor::instance().setScreenPosition(cursorScreenPos);
 				}
-				else if(event.getPosition().x >= _getParentWidget().getTarget()->getWidth())
+				else if(event.getPosition().x >= _getParentWidget()->getTarget()->getWidth())
 				{
 					Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-					cursorScreenPos.x -= _getParentWidget().getTarget()->getWidth();
-					jumpAmount = -_getParentWidget().getTarget()->getWidth();
+					cursorScreenPos.x -= _getParentWidget()->getTarget()->getWidth();
+					jumpAmount = -_getParentWidget()->getTarget()->getWidth();
 
 					Cursor::instance().setScreenPosition(cursorScreenPos);
 				}

+ 9 - 9
BansheeEditor/Source/BsGUIMenuBar.cpp

@@ -26,20 +26,20 @@ namespace BansheeEditor
 		mBackgroundArea = GUIArea::create(*parent, 0, 0, 1, 13, 9900);
 		mMainArea = GUIArea::create(*parent, 0, 0, 1, 13, 9899);
 
-		mBgTexture = GUITexture::create(*parent, GUIImageScaleMode::StretchToFit, GUIOptions(GUIOption::flexibleWidth(), GUIOption::flexibleHeight()),
+		mBgTexture = GUITexture::create(GUIImageScaleMode::StretchToFit, GUIOptions(GUIOption::flexibleWidth(), GUIOption::flexibleHeight()),
 			parent->getSkin().getStyle("MenuBarBg"));
 		mBackgroundArea->getLayout().addElement(mBgTexture);
 
-		mLogoTexture = GUITexture::create(*parent, GUIImageScaleMode::StretchToFit, parent->getSkin().getStyle("MenuBarBansheeLogo"));
+		mLogoTexture = GUITexture::create(GUIImageScaleMode::StretchToFit, parent->getSkin().getStyle("MenuBarBansheeLogo"));
 		GUILayout& mainLayout = mMainArea->getLayout();
 
 		mainLayout.addElement(mLogoTexture);
 		mainLayout.addSpace(5);
 		mainLayout.addFlexibleSpace();
 
-		mMinBtn = GUIButton::create(*parent, HString(L""), parent->getSkin().getStyle("WinMinimizeBtn"));
-		mMaxBtn = GUIButton::create(*parent, HString(L""), parent->getSkin().getStyle("WinMaximizeBtn"));
-		mCloseBtn = GUIButton::create(*parent, HString(L""), parent->getSkin().getStyle("WinCloseBtn"));
+		mMinBtn = GUIButton::create(HString(L""), parent->getSkin().getStyle("WinMinimizeBtn"));
+		mMaxBtn = GUIButton::create(HString(L""), parent->getSkin().getStyle("WinMaximizeBtn"));
+		mCloseBtn = GUIButton::create(HString(L""), parent->getSkin().getStyle("WinCloseBtn"));
 
 		mainLayout.addSpace(3);
 		mainLayout.addElement(mMinBtn);
@@ -134,7 +134,7 @@ namespace BansheeEditor
 		newSubMenu.name = name;
 		newSubMenu.menu = cm_new<GUIMenu>();
 
-		GUIButton* newButton = GUIButton::create(*mParentWidget, HString(name), mParentWidget->getSkin().getStyle("MenuBarBtn"));
+		GUIButton* newButton = GUIButton::create(HString(name), mParentWidget->getSkin().getStyle("MenuBarBtn"));
 		newButton->onClick.connect(std::bind(&GUIMenuBar::openSubMenu, this, name));
 		newButton->onHover.connect(std::bind(&GUIMenuBar::onSubMenuHover, this, name));
 		mMainArea->getLayout().insertElement(mMainArea->getLayout().getNumChildren() - NUM_ELEMENTS_AFTER_CONTENT, newButton);
@@ -249,12 +249,12 @@ namespace BansheeEditor
 		}
 
 		GUIDropDownData dropDownData = subMenu->menu->getDropDownData();
-		GUIWidget& widget = subMenu->button->_getParentWidget();
+		GUIWidget* widget = subMenu->button->_getParentWidget();
 
 		GUIDropDownAreaPlacement placement = GUIDropDownAreaPlacement::aroundBoundsHorz(subMenu->button->getBounds());
 
-		GameObjectHandle<GUIDropDownBox> dropDownBox = GUIDropDownBoxManager::instance().openDropDownBox(widget.getTarget(), 
-			placement, dropDownData, widget.getSkin(), GUIDropDownType::MenuBar, std::bind(&GUIMenuBar::onSubMenuClosed, this));
+		GameObjectHandle<GUIDropDownBox> dropDownBox = GUIDropDownBoxManager::instance().openDropDownBox(widget->getTarget(), 
+			placement, dropDownData, widget->getSkin(), GUIDropDownType::MenuBar, std::bind(&GUIMenuBar::onSubMenuClosed, this));
 
 		subMenu->button->_setOn(true);
 

+ 6 - 12
BansheeEditor/Source/BsGUIResourceTreeView.cpp

@@ -30,10 +30,10 @@ namespace BansheeEditor
 		resourcePaths = nullptr;
 	}
 
-	GUIResourceTreeView::GUIResourceTreeView(GUIWidget& parent, GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
+	GUIResourceTreeView::GUIResourceTreeView(GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
 		GUIElementStyle* foldoutBtnStyle, GUIElementStyle* selectionBackgroundStyle, GUIElementStyle* editBoxStyle, 
 		BS::GUIElementStyle* dragHighlightStyle, BS::GUIElementStyle* dragSepHighlightStyle, const GUILayoutOptions& layoutOptions)
-		:GUITreeView(parent, backgroundStyle, elementBtnStyle, foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle,
+		:GUITreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle,
 		dragSepHighlightStyle, layoutOptions), mDraggedResources(nullptr), mCurrentWindow(nullptr), mDropTarget(nullptr), mDropTargetDragActive(false)
 	{
 		ProjectLibrary::instance().onEntryAdded.connect(std::bind(&GUIResourceTreeView::entryAdded, this, _1));
@@ -46,12 +46,6 @@ namespace BansheeEditor
 		expandElement(&mRootElement);
 
 		updateFromProjectLibraryEntry(&mRootElement, rootEntry);
-
-		if(parent.getTarget()->getTarget()->isWindow())
-		{
-			RenderWindow* parentWindow = static_cast<RenderWindow*>(parent.getTarget()->getTarget().get());
-			setDropTarget(parentWindow, _getOffset().x, _getOffset().y, _getWidth(), _getHeight());
-		}
 	}
 
 	GUIResourceTreeView::~GUIResourceTreeView()
@@ -59,19 +53,19 @@ namespace BansheeEditor
 		clearDropTarget();
 	}
 
-	GUIResourceTreeView* GUIResourceTreeView::create(GUIWidget& parent, GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
+	GUIResourceTreeView* GUIResourceTreeView::create(GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
 		GUIElementStyle* foldoutBtnStyle, GUIElementStyle* selectionBackgroundStyle, GUIElementStyle* editBoxStyle, GUIElementStyle* dragHighlightStyle, 
 		GUIElementStyle* dragSepHighlightStyle)
 	{
-		return new (cm_alloc<GUIResourceTreeView, PoolAlloc>()) GUIResourceTreeView(parent, backgroundStyle, elementBtnStyle, foldoutBtnStyle, 
+		return new (cm_alloc<GUIResourceTreeView, PoolAlloc>()) GUIResourceTreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, 
 			selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 
-	GUIResourceTreeView* GUIResourceTreeView::create(GUIWidget& parent, const GUIOptions& options, GUIElementStyle* backgroundStyle,
+	GUIResourceTreeView* GUIResourceTreeView::create(const GUIOptions& options, GUIElementStyle* backgroundStyle,
 		GUIElementStyle* elementBtnStyle, GUIElementStyle* foldoutBtnStyle, GUIElementStyle* selectionBackgroundStyle, 
 		GUIElementStyle* editBoxStyle, GUIElementStyle* dragHighlightStyle, GUIElementStyle* dragSepHighlightStyle)
 	{
-		return new (cm_alloc<GUIResourceTreeView, PoolAlloc>()) GUIResourceTreeView(parent, backgroundStyle, elementBtnStyle, 
+		return new (cm_alloc<GUIResourceTreeView, PoolAlloc>()) GUIResourceTreeView(backgroundStyle, elementBtnStyle, 
 			foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create(options, &GUISkin::DefaultStyle));
 	}
 

+ 6 - 6
BansheeEditor/Source/BsGUISceneTreeView.cpp

@@ -23,10 +23,10 @@ namespace BansheeEditor
 		objects = nullptr;
 	}
 
-	GUISceneTreeView::GUISceneTreeView(GUIWidget& parent, GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
+	GUISceneTreeView::GUISceneTreeView(GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
 		GUIElementStyle* foldoutBtnStyle, GUIElementStyle* selectionBackgroundStyle, GUIElementStyle* editBoxStyle, 
 		BS::GUIElementStyle* dragHighlightStyle, BS::GUIElementStyle* dragSepHighlightStyle, const GUILayoutOptions& layoutOptions)
-		:GUITreeView(parent, backgroundStyle, elementBtnStyle, foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle,
+		:GUITreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle,
 		dragSepHighlightStyle, layoutOptions)
 	{
 		
@@ -37,19 +37,19 @@ namespace BansheeEditor
 		
 	}
 
-	GUISceneTreeView* GUISceneTreeView::create(GUIWidget& parent, GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
+	GUISceneTreeView* GUISceneTreeView::create(GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
 		GUIElementStyle* foldoutBtnStyle, GUIElementStyle* selectionBackgroundStyle, GUIElementStyle* editBoxStyle, GUIElementStyle* dragHighlightStyle, 
 		GUIElementStyle* dragSepHighlightStyle)
 	{
-		return new (cm_alloc<GUISceneTreeView, PoolAlloc>()) GUISceneTreeView(parent, backgroundStyle, elementBtnStyle, foldoutBtnStyle, 
+		return new (cm_alloc<GUISceneTreeView, PoolAlloc>()) GUISceneTreeView(backgroundStyle, elementBtnStyle, foldoutBtnStyle, 
 			selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 
-	GUISceneTreeView* GUISceneTreeView::create(GUIWidget& parent, const GUIOptions& options, GUIElementStyle* backgroundStyle,
+	GUISceneTreeView* GUISceneTreeView::create(const GUIOptions& options, GUIElementStyle* backgroundStyle,
 		GUIElementStyle* elementBtnStyle, GUIElementStyle* foldoutBtnStyle, GUIElementStyle* selectionBackgroundStyle, 
 		GUIElementStyle* editBoxStyle, GUIElementStyle* dragHighlightStyle, GUIElementStyle* dragSepHighlightStyle)
 	{
-		return new (cm_alloc<GUISceneTreeView, PoolAlloc>()) GUISceneTreeView(parent, backgroundStyle, elementBtnStyle, 
+		return new (cm_alloc<GUISceneTreeView, PoolAlloc>()) GUISceneTreeView(backgroundStyle, elementBtnStyle, 
 			foldoutBtnStyle, selectionBackgroundStyle, editBoxStyle, dragHighlightStyle, dragSepHighlightStyle, GUILayoutOptions::create(options, &GUISkin::DefaultStyle));
 	}
 

+ 10 - 34
BansheeEditor/Source/BsGUITabButton.cpp

@@ -18,54 +18,30 @@ namespace BansheeEditor
 		return name;
 	}
 
-	GUITabButton::GUITabButton(GUIWidget& parent, const GUIElementStyle* style, const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const GUIContent& content, const GUILayoutOptions& layoutOptions)
-		:GUIToggle(parent, style, content, toggleGroup, layoutOptions), mIndex(index), mDraggedState(false)
+	GUITabButton::GUITabButton(const GUIElementStyle* style, const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+		:GUIToggle(style, content, toggleGroup, layoutOptions), mIndex(index), mDraggedState(false)
 	{
 
 	}
 
-	GUITabButton* GUITabButton::create(GUIWidget& parent, const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const HString& text, const GUIElementStyle* style)
+	GUITabButton* GUITabButton::create(const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const HString& text, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(parent, style, toggleGroup, index, GUIContent(text), GUILayoutOptions::create(style));
+		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(style, toggleGroup, index, GUIContent(text), GUILayoutOptions::create(style));
 	}
 
-	GUITabButton* GUITabButton::create(GUIWidget& parent, const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUITabButton* GUITabButton::create(const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(parent, style, toggleGroup, index, GUIContent(text), GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(style, toggleGroup, index, GUIContent(text), GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUITabButton* GUITabButton::create(GUIWidget& parent, const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const GUIContent& content, const GUIElementStyle* style)
+	GUITabButton* GUITabButton::create(const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const GUIContent& content, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(parent, style, toggleGroup, index, content, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(style, toggleGroup, index, content, GUILayoutOptions::create(style));
 	}
 
-	GUITabButton* GUITabButton::create(GUIWidget& parent, const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUITabButton* GUITabButton::create(const GUIToggleGroupPtr& toggleGroup, CM::UINT32 index, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(parent, style, toggleGroup, index, content, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUITabButton, PoolAlloc>()) GUITabButton(style, toggleGroup, index, content, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	void GUITabButton::_setDraggedState(bool active) 

+ 12 - 12
BansheeEditor/Source/BsGUITabbedTitleBar.cpp

@@ -23,9 +23,9 @@ namespace BansheeEditor
 	const UINT32 GUITabbedTitleBar::TAB_SPACING = 20;
 	const UINT32 GUITabbedTitleBar::OPTION_BTN_SPACING = 3;
 
-	GUITabbedTitleBar::GUITabbedTitleBar(GUIWidget& parent, RenderWindow* parentWindow, GUIElementStyle* backgroundStyle, GUIElementStyle* tabBtnStyle, 
+	GUITabbedTitleBar::GUITabbedTitleBar(RenderWindow* parentWindow, GUIElementStyle* backgroundStyle, GUIElementStyle* tabBtnStyle, 
 		GUIElementStyle* minBtnStyle, GUIElementStyle* closeBtnStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mParentWindow(parentWindow), mMinBtn(nullptr), 
+		:GUIElementContainer(layoutOptions), mParentWindow(parentWindow), mMinBtn(nullptr), 
 		mCloseBtn(nullptr), mBackgroundImage(nullptr), mUniqueTabIdx(0), mActiveTabIdx(0),
 		mDragInProgress(false), mDraggedBtn(nullptr), mDragBtnOffset(0), mInitialDragOffset(0), mBackgroundStyle(backgroundStyle),
 		mTabBtnStyle(tabBtnStyle), mMinimizeBtnStyle(minBtnStyle), mCloseBtnStyle(closeBtnStyle), mTempDraggedWidget(nullptr),
@@ -43,13 +43,13 @@ namespace BansheeEditor
 		if(mTabBtnStyle == nullptr)
 			mTabBtnStyle = parent.getSkin().getStyle("TabbedBarBtn");
 
-		mBackgroundImage = GUITexture::create(parent, mBackgroundStyle);
+		mBackgroundImage = GUITexture::create(mBackgroundStyle);
 		_registerChildElement(mBackgroundImage);
 
-		mMinBtn = GUIButton::create(parent, HString(L""), mMinimizeBtnStyle);
+		mMinBtn = GUIButton::create(HString(L""), mMinimizeBtnStyle);
 		_registerChildElement(mMinBtn);
 
-		mCloseBtn = GUIButton::create(parent, HString(L""), mCloseBtnStyle);
+		mCloseBtn = GUIButton::create(HString(L""), mCloseBtnStyle);
 		_registerChildElement(mCloseBtn);
 
 		mCloseBtn->onClick.connect(std::bind(&GUITabbedTitleBar::tabClosed, this));
@@ -62,23 +62,23 @@ namespace BansheeEditor
 
 	}
 
-	GUITabbedTitleBar* GUITabbedTitleBar::create(GUIWidget& parent, RenderWindow* parentWindow, GUIElementStyle* backgroundStyle, 
+	GUITabbedTitleBar* GUITabbedTitleBar::create(RenderWindow* parentWindow, GUIElementStyle* backgroundStyle, 
 		GUIElementStyle* tabBtnStyle, GUIElementStyle* minBtnStyle, GUIElementStyle* closeBtnStyle)
 	{
-		return new (cm_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(parent, parentWindow, backgroundStyle, tabBtnStyle, 
+		return new (cm_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(parentWindow, backgroundStyle, tabBtnStyle, 
 			minBtnStyle, closeBtnStyle, GUILayoutOptions::create(&GUISkin::DefaultStyle));
 	}
 
-	GUITabbedTitleBar* GUITabbedTitleBar::create(GUIWidget& parent, RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions)
+	GUITabbedTitleBar* GUITabbedTitleBar::create(RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions)
 	{
-		return new (cm_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(parent, parentWindow, nullptr, nullptr, 
+		return new (cm_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(parentWindow, nullptr, nullptr, 
 			nullptr, nullptr, layoutOptions);
 	}
 
-	GUITabbedTitleBar* GUITabbedTitleBar::create(GUIWidget& parent, RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions, 
+	GUITabbedTitleBar* GUITabbedTitleBar::create(RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions, 
 		GUIElementStyle* backgroundStyle, GUIElementStyle* tabBtnStyle, GUIElementStyle* minBtnStyle, GUIElementStyle* closeBtnStyle)
 	{
-		return new (cm_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(parent, parentWindow, backgroundStyle, tabBtnStyle, 
+		return new (cm_alloc<GUITabbedTitleBar, PoolAlloc>()) GUITabbedTitleBar(parentWindow, backgroundStyle, tabBtnStyle, 
 			minBtnStyle, closeBtnStyle, layoutOptions);
 	}
 
@@ -89,7 +89,7 @@ namespace BansheeEditor
 
 	UINT32 GUITabbedTitleBar::insertTab(UINT32 position, const CM::HString& name)
 	{
-		GUITabButton* newTabToggle = GUITabButton::create(*mParent, mTabToggleGroup, mUniqueTabIdx, name, mTabBtnStyle);
+		GUITabButton* newTabToggle = GUITabButton::create(mTabToggleGroup, mUniqueTabIdx, name, mTabBtnStyle);
 		_registerChildElement(newTabToggle);
 
 		position = Math::clamp(position, 0U, (UINT32)mTabButtons.size());

+ 3 - 8
BansheeEditor/Source/BsGUITextField.cpp

@@ -13,16 +13,11 @@ using namespace BansheeEngine;
 
 namespace BansheeEditor
 {
-	GUITextField::GUITextField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, CM::UINT32 labelWidth, 
+	GUITextField::GUITextField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, CM::UINT32 labelWidth, 
 		GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr)
+		:TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mInputBox(nullptr)
 	{
-		const GUIElementStyle* curInputBoxStyle = inputBoxStyle;
-
-		if(curInputBoxStyle == nullptr)
-			curInputBoxStyle = parent.getSkin().getStyle("InputBox");
-
-		mInputBox = GUIInputBox::create(parent, false, inputBoxStyle);
+		mInputBox = GUIInputBox::create(false, inputBoxStyle);
 		mLayout->addElement(mInputBox);
 	}
 

+ 3 - 8
BansheeEditor/Source/BsGUIToggleField.cpp

@@ -13,16 +13,11 @@ using namespace BansheeEngine;
 
 namespace BansheeEditor
 {
-	GUIToggleField::GUIToggleField(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
+	GUIToggleField::GUIToggleField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
 		UINT32 labelWidth, GUIElementStyle* labelStyle, GUIElementStyle* toggleStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mToggle(nullptr)
+		:TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mToggle(nullptr)
 	{
-		const GUIElementStyle* curToggleStyle = toggleStyle;
-
-		if(curToggleStyle == nullptr)
-			curToggleStyle = parent.getSkin().getStyle("Toggle");
-
-		mToggle = GUIToggle::create(parent, HString(L""), curToggleStyle);
+		mToggle = GUIToggle::create(HString(L""), toggleStyle);
 		mLayout->addElement(mToggle);
 	}
 

+ 9 - 9
BansheeEditor/Source/BsGUITreeView.cpp

@@ -82,10 +82,10 @@ namespace BansheeEditor
 		return nullptr;
 	}
 
-	GUITreeView::GUITreeView(GUIWidget& parent, GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
+	GUITreeView::GUITreeView(GUIElementStyle* backgroundStyle, GUIElementStyle* elementBtnStyle, 
 		GUIElementStyle* foldoutBtnStyle, GUIElementStyle* selectionBackgroundStyle, GUIElementStyle* editBoxStyle, 
 		BS::GUIElementStyle* dragHighlightStyle, BS::GUIElementStyle* dragSepHighlightStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mBackgroundStyle(backgroundStyle),
+		:GUIElementContainer(layoutOptions), mBackgroundStyle(backgroundStyle),
 		mElementBtnStyle(elementBtnStyle), mFoldoutBtnStyle(foldoutBtnStyle), mEditBoxStyle(editBoxStyle), mEditElement(nullptr), mIsElementSelected(false),
 		mNameEditBox(nullptr), mSelectionBackgroundStyle(selectionBackgroundStyle), mDragInProgress(nullptr), mDragHighlightStyle(dragHighlightStyle),
 		mDragSepHighlightStyle(dragSepHighlightStyle), mDragHighlight(nullptr), mDragSepHighlight(nullptr), mMouseOverDragElement(nullptr), mMouseOverDragElementTime(0.0f),
@@ -112,15 +112,15 @@ namespace BansheeEditor
 		if(mDragSepHighlightStyle == nullptr)
 			mDragSepHighlightStyle = parent.getSkin().getStyle("TreeViewElementSepHighlight");
 
-		mBackgroundImage = GUITexture::create(parent, mBackgroundStyle);
-		mNameEditBox = GUITreeViewEditBox::create(parent, mEditBoxStyle);
+		mBackgroundImage = GUITexture::create(mBackgroundStyle);
+		mNameEditBox = GUITreeViewEditBox::create(mEditBoxStyle);
 		mNameEditBox->disableRecursively();
 
 		mNameEditBox->onInputConfirmed.connect(std::bind(&GUITreeView::onEditAccepted, this));
 		mNameEditBox->onInputCanceled.connect(std::bind(&GUITreeView::onEditCanceled, this));
 
-		mDragHighlight = GUITexture::create(parent, mDragHighlightStyle);
-		mDragSepHighlight = GUITexture::create(parent, mDragSepHighlightStyle);
+		mDragHighlight = GUITexture::create(mDragHighlightStyle);
+		mDragSepHighlight = GUITexture::create(mDragSepHighlightStyle);
 
 		mDragHighlight->disableRecursively();
 		mDragSepHighlight->disableRecursively();
@@ -498,7 +498,7 @@ namespace BansheeEditor
 
 		if(iterFind == mSelectedElements.end())
 		{
-			GUITexture* background = GUITexture::create(_getParentWidget(), mSelectionBackgroundStyle);
+			GUITexture* background = GUITexture::create(mSelectionBackgroundStyle);
 			_registerChildElement(background);
 
 			element->mIsSelected = true;
@@ -613,7 +613,7 @@ namespace BansheeEditor
 			HString name(toWString(element->mName));
 			if(element->mElement == nullptr)
 			{
-				element->mElement = GUILabel::create(_getParentWidget(), name, mElementBtnStyle);
+				element->mElement = GUILabel::create(name, mElementBtnStyle);
 				_registerChildElement(element->mElement);
 			}
 
@@ -621,7 +621,7 @@ namespace BansheeEditor
 			{
 				if(element->mFoldoutBtn == nullptr)
 				{
-					element->mFoldoutBtn = GUIToggle::create(_getParentWidget(), GUIContent(HString(L"")), mFoldoutBtnStyle);
+					element->mFoldoutBtn = GUIToggle::create(GUIContent(HString(L"")), mFoldoutBtnStyle);
 					_registerChildElement(element->mFoldoutBtn);
 
 					element->mFoldoutBtn->onToggled.connect(std::bind(&GUITreeView::elementToggled, this, element, _1));

+ 6 - 18
BansheeEditor/Source/BsGUITreeViewEditBox.cpp

@@ -14,30 +14,18 @@ namespace BansheeEditor
 		return name;
 	}
 
-	GUITreeViewEditBox* GUITreeViewEditBox::create(BS::GUIWidget& parent, const BS::GUIElementStyle* style)
+	GUITreeViewEditBox* GUITreeViewEditBox::create(const BS::GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(parent, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(style, GUILayoutOptions::create(style));
 	}
 
-	GUITreeViewEditBox* GUITreeViewEditBox::create(BS::GUIWidget& parent, const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style)
+	GUITreeViewEditBox* GUITreeViewEditBox::create(const BS::GUIOptions& layoutOptions, const BS::GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(parent, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUITreeViewEditBox, PoolAlloc>()) GUITreeViewEditBox(style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUITreeViewEditBox::GUITreeViewEditBox(BS::GUIWidget& parent, const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions)
-		:GUIInputBox(parent, style, layoutOptions, false)
+	GUITreeViewEditBox::GUITreeViewEditBox(const BS::GUIElementStyle* style, const BS::GUILayoutOptions& layoutOptions)
+		:GUIInputBox(style, layoutOptions, false)
 	{
 
 	}

+ 4 - 4
BansheeEditor/Source/BsGUIVector2Field.cpp

@@ -15,12 +15,12 @@ namespace BansheeEditor
 {
 	const UINT32 GUIVector2Field::ELEMENT_LABEL_WIDTH = 10;
 
-	GUIVector2Field::GUIVector2Field(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
+	GUIVector2Field::GUIVector2Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
 		CM::UINT32 labelWidth, GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mFieldX(nullptr), mFieldY(nullptr)
+		:TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mFieldX(nullptr), mFieldY(nullptr)
 	{
-		mFieldX = GUIFloatField::create(parent, HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
-		mFieldY = GUIFloatField::create(parent, HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldX = GUIFloatField::create(HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
 
 		mLayout->removeElement(mLabel);
 

+ 5 - 5
BansheeEditor/Source/BsGUIVector3Field.cpp

@@ -15,13 +15,13 @@ namespace BansheeEditor
 {
 	const UINT32 GUIVector3Field::ELEMENT_LABEL_WIDTH = 10;
 
-	GUIVector3Field::GUIVector3Field(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
+	GUIVector3Field::GUIVector3Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
 		CM::UINT32 labelWidth, GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mFieldX(nullptr), mFieldY(nullptr)
+		:TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mFieldX(nullptr), mFieldY(nullptr)
 	{
-		mFieldX = GUIFloatField::create(parent, HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
-		mFieldY = GUIFloatField::create(parent, HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
-		mFieldZ = GUIFloatField::create(parent, HString(L"Z"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldX = GUIFloatField::create(HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldZ = GUIFloatField::create(HString(L"Z"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
 
 		mLayout->removeElement(mLabel);
 

+ 6 - 6
BansheeEditor/Source/BsGUIVector4Field.cpp

@@ -15,14 +15,14 @@ namespace BansheeEditor
 {
 	const UINT32 GUIVector4Field::ELEMENT_LABEL_WIDTH = 10;
 
-	GUIVector4Field::GUIVector4Field(const PrivatelyConstruct& dummy, GUIWidget& parent, const GUIContent& labelContent, 
+	GUIVector4Field::GUIVector4Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
 		CM::UINT32 labelWidth, GUIElementStyle* labelStyle, GUIElementStyle* inputBoxStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
-		:TGUIField(dummy, parent, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mFieldX(nullptr), mFieldY(nullptr)
+		:TGUIField(dummy, labelContent, labelWidth, labelStyle, layoutOptions, withLabel), mFieldX(nullptr), mFieldY(nullptr)
 	{
-		mFieldX = GUIFloatField::create(parent, HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
-		mFieldY = GUIFloatField::create(parent, HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
-		mFieldZ = GUIFloatField::create(parent, HString(L"Z"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
-		mFieldW = GUIFloatField::create(parent, HString(L"W"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldX = GUIFloatField::create(HString(L"X"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldY = GUIFloatField::create(HString(L"Y"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldZ = GUIFloatField::create(HString(L"Z"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
+		mFieldW = GUIFloatField::create(HString(L"W"), ELEMENT_LABEL_WIDTH, labelStyle, inputBoxStyle);
 
 		mLayout->removeElement(mLabel);
 

+ 6 - 18
BansheeEditor/Source/BsGUIWindowDropArea.cpp

@@ -18,33 +18,21 @@ namespace BansheeEditor
 		return name;
 	}
 
-	GUIWindowDropArea::GUIWindowDropArea(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUITexture(parent, style, HSpriteTexture(), GUIImageScaleMode::ScaleToFit, layoutOptions)
+	GUIWindowDropArea::GUIWindowDropArea(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUITexture(style, HSpriteTexture(), GUIImageScaleMode::ScaleToFit, layoutOptions)
 	{ }
 
 	GUIWindowDropArea::~GUIWindowDropArea()
 	{ }
 
-	GUIWindowDropArea* GUIWindowDropArea::create(GUIWidget& parent, const GUIElementStyle* style)
+	GUIWindowDropArea* GUIWindowDropArea::create(const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIWindowDropArea, PoolAlloc>()) GUIWindowDropArea(parent, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIWindowDropArea, PoolAlloc>()) GUIWindowDropArea(style, GUILayoutOptions::create(style));
 	}
 
-	GUIWindowDropArea* GUIWindowDropArea::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIWindowDropArea* GUIWindowDropArea::create(const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIWindowDropArea, PoolAlloc>()) GUIWindowDropArea(parent, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIWindowDropArea, PoolAlloc>()) GUIWindowDropArea(style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	void GUIWindowDropArea::setFocused(bool focused)

+ 6 - 18
BansheeEditor/Source/BsGUIWindowFrame.cpp

@@ -21,8 +21,8 @@ namespace BansheeEditor
 		return name;
 	}
 
-	GUIWindowFrame::GUIWindowFrame(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUITexture(parent, style, HSpriteTexture(), GUIImageScaleMode::StretchToFit, layoutOptions)
+	GUIWindowFrame::GUIWindowFrame(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUITexture(style, HSpriteTexture(), GUIImageScaleMode::StretchToFit, layoutOptions)
 	{
 
 	}
@@ -30,26 +30,14 @@ namespace BansheeEditor
 	GUIWindowFrame::~GUIWindowFrame()
 	{ }
 
-	GUIWindowFrame* GUIWindowFrame::create(GUIWidget& parent, const GUIElementStyle* style)
+	GUIWindowFrame* GUIWindowFrame::create(const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(parent, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(style, GUILayoutOptions::create(style));
 	}
 
-	GUIWindowFrame* GUIWindowFrame::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIWindowFrame* GUIWindowFrame::create(const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(parent, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIWindowFrame, PoolAlloc>()) GUIWindowFrame(style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	void GUIWindowFrame::setFocused(bool focused)

+ 2 - 2
BansheeEditor/Source/BsGUIWindowFrameWidget.cpp

@@ -22,12 +22,12 @@ namespace BansheeEditor
 		setSkin(skin);
 
 		GUIArea* backgroundArea = GUIArea::createStretchedXY(*this, 0, 0, 0, 0, 500);
-		backgroundArea->getLayout().addElement(GUITexture::create(*this, GUIImageScaleMode::RepeatToFit, 
+		backgroundArea->getLayout().addElement(GUITexture::create(GUIImageScaleMode::RepeatToFit, 
 			GUIOptions(GUIOption::flexibleWidth(), GUIOption::flexibleHeight()), getSkin().getStyle("WindowBackground")));
 
 		mWindowFrameArea = GUIArea::createStretchedXY(*this, 0, 0, 0, 0, 499);
 
-		mWindowFrame = GUIWindowFrame::create(*this, getSkin().getStyle("WindowFrame"));
+		mWindowFrame = GUIWindowFrame::create(getSkin().getStyle("WindowFrame"));
 		mWindowFrameArea->getLayout().addElement(mWindowFrame);
 
 		refreshNonClientAreas();

+ 1 - 1
BansheeEditor/Source/BsMainEditorWindow.cpp

@@ -31,7 +31,7 @@ namespace BansheeEditor
 		:EditorWindowBase(renderWindow), mDockManager(nullptr), 
 		mMenuBar(cm_new<GUIMenuBar>(mGUI.get(), mRenderWindow.get()))
 	{
-		mDockManager = DockManager::create(*mGUI.get(), mRenderWindow.get());
+		mDockManager = DockManager::create(mRenderWindow.get());
 
 		updateAreas();
 

+ 4 - 4
BansheeEditor/Source/DbgEditorWidget1.cpp

@@ -26,7 +26,7 @@ namespace BansheeEditor
 		//layout.addElement(GUIInputBox::create(*mGUI));
 		//layout.addElement(GUIInputBox::create(*mGUI, GUILayoutOptions::fixed(100, 100), true));
 
-		GUIScrollArea* scrollArea = GUIScrollArea::create(getParentWidget());
+		GUIScrollArea* scrollArea = GUIScrollArea::create();
 		layout.addElement(scrollArea);
 
 		GUILayout& scrollLayout = scrollArea->getLayout().addLayoutX();
@@ -44,9 +44,9 @@ namespace BansheeEditor
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test K"));
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test L"));
 
-		scrollLayout.addElement(GUIInputBox::create(getParentWidget(), true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
-		scrollLayout.addElement(GUIInputBox::create(getParentWidget(), true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
-		scrollLayout.addElement(GUIInputBox::create(getParentWidget(), true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
+		scrollLayout.addElement(GUIInputBox::create(true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
+		scrollLayout.addElement(GUIInputBox::create(true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
+		scrollLayout.addElement(GUIInputBox::create(true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
 
 		//GUIFlexibleSpace& space4 = otherLayout.addFlexibleSpace();
 		//otherLayout.addElement(mDbgLabel);

+ 11 - 11
BansheeEditor/Source/DbgEditorWidget2.cpp

@@ -32,19 +32,19 @@ namespace BansheeEditor
 	{
 		GUILayout& layout = mContent->getLayout().addLayoutY();
 
-		GUIIntField* intField = GUIIntField::create(getParentWidget(), GUIContent(HString(L"Int Field")), 100, GUIOptions(GUIOption::fixedWidth(200)));
-		GUIFloatField* floatField = GUIFloatField::create(getParentWidget(), HString(L"Float Field"), GUIOptions(GUIOption::fixedWidth(200)));
-		GUITextField* textField = GUITextField::create(getParentWidget(), HString(L"Text Field"), GUIOptions(GUIOption::fixedWidth(200)));
-		GUIVector4Field* vec4Field = GUIVector4Field::create(getParentWidget(), HString(L"Vec4 Field"), GUIOptions(GUIOption::fixedWidth(200)));
-		GUIVector3Field* vec3Field = GUIVector3Field::create(getParentWidget(), HString(L"Vec3 Field"), GUIOptions(GUIOption::fixedWidth(200)));
-		GUIVector2Field* vec2Field = GUIVector2Field::create(getParentWidget(), HString(L"Vec2 Field"), GUIOptions(GUIOption::fixedWidth(200)));
-		GUIToggleField* toggleField = GUIToggleField::create(getParentWidget(), HString(L"Toggle Field"), GUIOptions(GUIOption::fixedWidth(200)));
-		GUIColorField* colorField = GUIColorField::create(getParentWidget(), HString(L"Color Field"), GUIOptions(GUIOption::fixedWidth(200)));
-		GUIFoldout* foldout = GUIFoldout::create(getParentWidget(), GUIOptions(GUIOption::fixedWidth(200)));
-		GUIGameObjectField* gameObjectField = GUIGameObjectField::create(getParentWidget(), HString(L"Object Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIIntField* intField = GUIIntField::create(GUIContent(HString(L"Int Field")), 100, GUIOptions(GUIOption::fixedWidth(200)));
+		GUIFloatField* floatField = GUIFloatField::create(HString(L"Float Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUITextField* textField = GUITextField::create(HString(L"Text Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIVector4Field* vec4Field = GUIVector4Field::create(HString(L"Vec4 Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIVector3Field* vec3Field = GUIVector3Field::create(HString(L"Vec3 Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIVector2Field* vec2Field = GUIVector2Field::create(HString(L"Vec2 Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIToggleField* toggleField = GUIToggleField::create(HString(L"Toggle Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIColorField* colorField = GUIColorField::create(HString(L"Color Field"), GUIOptions(GUIOption::fixedWidth(200)));
+		GUIFoldout* foldout = GUIFoldout::create(GUIOptions(GUIOption::fixedWidth(200)));
+		GUIGameObjectField* gameObjectField = GUIGameObjectField::create(HString(L"Object Field"), GUIOptions(GUIOption::fixedWidth(200)));
 		colorField->setValue(Color::Red);
 
-		GUIButton* button = GUIButton::create(getParentWidget(), HString(L"Testing"), GUIOptions(GUIOption::fixedWidth(100)));
+		GUIButton* button = GUIButton::create(HString(L"Testing"), GUIOptions(GUIOption::fixedWidth(100)));
 
 		layout.addElement(intField);
 		layout.addElement(floatField);

+ 0 - 1
BansheeEngine/BansheeEngine.vcxproj

@@ -248,7 +248,6 @@
     <ClInclude Include="Include\BsGUIDropDownBoxManager.h" />
     <ClInclude Include="Include\BsGUIDropDownHitBox.h" />
     <ClInclude Include="Include\BsGUIElementContainer.h" />
-    <ClInclude Include="Include\BsGUIFoldout.h" />
     <ClInclude Include="Include\BsGUIHelper.h" />
     <ClInclude Include="Include\BsGUIListBox.h" />
     <ClInclude Include="Include\BsGUIElementBase.h" />

+ 0 - 3
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -267,9 +267,6 @@
     <ClInclude Include="Include\BsBuiltinResources.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsGUIFoldout.h">
-      <Filter>Header Files\GUI</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsEnums.h">
       <Filter>Header Files</Filter>
     </ClInclude>

+ 5 - 5
BansheeEngine/Include/BsGUIButton.h

@@ -14,14 +14,14 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIButton* create(GUIWidget& parent, const CM::HString& text, const GUIElementStyle* style = nullptr);
-		static GUIButton* create(GUIWidget& parent, const CM::HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIButton* create(const CM::HString& text, const GUIElementStyle* style = nullptr);
+		static GUIButton* create(const CM::HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
-		static GUIButton* create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style = nullptr);
-		static GUIButton* create(GUIWidget& parent, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIButton* create(const GUIContent& content, const GUIElementStyle* style = nullptr);
+		static GUIButton* create(const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 		virtual ElementType getElementType() const { return ElementType::Button; }
 	private:
-		GUIButton(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
+		GUIButton(const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
 	};
 }

+ 1 - 1
BansheeEngine/Include/BsGUIButtonBase.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 		boost::signal<void()> onHover;
 		boost::signal<void()> onOut;
 	protected:
-		GUIButtonBase(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
+		GUIButtonBase(const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
 		virtual ~GUIButtonBase();
 
 		/**

+ 3 - 3
BansheeEngine/Include/BsGUIDropDownHitBox.h

@@ -10,8 +10,8 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIDropDownHitBox* create(GUIWidget& parent, bool captureMouse, const GUIElementStyle* style = nullptr);
-		static GUIDropDownHitBox* create(GUIWidget& parent, bool captureMouse, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIDropDownHitBox* create(bool captureMouse, const GUIElementStyle* style = nullptr);
+		static GUIDropDownHitBox* create(bool captureMouse, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 		void setBounds(const CM::RectI& bounds) { mBounds.clear(); mBounds.push_back(bounds); }
 		void setBounds(const CM::Vector<CM::RectI>::type& bounds) { mBounds = bounds; }
@@ -20,7 +20,7 @@ namespace BansheeEngine
 		boost::signal<void()> onFocusGained;
 
 	private:
-		GUIDropDownHitBox(GUIWidget& parent, bool captureMouse, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
+		GUIDropDownHitBox(bool captureMouse, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 
 		virtual bool commandEvent(const GUICommandEvent& ev);
 		virtual bool mouseEvent(const GUIMouseEvent& ev);

+ 1 - 3
BansheeEngine/Include/BsGUIElement.h

@@ -25,7 +25,7 @@ namespace BansheeEngine
 		};
 
 	public:
-		GUIElement(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
+		GUIElement(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 		virtual ~GUIElement();
 
 		/**
@@ -130,7 +130,6 @@ namespace BansheeEngine
 		const CM::RectI& _getClipRect() const { return mClipRect; }
 		const RectOffset& _getPadding() const;
 		CM::UINT32 _getDepth() const { return mDepth; }
-		GUIWidget& _getParentWidget() const { return *mParent; }
 		virtual bool _isInBounds(const CM::Vector2I position) const;
 		virtual bool _hasCustomCursor(const CM::Vector2I position, CursorType& type) const { return false; }
 		virtual bool _acceptDragAndDrop(const CM::Vector2I position, CM::UINT32 typeId) const { return false; }
@@ -160,7 +159,6 @@ namespace BansheeEngine
 		CM::RectI getContentBounds() const;
 		CM::RectI getContentClipRect() const;
 
-		GUIWidget* mParent;
 		bool mIsDestroyed;
 		GUILayoutOptions mLayoutOptions;
 		CM::RectI mClippedBounds;

+ 3 - 1
BansheeEngine/Include/BsGUIElementBase.h

@@ -47,12 +47,13 @@ namespace BansheeEngine
 		virtual void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
 			CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 
-		void _setParent(GUIElementBase* parent) { mParentElement = parent; }
+		void _setParent(GUIElementBase* parent);
 
 		virtual CM::Vector2I _getOptimalSize() const = 0;
 		virtual const RectOffset& _getPadding() const = 0;
 		virtual Type _getType() const = 0;
 		GUIElementBase* _getParent() const { return mParentElement; }
+		GUIWidget* _getParentWidget() const { return mParentWidget; }
 
 		void _markAsClean() { mIsDirty = 0; }
 
@@ -83,6 +84,7 @@ namespace BansheeEngine
 		GUILayout& insertLayoutXInternal(GUIElementBase* parent, CM::UINT32 idx);
 		GUILayout& insertLayoutYInternal(GUIElementBase* parent, CM::UINT32 idx);
 
+		GUIWidget* mParentWidget;
 		GUIElementBase* mParentElement;
 		CM::Vector<GUIElementBase*>::type mChildren;	
 		CM::UINT8 mIsDirty;

+ 1 - 1
BansheeEngine/Include/BsGUIElementContainer.h

@@ -8,7 +8,7 @@ namespace BansheeEngine
 	class BS_EXPORT GUIElementContainer : public BS::GUIElement
 	{
 	protected:
-		GUIElementContainer(BS::GUIWidget& parent, const BS::GUILayoutOptions& layoutOptions);
+		GUIElementContainer(const BS::GUILayoutOptions& layoutOptions);
 		virtual ~GUIElementContainer();
 
 		/**

+ 0 - 56
BansheeEngine/Include/BsGUIFoldout.h

@@ -1,56 +0,0 @@
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsGUIElementContainer.h"
-
-namespace BansheeEditor
-{
-	class BS_ED_EXPORT GUIColorField : public BS::GUIElementContainer
-	{
-		struct PrivatelyConstruct {};
-
-	public:
-		static const CM::String& getGUITypeName();
-
-		static GUIColorField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
-
-		static GUIColorField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
-
-		static GUIColorField* create(BS::GUIWidget& parent, 
-			const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
-
-		static GUIColorField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
-
-		static GUIColorField* create(BS::GUIWidget& parent, const CM::HString& labelText, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
-
-		static GUIColorField* create(BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* toggleStyle = nullptr);
-
-		GUIColorField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* toggleStyle, const BS::GUILayoutOptions& layoutOptions);
-
-		GUIColorField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, 
-			BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* toggleStyle, const BS::GUILayoutOptions& layoutOptions);
-
-		CM::Color getValue() const;
-		void setValue(const CM::Color& value);
-
-		void setLabelWidth(CM::UINT32 width);
-
-		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
-			CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
-
-		CM::Vector2I _getOptimalSize() const;
-	protected:
-		virtual ~GUIColorField();
-
-	protected:
-		CM::UINT32 mLabelWidth;
-		BS::GUILabel* mLabel;
-		GUIColor* mColor;
-	};
-}

+ 4 - 4
BansheeEngine/Include/BsGUIInputBox.h

@@ -13,9 +13,9 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIInputBox* create(GUIWidget& parent, bool multiline = false, const GUIElementStyle* style = nullptr);
-		static GUIInputBox* create(GUIWidget& parent, bool multiline, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
-		static GUIInputBox* create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIInputBox* create(bool multiline = false, const GUIElementStyle* style = nullptr);
+		static GUIInputBox* create(bool multiline, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIInputBox* create(const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 		const CM::WString& getText() const { return mText; }
 		void setText(const CM::WString& text);
@@ -26,7 +26,7 @@ namespace BansheeEngine
 
 		virtual CM::Vector2I _getOptimalSize() const;
 	protected:
-		GUIInputBox(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions, bool multiline);
+		GUIInputBox(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions, bool multiline);
 		virtual ~GUIInputBox();
 
 		/**

+ 5 - 5
BansheeEngine/Include/BsGUILabel.h

@@ -12,11 +12,11 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUILabel* create(GUIWidget& parent, const CM::HString& text, const GUIElementStyle* style = nullptr);
-		static GUILabel* create(GUIWidget& parent, const CM::HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUILabel* create(const CM::HString& text, const GUIElementStyle* style = nullptr);
+		static GUILabel* create(const CM::HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
-		static GUILabel* create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style = nullptr);
-		static GUILabel* create(GUIWidget& parent, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUILabel* create(const GUIContent& content, const GUIElementStyle* style = nullptr);
+		static GUILabel* create(const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 		void setContent(const GUIContent& content);
 
@@ -62,6 +62,6 @@ namespace BansheeEngine
 
 		TEXT_SPRITE_DESC mDesc;
 		
-		GUILabel(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
+		GUILabel(const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
 	};
 }

+ 3 - 3
BansheeEngine/Include/BsGUIListBox.h

@@ -13,8 +13,8 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIListBox* create(GUIWidget& parent, const CM::Vector<CM::HString>::type& elements, const GUIElementStyle* style = nullptr);
-		static GUIListBox* create(GUIWidget& parent, const CM::Vector<CM::HString>::type& elements, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIListBox* create(const CM::Vector<CM::HString>::type& elements, const GUIElementStyle* style = nullptr);
+		static GUIListBox* create(const CM::Vector<CM::HString>::type& elements, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 		void setElements(const CM::Vector<CM::HString>::type& elements);
 
@@ -29,7 +29,7 @@ namespace BansheeEngine
 		CM::Vector<CM::HString>::type mElements;
 		bool mIsListBoxOpen;
 
-		GUIListBox(GUIWidget& parent, const GUIElementStyle* style, const CM::Vector<CM::HString>::type& elements, const GUILayoutOptions& layoutOptions);
+		GUIListBox(const GUIElementStyle* style, const CM::Vector<CM::HString>::type& elements, const GUILayoutOptions& layoutOptions);
 
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 

+ 3 - 3
BansheeEngine/Include/BsGUIRenderTexture.h

@@ -16,13 +16,13 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIRenderTexture* create(GUIWidget& parent, const CM::RenderTexturePtr& texture, const GUIElementStyle* style = nullptr);
-		static GUIRenderTexture* create(GUIWidget& parent, const CM::RenderTexturePtr& texture, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIRenderTexture* create(const CM::RenderTexturePtr& texture, const GUIElementStyle* style = nullptr);
+		static GUIRenderTexture* create(const CM::RenderTexturePtr& texture, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 	protected:
 		const CM::RenderTexture* mSourceTexture;
 
-		GUIRenderTexture(GUIWidget& parent, const GUIElementStyle* style, const CM::RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions);
+		GUIRenderTexture(const GUIElementStyle* style, const CM::RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions);
 		virtual ~GUIRenderTexture();
 
 		/**

+ 5 - 5
BansheeEngine/Include/BsGUIScrollArea.h

@@ -17,16 +17,16 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIScrollArea* create(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
+		static GUIScrollArea* create(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			const GUIElementStyle* scrollBarStyle = nullptr, const GUIElementStyle* scrollAreaStyle = nullptr);
 
-		static GUIScrollArea* create(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
+		static GUIScrollArea* create(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			const GUIOptions& layoutOptions, const GUIElementStyle* scrollBarStyle = nullptr, 
 			const GUIElementStyle* scrollAreaStyle = nullptr);
 
-		static GUIScrollArea* create(GUIWidget& parent, const GUIElementStyle* scrollBarStyle = nullptr, const GUIElementStyle* scrollAreaStyle = nullptr);
+		static GUIScrollArea* create(const GUIElementStyle* scrollBarStyle = nullptr, const GUIElementStyle* scrollAreaStyle = nullptr);
 
-		static GUIScrollArea* create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* scrollBarStyle = nullptr, 
+		static GUIScrollArea* create(const GUIOptions& layoutOptions, const GUIElementStyle* scrollBarStyle = nullptr, 
 			const GUIElementStyle* scrollAreaStyle = nullptr);
 
 		virtual ElementType getElementType() const { return ElementType::ScrollArea; }
@@ -52,7 +52,7 @@ namespace BansheeEngine
 		 */
 		virtual void updateClippedBounds();
 	private:
-		GUIScrollArea(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
+		GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle, const GUILayoutOptions& layoutOptions);
 
 		ScrollBarType mVertBarType;

+ 1 - 1
BansheeEngine/Include/BsGUIScrollBar.h

@@ -28,7 +28,7 @@ namespace BansheeEngine
 
 		virtual CM::Vector2I _getOptimalSize() const;
 	protected:
-		GUIScrollBar(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
+		GUIScrollBar(bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 		virtual ~GUIScrollBar();
 
 		/**

+ 3 - 3
BansheeEngine/Include/BsGUIScrollBarHandle.h

@@ -12,8 +12,8 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIScrollBarHandle* create(GUIWidget& parent, bool horizontal, const GUIElementStyle* style = nullptr);
-		static GUIScrollBarHandle* create(GUIWidget& parent, bool horizontal, const GUIOptions& layoutOptions, 
+		static GUIScrollBarHandle* create(bool horizontal, const GUIElementStyle* style = nullptr);
+		static GUIScrollBarHandle* create(bool horizontal, const GUIOptions& layoutOptions, 
 			const GUIElementStyle* style = nullptr);
 
 		void setHandleSize(CM::UINT32 size);
@@ -70,7 +70,7 @@ namespace BansheeEngine
 		bool mMouseOverHandle;
 		bool mHandleDragged;
 
-		GUIScrollBarHandle(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
+		GUIScrollBarHandle(bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 		bool isOnHandle(const CM::Vector2I& pos) const;

+ 3 - 3
BansheeEngine/Include/BsGUIScrollBarHorz.h

@@ -12,10 +12,10 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIScrollBarHorz* create(GUIWidget& parent, const GUIElementStyle* style = nullptr);
-		static GUIScrollBarHorz* create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIScrollBarHorz* create(const GUIElementStyle* style = nullptr);
+		static GUIScrollBarHorz* create(const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 	protected:
-		GUIScrollBarHorz(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
+		GUIScrollBarHorz(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 		~GUIScrollBarHorz();
 	};
 }

+ 3 - 3
BansheeEngine/Include/BsGUIScrollBarVert.h

@@ -12,10 +12,10 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIScrollBarVert* create(GUIWidget& parent, const GUIElementStyle* style = nullptr);
-		static GUIScrollBarVert* create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIScrollBarVert* create(const GUIElementStyle* style = nullptr);
+		static GUIScrollBarVert* create(const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 	protected:
-		GUIScrollBarVert(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
+		GUIScrollBarVert(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 		~GUIScrollBarVert();
 	};
 }

+ 9 - 9
BansheeEngine/Include/BsGUITexture.h

@@ -19,21 +19,21 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUITexture* create(GUIWidget& parent, const HSpriteTexture& texture, GUIImageScaleMode scale, 
+		static GUITexture* create(const HSpriteTexture& texture, GUIImageScaleMode scale, 
 			const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
-		static GUITexture* create(GUIWidget& parent, const HSpriteTexture& texture, GUIImageScaleMode scale, 
+		static GUITexture* create(const HSpriteTexture& texture, GUIImageScaleMode scale, 
 			const GUIElementStyle* style = nullptr);
 
-		static GUITexture* create(GUIWidget& parent, const HSpriteTexture& texture, 
+		static GUITexture* create(const HSpriteTexture& texture, 
 			const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
-		static GUITexture* create(GUIWidget& parent, const HSpriteTexture& texture, const GUIElementStyle* style = nullptr);
+		static GUITexture* create(const HSpriteTexture& texture, const GUIElementStyle* style = nullptr);
 
 		
-		static GUITexture* create(GUIWidget& parent, GUIImageScaleMode scale, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
-		static GUITexture* create(GUIWidget& parent, GUIImageScaleMode scale, const GUIElementStyle* style = nullptr);
+		static GUITexture* create(GUIImageScaleMode scale, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUITexture* create(GUIImageScaleMode scale, const GUIElementStyle* style = nullptr);
 
-		static GUITexture* create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
-		static GUITexture* create(GUIWidget& parent, const GUIElementStyle* style = nullptr);
+		static GUITexture* create(const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUITexture* create(const GUIElementStyle* style = nullptr);
 
 		void setTexture(const HSpriteTexture& texture);
 		
@@ -46,7 +46,7 @@ namespace BansheeEngine
 		IMAGE_SPRITE_DESC mDesc;
 		GUIImageScaleMode mScaleMode;
 
-		GUITexture(GUIWidget& parent, const GUIElementStyle* style, const HSpriteTexture& texture, GUIImageScaleMode scale, const GUILayoutOptions& layoutOptions);
+		GUITexture(const GUIElementStyle* style, const HSpriteTexture& texture, GUIImageScaleMode scale, const GUILayoutOptions& layoutOptions);
 		virtual ~GUITexture();
 
 		/**

+ 9 - 9
BansheeEngine/Include/BsGUIToggle.h

@@ -15,17 +15,17 @@ namespace BansheeEngine
 	public:
 		static const CM::String& getGUITypeName();
 
-		static GUIToggle* create(GUIWidget& parent, const CM::HString& text, const GUIElementStyle* style = nullptr);
-		static GUIToggle* create(GUIWidget& parent, const CM::HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const CM::HString& text, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const CM::HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 	
-		static GUIToggle* create(GUIWidget& parent, const CM::HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
-		static GUIToggle* create(GUIWidget& parent, const CM::HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const CM::HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const CM::HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
-		static GUIToggle* create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style = nullptr);
-		static GUIToggle* create(GUIWidget& parent, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const GUIContent& content, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
-		static GUIToggle* create(GUIWidget& parent, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
-		static GUIToggle* create(GUIWidget& parent, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 		static std::shared_ptr<GUIToggleGroup> createToggleGroup();
 
@@ -43,7 +43,7 @@ namespace BansheeEngine
 		virtual ~GUIToggle();
 
 	protected:
-		GUIToggle(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions);
+		GUIToggle(const GUIElementStyle* style, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions);
 
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 

+ 3 - 3
BansheeEngine/Include/BsGUIViewport.h

@@ -17,12 +17,12 @@ namespace BansheeEngine
 		/**
 		 * @note Render target used by the GUIWidget and Camera must be the same. 
 		 */
-		static GUIViewport* create(GUIWidget& parent, const HCamera& camera, float aspectRatio, CM::Degree fieldOfView, const GUIElementStyle* style = nullptr);
+		static GUIViewport* create(const HCamera& camera, float aspectRatio, CM::Degree fieldOfView, const GUIElementStyle* style = nullptr);
 
 		/**
 		 * @note Render target used by the GUIWidget and Camera must be the same. 
 		 */
-		static GUIViewport* create(GUIWidget& parent, const GUIOptions& layoutOptions, const HCamera& camera, 
+		static GUIViewport* create(const GUIOptions& layoutOptions, const HCamera& camera, 
 			float aspectRatio, CM::Degree fieldOfView, const GUIElementStyle* style = nullptr);
 
 		virtual CM::Vector2I _getOptimalSize() const;
@@ -67,6 +67,6 @@ namespace BansheeEngine
 		CM::Degree mFieldOfView;
 		CM::Radian mVerticalFOV;
 
-		GUIViewport(GUIWidget& parent, const GUIElementStyle* style, const HCamera& camera, float aspectRatio, CM::Degree fieldOfView, const GUILayoutOptions& layoutOptions);
+		GUIViewport(const GUIElementStyle* style, const HCamera& camera, float aspectRatio, CM::Degree fieldOfView, const GUILayoutOptions& layoutOptions);
 	};
 }

+ 1 - 0
BansheeEngine/Source/BsGUIArea.cpp

@@ -14,6 +14,7 @@ namespace BansheeEngine
 		mResizeXWithWidget(false), mResizeYWithWidget(false), mWidth(0), mHeight(0), mRight(0), mBottom(0)
 	{
 		mLayout = cm_new<GUILayoutX, PoolAlloc>();
+		mLayout->_changeParentWidget(widget);
 
 		mWidget->registerArea(this);
 	}

+ 10 - 22
BansheeEngine/Source/BsGUIButton.cpp

@@ -19,39 +19,27 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIButton::GUIButton(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
-		:GUIButtonBase(parent, style, content, layoutOptions)
+	GUIButton::GUIButton(const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+		:GUIButtonBase(style, content, layoutOptions)
 	{ }
 
-	GUIButton* GUIButton::create(GUIWidget& parent, const HString& text, const GUIElementStyle* style)
+	GUIButton* GUIButton::create(const HString& text, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), style);
+		return create(GUIContent(text), style);
 	}
 
-	GUIButton* GUIButton::create(GUIWidget& parent, const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIButton* GUIButton::create(const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), layoutOptions, style);
+		return create(GUIContent(text), layoutOptions, style);
 	}
 
-	GUIButton* GUIButton::create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style)
+	GUIButton* GUIButton::create(const GUIContent& content, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(parent, style, content, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(style, content, GUILayoutOptions::create(style));
 	}
 
-	GUIButton* GUIButton::create(GUIWidget& parent, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIButton* GUIButton::create(const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(parent, style, content, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(style, content, GUILayoutOptions::create(layoutOptions, style));
 	}
 }

+ 2 - 2
BansheeEngine/Source/BsGUIButtonBase.cpp

@@ -13,8 +13,8 @@ using namespace CamelotFramework;
 
 namespace BansheeEngine
 {
-	GUIButtonBase::GUIButtonBase(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mContent(content), mContentImageSprite(nullptr), mActiveState(GUIButtonState::Normal)
+	GUIButtonBase::GUIButtonBase(const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+		:GUIElement(style, layoutOptions), mContent(content), mContentImageSprite(nullptr), mActiveState(GUIButtonState::Normal)
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();

+ 6 - 18
BansheeEngine/Source/BsGUIDropDownHitBox.cpp

@@ -14,30 +14,18 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIDropDownHitBox* GUIDropDownHitBox::create(GUIWidget& parent, bool captureMouse, const GUIElementStyle* style)
+	GUIDropDownHitBox* GUIDropDownHitBox::create(bool captureMouse, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(parent, captureMouse, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(captureMouse, style, GUILayoutOptions::create(style));
 	}
 
-	GUIDropDownHitBox* GUIDropDownHitBox::create(GUIWidget& parent, bool captureMouse, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIDropDownHitBox* GUIDropDownHitBox::create(bool captureMouse, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(parent, captureMouse, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIDropDownHitBox, PoolAlloc>()) GUIDropDownHitBox(captureMouse, style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUIDropDownHitBox::GUIDropDownHitBox(GUIWidget& parent, bool captureMouse, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUIElementContainer(parent, layoutOptions), mCaptureMouse(captureMouse)
+	GUIDropDownHitBox::GUIDropDownHitBox(bool captureMouse, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUIElementContainer(layoutOptions), mCaptureMouse(captureMouse)
 	{
 
 	}

+ 8 - 10
BansheeEngine/Source/BsGUIElement.cpp

@@ -9,11 +9,11 @@ using namespace CamelotFramework;
 
 namespace BansheeEngine
 {
-	GUIElement::GUIElement(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:mParent(&parent), mLayoutOptions(layoutOptions), mWidth(0), mHeight(0), mDepth(0), mStyle(style),
+	GUIElement::GUIElement(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:mLayoutOptions(layoutOptions), mWidth(0), mHeight(0), mDepth(0), mStyle(style),
 		mIsDestroyed(false)
 	{
-		mParent->registerElement(this);
+
 	}
 
 	GUIElement::~GUIElement()
@@ -123,15 +123,13 @@ namespace BansheeEngine
 
 	void GUIElement::_changeParentWidget(GUIWidget* widget)
 	{
-		if(mParent != widget)
+		if(mParentWidget != widget)
 		{
-			if(mParent != nullptr)
-				mParent->unregisterElement(this);
+			if(mParentWidget != nullptr)
+				mParentWidget->unregisterElement(this);
 
 			if(widget != nullptr)
 				widget->registerElement(this);
-
-			mParent = widget;
 		}
 
 		GUIElementBase::_changeParentWidget(widget);
@@ -213,8 +211,8 @@ namespace BansheeEngine
 		if(element->mIsDestroyed)
 			return;
 
-		if(element->mParent != nullptr)
-			element->mParent->unregisterElement(element);
+		if(element->mParentWidget != nullptr)
+			element->mParentWidget->unregisterElement(element);
 
 		element->mIsDestroyed = true;
 

+ 17 - 1
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -10,7 +10,7 @@ using namespace CamelotFramework;
 namespace BansheeEngine
 {
 	GUIElementBase::GUIElementBase()
-		:mIsDirty(true), mParentElement(nullptr), mIsDisabled(false)
+		:mIsDirty(true), mParentElement(nullptr), mIsDisabled(false), mParentWidget(nullptr)
 	{
 
 	}
@@ -110,6 +110,20 @@ namespace BansheeEngine
 		}
 	}
 
+	void GUIElementBase::_setParent(GUIElementBase* parent) 
+	{ 
+		if(mParentElement != parent)
+		{
+			mParentElement = parent; 
+
+			if(parent != nullptr)
+			{
+				if(_getParentWidget() != parent->_getParentWidget())
+					_changeParentWidget(parent->_getParentWidget());
+			}
+		}
+	}
+
 	GUILayout& GUIElementBase::addLayoutXInternal(GUIElementBase* parent)
 	{
 		GUILayoutX* entry = cm_new<GUILayoutX, PoolAlloc>();
@@ -220,6 +234,8 @@ namespace BansheeEngine
 
 	void GUIElementBase::_changeParentWidget(GUIWidget* widget)
 	{
+		mParentWidget = widget;
+
 		for(auto& child : mChildren)
 		{
 			child->_changeParentWidget(widget);

+ 2 - 2
BansheeEngine/Source/BsGUIElementContainer.cpp

@@ -6,8 +6,8 @@ using namespace BansheeEngine;
 
 namespace BansheeEngine
 {
-	GUIElementContainer::GUIElementContainer(GUIWidget& parent, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, &GUISkin::DefaultStyle, layoutOptions)
+	GUIElementContainer::GUIElementContainer(const GUILayoutOptions& layoutOptions)
+		:GUIElement(&GUISkin::DefaultStyle, layoutOptions)
 	{ }
 
 	GUIElementContainer::~GUIElementContainer()

+ 8 - 26
BansheeEngine/Source/BsGUIInputBox.cpp

@@ -34,8 +34,8 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIInputBox::GUIInputBox(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions, bool multiline)
-		:GUIElement(parent, style, layoutOptions), mDragInProgress(false),
+	GUIInputBox::GUIInputBox(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions, bool multiline)
+		:GUIElement(style, layoutOptions), mDragInProgress(false),
 		mCaretShown(false), mSelectionShown(false), mIsMultiline(multiline), mHasFocus(false), mIsMouseOver(false)
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
@@ -62,37 +62,19 @@ namespace BansheeEngine
 		cm_delete<PoolAlloc>(mImageSprite);
 	}
 
-	GUIInputBox* GUIInputBox::create(GUIWidget& parent, bool multiline, const GUIElementStyle* style)
+	GUIInputBox* GUIInputBox::create(bool multiline, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(parent, style, GUILayoutOptions::create(style), multiline);
+		return new (cm_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(style, GUILayoutOptions::create(style), multiline);
 	}
 
-	GUIInputBox* GUIInputBox::create(GUIWidget& parent, bool multiline, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIInputBox* GUIInputBox::create(bool multiline, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(parent, style, GUILayoutOptions::create(layoutOptions, style), multiline);
+		return new (cm_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(style, GUILayoutOptions::create(layoutOptions, style), multiline);
 	}
 
-	GUIInputBox* GUIInputBox::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIInputBox* GUIInputBox::create(const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(parent, style, GUILayoutOptions::create(layoutOptions, style), false);
+		return new (cm_alloc<GUIInputBox, PoolAlloc>()) GUIInputBox(style, GUILayoutOptions::create(layoutOptions, style), false);
 	}
 
 	void GUIInputBox::setText(const CM::WString& text)

+ 10 - 22
BansheeEngine/Source/BsGUILabel.cpp

@@ -11,8 +11,8 @@ using namespace CamelotFramework;
 
 namespace BansheeEngine
 {
-	GUILabel::GUILabel(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mContent(content)
+	GUILabel::GUILabel(const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+		:GUIElement(style, layoutOptions), mContent(content)
 	{
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
 
@@ -83,36 +83,24 @@ namespace BansheeEngine
 		markContentAsDirty();
 	}
 
-	GUILabel* GUILabel::create(GUIWidget& parent, const HString& text, const GUIElementStyle* style)
+	GUILabel* GUILabel::create(const HString& text, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), style);
+		return create(GUIContent(text), style);
 	}
 
-	GUILabel* GUILabel::create(GUIWidget& parent, const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUILabel* GUILabel::create(const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), layoutOptions, style);
+		return create(GUIContent(text), layoutOptions, style);
 	}
 
-	GUILabel* GUILabel::create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style)
+	GUILabel* GUILabel::create(const GUIContent& content, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(parent, style, content, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(style, content, GUILayoutOptions::create(style));
 	}
 
-	GUILabel* GUILabel::create(GUIWidget& parent, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUILabel* GUILabel::create(const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(parent, style, content, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(style, content, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	const String& GUILabel::getGUITypeName()

+ 1 - 1
BansheeEngine/Source/BsGUILayout.cpp

@@ -10,7 +10,7 @@ using namespace CamelotFramework;
 namespace BansheeEngine
 {
 	GUILayout::GUILayout()
-		:mOptimalWidth(0), mOptimalHeight(0), mActualWidth(0), mActualHeight(0)
+		:mOptimalWidth(0), mOptimalHeight(0), mActualWidth(0), mActualHeight(0), mWidgetParent(nullptr)
 	{
 
 	}

+ 9 - 21
BansheeEngine/Source/BsGUIListBox.cpp

@@ -21,8 +21,8 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIListBox::GUIListBox(GUIWidget& parent, const GUIElementStyle* style, const Vector<HString>::type& elements, const GUILayoutOptions& layoutOptions)
-		:GUIButtonBase(parent, style, GUIContent(HString(L"")), layoutOptions), mElements(elements), mSelectedIdx(0), mIsListBoxOpen(false)
+	GUIListBox::GUIListBox(const GUIElementStyle* style, const Vector<HString>::type& elements, const GUILayoutOptions& layoutOptions)
+		:GUIButtonBase(style, GUIContent(HString(L"")), layoutOptions), mElements(elements), mSelectedIdx(0), mIsListBoxOpen(false)
 	{
 		if(elements.size() > 0)
 			setContent(GUIContent(mElements[mSelectedIdx]));
@@ -33,26 +33,14 @@ namespace BansheeEngine
 		closeListBox();
 	}
 
-	GUIListBox* GUIListBox::create(GUIWidget& parent, const Vector<HString>::type& elements, const GUIElementStyle* style)
+	GUIListBox* GUIListBox::create(const Vector<HString>::type& elements, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIListBox, PoolAlloc>()) GUIListBox(parent, style, elements, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIListBox, PoolAlloc>()) GUIListBox(style, elements, GUILayoutOptions::create(style));
 	}
 
-	GUIListBox* GUIListBox::create(GUIWidget& parent, const Vector<HString>::type& elements, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIListBox* GUIListBox::create(const Vector<HString>::type& elements, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIListBox, PoolAlloc>()) GUIListBox(parent, style, elements, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIListBox, PoolAlloc>()) GUIListBox(style, elements, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	void GUIListBox::setElements(const CM::Vector<CM::HString>::type& elements)
@@ -114,11 +102,11 @@ namespace BansheeEngine
 			i++;
 		}
 
-		GUIWidget& widget = _getParentWidget();
+		GUIWidget* widget = _getParentWidget();
 		GUIDropDownAreaPlacement placement = GUIDropDownAreaPlacement::aroundBoundsHorz(getBounds());
 
-		GameObjectHandle<GUIDropDownBox> dropDownBox = GUIDropDownBoxManager::instance().openDropDownBox(widget.getTarget(), 
-			placement, dropDownData, widget.getSkin(), GUIDropDownType::MenuBar, std::bind(&GUIListBox::onListBoxClosed, this));
+		GameObjectHandle<GUIDropDownBox> dropDownBox = GUIDropDownBoxManager::instance().openDropDownBox(widget->getTarget(), 
+			placement, dropDownData, widget->getSkin(), GUIDropDownType::MenuBar, std::bind(&GUIListBox::onListBoxClosed, this));
 
 		_setOn(true);
 		mIsListBoxOpen = true;

+ 9 - 9
BansheeEngine/Source/BsGUIManager.cpp

@@ -246,12 +246,12 @@ namespace BansheeEngine
 
 				if(iterFind == mElementsInFocus.end())
 				{
-					mElementsInFocus.push_back(ElementInfo(focusElementInfo.element, &focusElementInfo.element->_getParentWidget()));
+					mElementsInFocus.push_back(ElementInfo(focusElementInfo.element, focusElementInfo.element->_getParentWidget()));
 
 					mCommandEvent = GUICommandEvent();
 					mCommandEvent.setType(GUICommandEventType::FocusGained);
 
-					sendCommandEvent(&focusElementInfo.element->_getParentWidget(), focusElementInfo.element, mCommandEvent);
+					sendCommandEvent(focusElementInfo.element->_getParentWidget(), focusElementInfo.element, mCommandEvent);
 				}
 			}
 			else
@@ -401,7 +401,7 @@ namespace BansheeEngine
 				UINT32 elemDepth = guiElem->_getRenderElementDepth(renderElemIdx);
 
 				RectI tfrmedBounds = guiElem->_getClippedBounds();
-				tfrmedBounds.transform(guiElem->_getParentWidget().SO()->getWorldTfrm());
+				tfrmedBounds.transform(guiElem->_getParentWidget()->SO()->getWorldTfrm());
 
 				const GUIMaterialInfo& matInfo = guiElem->getMaterial(renderElemIdx);
 
@@ -427,7 +427,7 @@ namespace BansheeEngine
 						if(groupIter->elements.size() > 0)
 						{
 							GUIElement* otherElem = groupIter->elements.begin()->element; // We only need to check the first element
-							if(&otherElem->_getParentWidget() != &guiElem->_getParentWidget())
+							if(otherElem->_getParentWidget() != guiElem->_getParentWidget())
 								continue;
 						}
 					}
@@ -537,7 +537,7 @@ namespace BansheeEngine
 					else
 					{
 						GUIElement* elem = group->elements.begin()->element;
-						renderData.cachedWidgetsPerMesh[groupIdx] = &elem->_getParentWidget();
+						renderData.cachedWidgetsPerMesh[groupIdx] = elem->_getParentWidget();
 					}
 				}
 
@@ -1402,7 +1402,7 @@ namespace BansheeEngine
 		{
 			const GUIElement* bridgeElement = iterFind->second;
 
-			const Matrix4& worldTfrm = bridgeElement->_getParentWidget().SO()->getWorldTfrm();
+			const Matrix4& worldTfrm = bridgeElement->_getParentWidget()->SO()->getWorldTfrm();
 
 			Vector4 vecLocalPos = worldTfrm.inverse().multiply3x4(Vector4((float)windowPos.x, (float)windowPos.y, 0.0f, 1.0f));
 			RectI bridgeBounds = bridgeElement->getBounds();
@@ -1430,10 +1430,10 @@ namespace BansheeEngine
 		auto iterFind = mInputBridge.find(renderTexture);
 		if(iterFind != mInputBridge.end())
 		{
-			GUIWidget& parentWidget = iterFind->second->_getParentWidget();
-			if(&parentWidget != &widget)
+			GUIWidget* parentWidget = iterFind->second->_getParentWidget();
+			if(parentWidget != &widget)
 			{
-				return getWidgetWindow(parentWidget);
+				return getWidgetWindow(*parentWidget);
 			}
 		}
 

+ 6 - 18
BansheeEngine/Source/BsGUIRenderTexture.cpp

@@ -15,8 +15,8 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIRenderTexture::GUIRenderTexture(GUIWidget& parent, const GUIElementStyle* style, const RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions)
-		:GUITexture(parent, style, HSpriteTexture(), GUIImageScaleMode::StretchToFit, layoutOptions), mSourceTexture(texture.get())
+	GUIRenderTexture::GUIRenderTexture(const GUIElementStyle* style, const RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions)
+		:GUITexture(style, HSpriteTexture(), GUIImageScaleMode::StretchToFit, layoutOptions), mSourceTexture(texture.get())
 	{
 		if(mSourceTexture->requiresTextureFlipping())
 		{
@@ -33,26 +33,14 @@ namespace BansheeEngine
 		GUIManager::instance().setInputBridge(mSourceTexture, nullptr);
 	}
 
-	GUIRenderTexture* GUIRenderTexture::create(GUIWidget& parent, const RenderTexturePtr& texture, const GUIElementStyle* style)
+	GUIRenderTexture* GUIRenderTexture::create(const RenderTexturePtr& texture, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(parent, style, texture, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(style, texture, GUILayoutOptions::create(style));
 	}
 
-	GUIRenderTexture* GUIRenderTexture::create(GUIWidget& parent, const RenderTexturePtr& texture, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIRenderTexture* GUIRenderTexture::create(const RenderTexturePtr& texture, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(parent, style, texture, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIRenderTexture, PoolAlloc>()) GUIRenderTexture(style, texture, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	void GUIRenderTexture::updateRenderElementsInternal()

+ 13 - 37
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -19,7 +19,7 @@ namespace BansheeEngine
 	const UINT32 GUIScrollArea::MinHandleSize = 4;
 	const UINT32 GUIScrollArea::WheelScrollAmount = 50;
 
-	GUIScrollArea::GUIScrollArea(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
+	GUIScrollArea::GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 		const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle, const GUILayoutOptions& layoutOptions)
 		:GUIElementContainer(parent, layoutOptions), mVertScroll(nullptr), mHorzScroll(nullptr), mVertOffset(0), mHorzOffset(0),
 		mContentWidth(0), mContentHeight(0), mClippedContentWidth(0), mClippedContentHeight(0), mVertBarType(vertBarType), mHorzBarType(horzBarType),
@@ -147,9 +147,9 @@ namespace BansheeEngine
 			if(mVertScroll == nullptr)
 			{
 				if(mScrollBarStyle != nullptr)
-					mVertScroll = GUIScrollBarVert::create(_getParentWidget(), mScrollBarStyle);
+					mVertScroll = GUIScrollBarVert::create(mScrollBarStyle);
 				else
-					mVertScroll = GUIScrollBarVert::create(_getParentWidget());
+					mVertScroll = GUIScrollBarVert::create();
 
 				_registerChildElement(mVertScroll);
 
@@ -207,9 +207,9 @@ namespace BansheeEngine
 			if(mHorzScroll == nullptr)
 			{
 				if(mScrollBarStyle != nullptr)
-					mHorzScroll = GUIScrollBarHorz::create(_getParentWidget(), mScrollBarStyle);
+					mHorzScroll = GUIScrollBarHorz::create(mScrollBarStyle);
 				else
-					mHorzScroll = GUIScrollBarHorz::create(_getParentWidget());
+					mHorzScroll = GUIScrollBarHorz::create();
 
 				_registerChildElement(mHorzScroll);
 
@@ -385,55 +385,31 @@ namespace BansheeEngine
 		return false;
 	}
 
-	GUIScrollArea* GUIScrollArea::create(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
+	GUIScrollArea* GUIScrollArea::create(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 		const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle)
 	{
-		if(scrollAreaStyle == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			scrollAreaStyle = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(parent, vertBarType, horzBarType, scrollBarStyle, 
+		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(vertBarType, horzBarType, scrollBarStyle, 
 			scrollAreaStyle, GUILayoutOptions::create(scrollAreaStyle));
 	}
 
-	GUIScrollArea* GUIScrollArea::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* scrollBarStyle, 
+	GUIScrollArea* GUIScrollArea::create(const GUIOptions& layoutOptions, const GUIElementStyle* scrollBarStyle, 
 		const GUIElementStyle* scrollAreaStyle)
 	{
-		if(scrollAreaStyle == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			scrollAreaStyle = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(parent, ScrollBarType::ShowIfDoesntFit, 
+		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(ScrollBarType::ShowIfDoesntFit, 
 			ScrollBarType::ShowIfDoesntFit, scrollBarStyle, scrollAreaStyle, GUILayoutOptions::create(layoutOptions, scrollAreaStyle));
 	}
 
-	GUIScrollArea* GUIScrollArea::create(GUIWidget& parent, const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle)
+	GUIScrollArea* GUIScrollArea::create(const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle)
 	{
-		if(scrollAreaStyle == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			scrollAreaStyle = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(parent, ScrollBarType::ShowIfDoesntFit, ScrollBarType::ShowIfDoesntFit, scrollBarStyle, 
+		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(ScrollBarType::ShowIfDoesntFit, ScrollBarType::ShowIfDoesntFit, scrollBarStyle, 
 			scrollAreaStyle, GUILayoutOptions::create(scrollAreaStyle));
 	}
 
-	GUIScrollArea* GUIScrollArea::create(GUIWidget& parent, ScrollBarType vertBarType, 
+	GUIScrollArea* GUIScrollArea::create(ScrollBarType vertBarType, 
 		ScrollBarType horzBarType, const GUIOptions& layoutOptions, const GUIElementStyle* scrollBarStyle, 
 		const GUIElementStyle* scrollAreaStyle)
 	{
-		if(scrollAreaStyle == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			scrollAreaStyle = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(parent, vertBarType, horzBarType, scrollBarStyle, scrollAreaStyle, GUILayoutOptions::create(layoutOptions, scrollAreaStyle));
+		return new (cm_alloc<GUIScrollArea, PoolAlloc>()) GUIScrollArea(vertBarType, horzBarType, scrollBarStyle, scrollAreaStyle, GUILayoutOptions::create(layoutOptions, scrollAreaStyle));
 	}
 
 	const String& GUIScrollArea::getGUITypeName()

+ 6 - 6
BansheeEngine/Source/BsGUIScrollBar.cpp

@@ -18,8 +18,8 @@ namespace BansheeEngine
 {
 	const UINT32 GUIScrollBar::ButtonScrollAmount = 10;
 
-	GUIScrollBar::GUIScrollBar(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mHorizontal(horizontal)
+	GUIScrollBar::GUIScrollBar(bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUIElement(style, layoutOptions), mHorizontal(horizontal)
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 
@@ -27,8 +27,8 @@ namespace BansheeEngine
 		{
 			mLayout = &addLayoutXInternal(this);
 
-			mUpBtn = GUIButton::create(parent, HString(L""), parent.getSkin().getStyle("ScrollLeftBtn"));
-			mDownBtn = GUIButton::create(parent, HString(L""), parent.getSkin().getStyle("ScrollRightBtn"));
+			mUpBtn = GUIButton::create(HString(L""), parent.getSkin().getStyle("ScrollLeftBtn"));
+			mDownBtn = GUIButton::create(HString(L""), parent.getSkin().getStyle("ScrollRightBtn"));
 
 			mHandleBtn = GUIScrollBarHandle::create(parent, mHorizontal, 
 				GUIOptions(GUIOption::flexibleWidth(), GUIOption::fixedHeight(6)), parent.getSkin().getStyle("ScrollBarHorzBtn"));
@@ -37,8 +37,8 @@ namespace BansheeEngine
 		{
 			mLayout = &addLayoutYInternal(this);
 
-			mUpBtn = GUIButton::create(parent, HString(L""), parent.getSkin().getStyle("ScrollUpBtn"));
-			mDownBtn = GUIButton::create(parent, HString(L""), parent.getSkin().getStyle("ScrollDownBtn"));
+			mUpBtn = GUIButton::create(HString(L""), parent.getSkin().getStyle("ScrollUpBtn"));
+			mDownBtn = GUIButton::create(HString(L""), parent.getSkin().getStyle("ScrollDownBtn"));
 
 			mHandleBtn = GUIScrollBarHandle::create(parent, mHorizontal, 
 				GUIOptions(GUIOption::fixedWidth(6), GUIOption::flexibleHeight()), parent.getSkin().getStyle("ScrollBarVertBtn"));

+ 6 - 18
BansheeEngine/Source/BsGUIScrollBarHandle.cpp

@@ -19,8 +19,8 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIScrollBarHandle::GUIScrollBarHandle(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mHorizontal(horizontal), mHandleSize(2), mMouseOverHandle(false), mHandlePos(0), mDragStartPos(0),
+	GUIScrollBarHandle::GUIScrollBarHandle(bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUIElement(style, layoutOptions), mHorizontal(horizontal), mHandleSize(2), mMouseOverHandle(false), mHandlePos(0), mDragStartPos(0),
 		mHandleDragged(false)
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
@@ -32,26 +32,14 @@ namespace BansheeEngine
 		cm_delete<PoolAlloc>(mImageSprite);
 	}
 
-	GUIScrollBarHandle* GUIScrollBarHandle::create(GUIWidget& parent, bool horizontal, const GUIElementStyle* style)
+	GUIScrollBarHandle* GUIScrollBarHandle::create(bool horizontal, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollBarHandle, PoolAlloc>()) GUIScrollBarHandle(parent, horizontal, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIScrollBarHandle, PoolAlloc>()) GUIScrollBarHandle(horizontal, style, GUILayoutOptions::create(style));
 	}
 
-	GUIScrollBarHandle* GUIScrollBarHandle::create(GUIWidget& parent, bool horizontal, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIScrollBarHandle* GUIScrollBarHandle::create(bool horizontal, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollBarHandle, PoolAlloc>()) GUIScrollBarHandle(parent, horizontal, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIScrollBarHandle, PoolAlloc>()) GUIScrollBarHandle(horizontal, style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	void GUIScrollBarHandle::setHandleSize(CM::UINT32 size)

+ 6 - 18
BansheeEngine/Source/BsGUIScrollBarHorz.cpp

@@ -14,8 +14,8 @@ using namespace CamelotFramework;
 
 namespace BansheeEngine
 {
-	GUIScrollBarHorz::GUIScrollBarHorz(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUIScrollBar(parent, true, style, layoutOptions)
+	GUIScrollBarHorz::GUIScrollBarHorz(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUIScrollBar(true, style, layoutOptions)
 	{
 
 	}
@@ -25,26 +25,14 @@ namespace BansheeEngine
 
 	}
 
-	GUIScrollBarHorz* GUIScrollBarHorz::create(GUIWidget& parent, const GUIElementStyle* style)
+	GUIScrollBarHorz* GUIScrollBarHorz::create(const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollBarHorz, PoolAlloc>()) GUIScrollBarHorz(parent, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIScrollBarHorz, PoolAlloc>()) GUIScrollBarHorz(style, GUILayoutOptions::create(style));
 	}
 
-	GUIScrollBarHorz* GUIScrollBarHorz::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIScrollBarHorz* GUIScrollBarHorz::create(const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollBarHorz, PoolAlloc>()) GUIScrollBarHorz(parent, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIScrollBarHorz, PoolAlloc>()) GUIScrollBarHorz(style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	const String& GUIScrollBarHorz::getGUITypeName()

+ 6 - 18
BansheeEngine/Source/BsGUIScrollBarVert.cpp

@@ -14,8 +14,8 @@ using namespace CamelotFramework;
 
 namespace BansheeEngine
 {
-	GUIScrollBarVert::GUIScrollBarVert(GUIWidget& parent, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
-		:GUIScrollBar(parent, false, style, layoutOptions)
+	GUIScrollBarVert::GUIScrollBarVert(const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
+		:GUIScrollBar(false, style, layoutOptions)
 	{
 
 	}
@@ -25,26 +25,14 @@ namespace BansheeEngine
 
 	}
 
-	GUIScrollBarVert* GUIScrollBarVert::create(GUIWidget& parent, const GUIElementStyle* style)
+	GUIScrollBarVert* GUIScrollBarVert::create(const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollBarVert, PoolAlloc>()) GUIScrollBarVert(parent, style, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIScrollBarVert, PoolAlloc>()) GUIScrollBarVert(style, GUILayoutOptions::create(style));
 	}
 
-	GUIScrollBarVert* GUIScrollBarVert::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIScrollBarVert* GUIScrollBarVert::create(const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIScrollBarVert, PoolAlloc>()) GUIScrollBarVert(parent, style, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIScrollBarVert, PoolAlloc>()) GUIScrollBarVert(style, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	const String& GUIScrollBarVert::getGUITypeName()

+ 18 - 66
BansheeEngine/Source/BsGUITexture.cpp

@@ -16,9 +16,9 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUITexture::GUITexture(GUIWidget& parent, const GUIElementStyle* style, const HSpriteTexture& texture, 
+	GUITexture::GUITexture(const GUIElementStyle* style, const HSpriteTexture& texture, 
 		GUIImageScaleMode scale, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mScaleMode(scale)
+		:GUIElement(style, layoutOptions), mScaleMode(scale)
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 
@@ -38,95 +38,47 @@ namespace BansheeEngine
 		cm_delete<PoolAlloc>(mImageSprite);
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, const HSpriteTexture& texture, 
+	GUITexture* GUITexture::create(const HSpriteTexture& texture, 
 		GUIImageScaleMode scale, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, texture, scale, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, texture, scale, GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, const HSpriteTexture& texture, 
+	GUITexture* GUITexture::create(const HSpriteTexture& texture, 
 		GUIImageScaleMode scale, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, texture, scale, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, texture, scale, GUILayoutOptions::create(style));
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, const HSpriteTexture& texture, 
+	GUITexture* GUITexture::create(const HSpriteTexture& texture, 
 		const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, texture, GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, texture, GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, const HSpriteTexture& texture, const GUIElementStyle* style)
+	GUITexture* GUITexture::create(const HSpriteTexture& texture, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, texture, GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, texture, GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(style));
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, GUIImageScaleMode scale, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUITexture* GUITexture::create(GUIImageScaleMode scale, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, HTexture(), scale, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, HTexture(), scale, GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, GUIImageScaleMode scale, const GUIElementStyle* style)
+	GUITexture* GUITexture::create(GUIImageScaleMode scale, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, HSpriteTexture(), scale, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, HSpriteTexture(), scale, GUILayoutOptions::create(style));
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUITexture* GUITexture::create(const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, HTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, HTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUITexture* GUITexture::create(GUIWidget& parent, const GUIElementStyle* style)
+	GUITexture* GUITexture::create(const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(parent, style, HTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUITexture, PoolAlloc>()) GUITexture(style, HTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(style));
 	}
 
 	void GUITexture::setTexture(const HSpriteTexture& texture)

+ 18 - 42
BansheeEngine/Source/BsGUIToggle.cpp

@@ -20,8 +20,8 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIToggle::GUIToggle(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions)
-		:GUIButtonBase(parent, style, content, layoutOptions), mIsToggled(false), mToggleGroup(nullptr)
+	GUIToggle::GUIToggle(const GUIElementStyle* style, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions)
+		:GUIButtonBase(style, content, layoutOptions), mIsToggled(false), mToggleGroup(nullptr)
 	{
 		if(toggleGroup != nullptr)
 			toggleGroup->add(this);
@@ -35,68 +35,44 @@ namespace BansheeEngine
 		}
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const HString& text, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const HString& text, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), style);
+		return create(GUIContent(text), style);
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const HString& text, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), layoutOptions, style);
+		return create(GUIContent(text), layoutOptions, style);
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), toggleGroup, style);
+		return create(GUIContent(text), toggleGroup, style);
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		return create(parent, GUIContent(text), toggleGroup, layoutOptions, style);
+		return create(GUIContent(text), toggleGroup, layoutOptions, style);
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const GUIContent& content, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, nullptr, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(style, content, nullptr, GUILayoutOptions::create(style));
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const GUIContent& content, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, nullptr, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(style, content, nullptr, GUILayoutOptions::create(layoutOptions, style));
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, toggleGroup, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(style, content, toggleGroup, GUILayoutOptions::create(style));
 	}
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, toggleGroup, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(style, content, toggleGroup, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	std::shared_ptr<GUIToggleGroup> GUIToggle::createToggleGroup()

+ 6 - 18
BansheeEngine/Source/BsGUIViewport.cpp

@@ -18,9 +18,9 @@ namespace BansheeEngine
 		return name;
 	}
 
-	GUIViewport::GUIViewport(GUIWidget& parent, const GUIElementStyle* style, const HCamera& camera, 
+	GUIViewport::GUIViewport(const GUIElementStyle* style, const HCamera& camera, 
 		float aspectRatio, CM::Degree fieldOfView, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mCamera(camera), mAspectRatio(aspectRatio),
+		:GUIElement(style, layoutOptions), mCamera(camera), mAspectRatio(aspectRatio),
 		mFieldOfView(fieldOfView)
 	{
 		RenderTargetPtr guiRenderTarget = parent.getTarget()->getTarget();
@@ -37,27 +37,15 @@ namespace BansheeEngine
 
 	}
 
-	GUIViewport* GUIViewport::create(GUIWidget& parent, const HCamera& camera, float aspectRatio, CM::Degree fieldOfView, const GUIElementStyle* style)
+	GUIViewport* GUIViewport::create(const HCamera& camera, float aspectRatio, CM::Degree fieldOfView, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIViewport, PoolAlloc>()) GUIViewport(parent, style, camera, aspectRatio, fieldOfView, GUILayoutOptions::create(style));
+		return new (cm_alloc<GUIViewport, PoolAlloc>()) GUIViewport(style, camera, aspectRatio, fieldOfView, GUILayoutOptions::create(style));
 	}
 
-	GUIViewport* GUIViewport::create(GUIWidget& parent, const GUIOptions& layoutOptions, const HCamera& camera, 
+	GUIViewport* GUIViewport::create(const GUIOptions& layoutOptions, const HCamera& camera, 
 		float aspectRatio, CM::Degree fieldOfView, const GUIElementStyle* style)
 	{
-		if(style == nullptr)
-		{
-			const GUISkin& skin = parent.getSkin();
-			style = skin.getStyle(getGUITypeName());
-		}
-
-		return new (cm_alloc<GUIViewport, PoolAlloc>()) GUIViewport(parent, style, camera, aspectRatio, fieldOfView, GUILayoutOptions::create(layoutOptions, style));
+		return new (cm_alloc<GUIViewport, PoolAlloc>()) GUIViewport(style, camera, aspectRatio, fieldOfView, GUILayoutOptions::create(layoutOptions, style));
 	}
 
 	UINT32 GUIViewport::getNumRenderElements() const

+ 23 - 6
Inspector.txt

@@ -28,15 +28,32 @@ REFACTOR c++ GUI a bit:
    - When dragging over GameObjectField cursor needs to change depending whether drop will be accepted or not
    - How will I limit it to just certain component types?
 
-How will I add editor fields to GUILayout? Right now I have a bunch of Add* methods and that won't work for Editor-only fields. I could extend GUILayout to EditorGUILayout but then GUIArea needs to be aware of that as well...
+Refactor GUIElements so that they don't require GUIwidget on creation
+Hide "mStyle"
+ - Replace it with getStyle()
+   - If custom style is set always return that
+   - If widget is set return widget style
+   - Otherwise return dummy style
+ - Need to ensure that anything that uses mStyle is constantly refreshed instead of just queried once during construction
 
-GUIElement has GetChild/GetNumChildren, which isn't really useful for elements like GUIToggle, GUIButton, etc.
- - GUIElements and GUILayout should still share same base class, but make it GUIElementBase, that doesn't include children
+GUIScrollBar uses parent.GetSkin - need to get around that
+ - Likely a method like _overrideDefaultStyleName()
+ - Or just inherit the type if its only for a couple of buttons?
+ - OR PROBABLY replace current GUIElementStyle parameter with a string overriding the default style
+ - Also using it:
+   - GUIFoldout
+   - GUITreeView
+   - GUITabbedTitleBar
+   - GUIGameObjectField
+
+DockManager was retrieving a viewport from the parent widget. Provide it manually?
+
+Make a common class for ScriptGUIElement as they all share:
+ - Destroy(), DestroyInstance(), SetParent(), SetVisible() methods, and potentially others
+
+Add InsertElement to GUILayout
 
-Refactor GUILayout so it has AddElement, RemoveElement, InsertElement, GetChildren, GetNumChildren methods
- - GUIElement reference should be kept by parent layout, so if it is ever removed (or never added) it will get garbage collected and destroyed
 
-Layouts/Areas/Elements need SetVisible(true/false) toggle
 
 -------------
 Implementation order: