Ver Fonte

Made DockManager a GUIElement
Removed filters from GUIManager

Marko Pintera há 12 anos atrás
pai
commit
b1b81a4c49

+ 1 - 1
BansheeEngine/Include/BsGUIElementContainer.h

@@ -38,7 +38,7 @@ namespace BansheeEngine
 		virtual void updateClippedBounds();
 		virtual void updateClippedBounds();
 
 
 		virtual CM::Vector2I _getOptimalSize() const;
 		virtual CM::Vector2I _getOptimalSize() const;
-		void _changeParentWidget(BS::GUIWidget* widget);
+		virtual void _changeParentWidget(BS::GUIWidget* widget);
 
 
 		virtual CM::UINT32 getNumChildElements() const = 0;
 		virtual CM::UINT32 getNumChildElements() const = 0;
 		virtual GUIElement* getChildElement(CM::UINT32 idx) const = 0;
 		virtual GUIElement* getChildElement(CM::UINT32 idx) const = 0;

+ 0 - 2
BansheeEngine/Include/BsGUIManager.h

@@ -103,8 +103,6 @@ namespace BansheeEngine
 		 */
 		 */
 		void setInputBridge(const CM::RenderTexture* renderTex, const GUIElement* element);
 		void setInputBridge(const CM::RenderTexture* renderTex, const GUIElement* element);
 
 
-		boost::signal<bool(GUIWidget*, GUIElement*, const GUIMouseEvent&)> mouseEventFilter;
-		boost::signal<void(GUIWidget*, GUIElement*, const GUITextInputEvent&)> textInputEventFilter;
 	private:
 	private:
 		struct SelectiveInputData
 		struct SelectiveInputData
 		{
 		{

+ 4 - 31
BansheeEngine/Include/BsGUIScrollArea.h

@@ -1,7 +1,7 @@
 #pragma once
 #pragma once
 
 
 #include "BsPrerequisites.h"
 #include "BsPrerequisites.h"
-#include "BsGUIElement.h"
+#include "BsGUIElementContainer.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -12,7 +12,7 @@ namespace BansheeEngine
 		NeverShow
 		NeverShow
 	};
 	};
 
 
-	class BS_EXPORT GUIScrollArea : public GUIElement
+	class BS_EXPORT GUIScrollArea : public GUIElementContainer
 	{
 	{
 	public:
 	public:
 		static const CM::String& getGUITypeName();
 		static const CM::String& getGUITypeName();
@@ -30,37 +30,9 @@ namespace BansheeEngine
 			const GUIElementStyle* scrollAreaStyle = nullptr);
 			const GUIElementStyle* scrollAreaStyle = nullptr);
 
 
 		GUILayout& getLayout() const { return *mContentLayout; }
 		GUILayout& getLayout() const { return *mContentLayout; }
-
-		virtual CM::Vector2I _getOptimalSize() const;
-
 	protected:
 	protected:
 		~GUIScrollArea();
 		~GUIScrollArea();
 
 
-		/**
-		 * @copydoc GUIElement::getNumRenderElements()
-		 */
-		virtual CM::UINT32 getNumRenderElements() const;
-
-		/**
-		 * @copydoc GUIElement::getMaterial()
-		 */
-		virtual const GUIMaterialInfo& getMaterial(CM::UINT32 renderElementIdx) const;
-
-		/**
-		 * @copydoc GUIElement::getNumQuads()
-		 */
-		virtual CM::UINT32 getNumQuads(CM::UINT32 renderElementIdx) const;
-
-		/**
-		 * @copydoc GUIElement::fillBuffer()
-		 */
-		virtual void fillBuffer(CM::UINT8* vertices, CM::UINT8* uv, CM::UINT32* indices, CM::UINT32 startingQuad, 
-			CM::UINT32 maxNumQuads, CM::UINT32 vertexStride, CM::UINT32 indexStride, CM::UINT32 renderElementIdx) const;
-
-		/**
-		 * @copydoc GUIElement::updateBounds()
-		 */
-		virtual void updateClippedBounds();
 	private:
 	private:
 		GUIScrollArea(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
 		GUIScrollArea(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle, const GUILayoutOptions& layoutOptions);
 			const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle, const GUILayoutOptions& layoutOptions);
@@ -90,6 +62,7 @@ namespace BansheeEngine
 		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
 		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
 			CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 			CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 
 
-		virtual void _changeParentWidget(GUIWidget* widget);
+		CM::UINT32 getNumChildElements() const;
+		GUIElement* getChildElement(CM::UINT32 idx) const;
 	};
 	};
 }
 }

+ 6 - 1
BansheeEngine/Source/BsGUIElementContainer.cpp

@@ -47,6 +47,11 @@ namespace BansheeEngine
 		GUIElement::_changeParentWidget(widget);
 		GUIElement::_changeParentWidget(widget);
 
 
 		for(UINT32 i = 0; i < getNumChildElements(); i++)
 		for(UINT32 i = 0; i < getNumChildElements(); i++)
-			getChildElement(i)->_changeParentWidget(widget);
+		{
+			GUIElement* child = getChildElement(i);
+
+			if(child != nullptr)
+				child->_changeParentWidget(widget);
+		}
 	}
 	}
 }
 }

+ 0 - 9
BansheeEngine/Source/BsGUIManager.cpp

@@ -1255,20 +1255,11 @@ namespace BansheeEngine
 
 
 	bool GUIManager::sendMouseEvent(GUIWidget* widget, GUIElement* element, const GUIMouseEvent& event)
 	bool GUIManager::sendMouseEvent(GUIWidget* widget, GUIElement* element, const GUIMouseEvent& event)
 	{
 	{
-		if(!mouseEventFilter.empty())
-		{
-			if(mouseEventFilter(widget, element, event)) // TODO - If multiple filters and processed at once I should only call the first one
-				return true;
-		}
-
 		return widget->_mouseEvent(element, event);
 		return widget->_mouseEvent(element, event);
 	}
 	}
 
 
 	bool GUIManager::sendTextInputEvent(GUIWidget* widget, GUIElement* element, const GUITextInputEvent& event)
 	bool GUIManager::sendTextInputEvent(GUIWidget* widget, GUIElement* element, const GUITextInputEvent& event)
 	{
 	{
-		if(!textInputEventFilter.empty())
-			textInputEventFilter(widget, element, event);
-
 		return widget->_textInputEvent(element, event);
 		return widget->_textInputEvent(element, event);
 	}
 	}
 
 

+ 14 - 38
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -20,7 +20,7 @@ namespace BansheeEngine
 
 
 	GUIScrollArea::GUIScrollArea(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
 	GUIScrollArea::GUIScrollArea(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
 		const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle, const GUILayoutOptions& layoutOptions)
 		const GUIElementStyle* scrollBarStyle, const GUIElementStyle* scrollAreaStyle, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, scrollAreaStyle, layoutOptions, false), mVertScroll(nullptr), mHorzScroll(nullptr), mVertOffset(0), mHorzOffset(0),
+		:GUIElementContainer(parent, layoutOptions), mVertScroll(nullptr), mHorzScroll(nullptr), mVertOffset(0), mHorzOffset(0),
 		mContentWidth(0), mContentHeight(0), mClippedContentWidth(0), mClippedContentHeight(0), mVertBarType(vertBarType), mHorzBarType(horzBarType),
 		mContentWidth(0), mContentHeight(0), mClippedContentWidth(0), mClippedContentHeight(0), mVertBarType(vertBarType), mHorzBarType(horzBarType),
 		mScrollBarStyle(scrollBarStyle)
 		mScrollBarStyle(scrollBarStyle)
 	{
 	{
@@ -32,35 +32,6 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
-	UINT32 GUIScrollArea::getNumRenderElements() const
-	{
-		return 0;
-	}
-
-	const GUIMaterialInfo& GUIScrollArea::getMaterial(UINT32 renderElementIdx) const
-	{
-		CM_EXCEPT(InvalidStateException, "Trying to retrieve a material from an element with no render elements.");
-	}
-
-	UINT32 GUIScrollArea::getNumQuads(UINT32 renderElementIdx) const
-	{
-		return 0;
-	}
-
-	void GUIScrollArea::updateClippedBounds()
-	{
-		mClippedBounds = RectI(0, 0, 0, 0); // We don't want any mouse input for this element. This is just a container.
-	}
-
-	Vector2I GUIScrollArea::_getOptimalSize() const
-	{
-		return mContentLayout->_getOptimalSize();
-	}
-
-	void GUIScrollArea::fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, 
-		UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const
-	{ }
-
 	void GUIScrollArea::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
 	void GUIScrollArea::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
 		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 		RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 	{
 	{
@@ -290,17 +261,22 @@ namespace BansheeEngine
 		return false;
 		return false;
 	}
 	}
 
 
-	void GUIScrollArea::_changeParentWidget(GUIWidget* widget)
+	UINT32 GUIScrollArea::getNumChildElements() const
 	{
 	{
-		GUIElement::_changeParentWidget(widget);
+		return 2;
+	}
 
 
-		// These two elements are not part of a layout so I need to make sure to
-		// update them manually
-		if(mVertScroll != nullptr)
-			mVertScroll->_changeParentWidget(widget);
+	GUIElement* GUIScrollArea::getChildElement(UINT32 idx) const
+	{
+		switch(idx)
+		{
+		case 0:
+			return mVertScroll;
+		case 1:
+			return mHorzScroll;
+		}
 
 
-		if(mHorzScroll != nullptr)
-			mHorzScroll->_changeParentWidget(widget);
+		return nullptr;
 	}
 	}
 
 
 	GUIScrollArea* GUIScrollArea::create(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 
 	GUIScrollArea* GUIScrollArea::create(GUIWidget& parent, ScrollBarType vertBarType, ScrollBarType horzBarType, 

+ 14 - 5
CamelotClient/Include/BsDockManager.h

@@ -1,6 +1,7 @@
 #pragma once
 #pragma once
 
 
 #include "BsEditorPrerequisites.h"
 #include "BsEditorPrerequisites.h"
+#include "BsGUIElementContainer.h"
 #include "CmRectI.h"
 #include "CmRectI.h"
 
 
 namespace BansheeEditor
 namespace BansheeEditor
@@ -10,7 +11,7 @@ namespace BansheeEditor
 		Left, Right, Top, Bottom, Center
 		Left, Right, Top, Bottom, Center
 	};
 	};
 
 
-	class DockManager
+	class DockManager : public BS::GUIElementContainer
 	{
 	{
 		class DockContainer
 		class DockContainer
 		{
 		{
@@ -64,8 +65,7 @@ namespace BansheeEditor
 			None
 			None
 		};
 		};
 	public:
 	public:
-		DockManager(BS::GUIWidget* parent, CM::RenderWindow* parentWindow);
-		~DockManager();
+		static DockManager* create(BS::GUIWidget& parent, CM::RenderWindow* parentWindow);
 
 
 		/**
 		/**
 		 * @brief	Internal method. Called once every frame.
 		 * @brief	Internal method. Called once every frame.
@@ -77,11 +77,17 @@ namespace BansheeEditor
 
 
 		void setArea(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
 		void setArea(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
 
 
+	protected:
+		~DockManager();
+
+		void updateClippedBounds();
+
 	private:
 	private:
+		DockManager(BS::GUIWidget& parent, CM::RenderWindow* parentWindow, const BS::GUILayoutOptions& layoutOptions);
+
 		static const CM::Color TINT_COLOR;
 		static const CM::Color TINT_COLOR;
 		static const CM::Color HIGHLIGHT_COLOR;
 		static const CM::Color HIGHLIGHT_COLOR;
 
 
-		BS::GUIWidget* mParent;
 		CM::RenderWindow* mParentWindow;
 		CM::RenderWindow* mParentWindow;
 		DockContainer mRootContainer;
 		DockContainer mRootContainer;
 
 
@@ -99,7 +105,10 @@ namespace BansheeEditor
 
 
 		void updateDropOverlay(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
 		void updateDropOverlay(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
 
 
-		bool onGUIMouseEvent(BS::GUIWidget* widget, BS::GUIElement* element, const BS::GUIMouseEvent& event);
+		bool mouseEvent(const BS::GUIMouseEvent& event);
 		bool insidePolygon(CM::Vector2* polyPoints, CM::UINT32 numPoints, CM::Vector2 point) const;
 		bool insidePolygon(CM::Vector2* polyPoints, CM::UINT32 numPoints, CM::Vector2 point) const;
+
+		virtual CM::UINT32 getNumChildElements() const;
+		virtual BS::GUIElement* getChildElement(CM::UINT32 idx) const;
 	};
 	};
 }
 }

+ 0 - 1
CamelotClient/Include/BsGUITabbedTitleBar.h

@@ -43,7 +43,6 @@ namespace BansheeEditor
 
 
 		CM::UINT32 mUniqueTabIdx;
 		CM::UINT32 mUniqueTabIdx;
 		CM::UINT32 mActiveTabIdx;
 		CM::UINT32 mActiveTabIdx;
-		BS::GUIWidget* mParentWidget;
 		BS::GUITexture* mBackgroundImage;
 		BS::GUITexture* mBackgroundImage;
 		BS::GUIButton* mMinBtn;
 		BS::GUIButton* mMinBtn;
 		BS::GUIButton* mCloseBtn;
 		BS::GUIButton* mCloseBtn;

+ 28 - 11
CamelotClient/Source/BsDockManager.cpp

@@ -16,6 +16,7 @@
 #include "BsCamera.h"
 #include "BsCamera.h"
 #include "BsDragAndDropManager.h"
 #include "BsDragAndDropManager.h"
 #include "CmVertexDataDesc.h"
 #include "CmVertexDataDesc.h"
+#include "BsGUISkin.h"
 
 
 using namespace CamelotFramework;
 using namespace CamelotFramework;
 using namespace BansheeEngine;
 using namespace BansheeEngine;
@@ -252,8 +253,8 @@ namespace BansheeEditor
 		return mWidgets->getContentBounds();
 		return mWidgets->getContentBounds();
 	}
 	}
 
 
-	DockManager::DockManager(BS::GUIWidget* parent, CM::RenderWindow* parentWindow)
-		:mParent(parent), mParentWindow(parentWindow), mMouseOverContainer(nullptr), mHighlightedDropLoc(DockLocation::None),
+	DockManager::DockManager(BS::GUIWidget& parent, CM::RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions)
+		:GUIElementContainer(parent, layoutOptions), mParentWindow(parentWindow), mMouseOverContainer(nullptr), mHighlightedDropLoc(DockLocation::None),
 		mShowOverlay(false)
 		mShowOverlay(false)
 	{
 	{
 		mTopDropPolygon = cm_newN<Vector2>(4);
 		mTopDropPolygon = cm_newN<Vector2>(4);
@@ -263,9 +264,7 @@ namespace BansheeEditor
 
 
 		mDropOverlayMat = BuiltinMaterialManager::instance().createDockDropOverlayMaterial();
 		mDropOverlayMat = BuiltinMaterialManager::instance().createDockDropOverlayMaterial();
 
 
-		RendererManager::instance().getActive()->addRenderCallback(parent->getTarget(), boost::bind(&DockManager::render, this, _1, _2));
-
-		GUIManager::instance().mouseEventFilter.connect(boost::bind(&DockManager::onGUIMouseEvent, this, _1, _2, _3));
+		RendererManager::instance().getActive()->addRenderCallback(mParent->getTarget(), boost::bind(&DockManager::render, this, _1, _2));
 	}
 	}
 
 
 	DockManager::~DockManager()
 	DockManager::~DockManager()
@@ -276,6 +275,11 @@ namespace BansheeEditor
 		cm_deleteN(mRightDropPolygon, 4);
 		cm_deleteN(mRightDropPolygon, 4);
 	}
 	}
 
 
+	DockManager* DockManager::create(GUIWidget& parent, RenderWindow* parentWindow)
+	{
+		return new (cm_alloc<DockManager, PoolAlloc>()) DockManager(parent, parentWindow, GUILayoutOptions::create(&GUISkin::DefaultStyle));
+	}
+
 	void DockManager::update()
 	void DockManager::update()
 	{
 	{
 		if(!DragAndDropManager::instance().isDragInProgress())
 		if(!DragAndDropManager::instance().isDragInProgress())
@@ -370,6 +374,12 @@ namespace BansheeEditor
 		updateDropOverlay(x, y, width, height);
 		updateDropOverlay(x, y, width, height);
 	}
 	}
 
 
+	void DockManager::updateClippedBounds()
+	{
+		// TODO - Clipping not actually accounted for
+		mClippedBounds = mRootContainer.mArea;
+	}
+
 	void DockManager::updateDropOverlay(INT32 x, INT32 y, UINT32 width, UINT32 height)
 	void DockManager::updateDropOverlay(INT32 x, INT32 y, UINT32 width, UINT32 height)
 	{
 	{
 		const static int spacing = 10;
 		const static int spacing = 10;
@@ -523,11 +533,8 @@ namespace BansheeEditor
 		mDropOverlayMesh = Mesh::create(meshData);
 		mDropOverlayMesh = Mesh::create(meshData);
 	}
 	}
 
 
-	bool DockManager::onGUIMouseEvent(GUIWidget* widget, GUIElement* element, const GUIMouseEvent& event)
+	bool DockManager::mouseEvent(const GUIMouseEvent& event)
 	{
 	{
-		if(widget->getTarget() != mParent->getTarget())
-			return false;
-
 		if(event.getType() == GUIMouseEventType::MouseDragAndDropDragged)
 		if(event.getType() == GUIMouseEventType::MouseDragAndDropDragged)
 		{
 		{
 			if(DragAndDropManager::instance().getDragTypeId() != (UINT32)DragAndDropType::EditorWidget)
 			if(DragAndDropManager::instance().getDragTypeId() != (UINT32)DragAndDropType::EditorWidget)
@@ -535,7 +542,7 @@ namespace BansheeEditor
 
 
 			const Vector2I& widgetRelPos = event.getPosition();
 			const Vector2I& widgetRelPos = event.getPosition();
 
 
-			const Matrix4& worldTfrm = widget->SO()->getWorldTfrm();
+			const Matrix4& worldTfrm = mParent->SO()->getWorldTfrm();
 
 
 			Vector4 tfrmdPos = worldTfrm.multiply3x4(Vector4((float)widgetRelPos.x, (float)widgetRelPos.y, 0.0f, 1.0f));
 			Vector4 tfrmdPos = worldTfrm.multiply3x4(Vector4((float)widgetRelPos.x, (float)widgetRelPos.y, 0.0f, 1.0f));
 			Vector2 windowPosVec(tfrmdPos.x, tfrmdPos.y);
 			Vector2 windowPosVec(tfrmdPos.x, tfrmdPos.y);
@@ -593,7 +600,7 @@ namespace BansheeEditor
 			EditorWidget* draggedWidget = reinterpret_cast<EditorWidget*>(DragAndDropManager::instance().getDragData());
 			EditorWidget* draggedWidget = reinterpret_cast<EditorWidget*>(DragAndDropManager::instance().getDragData());
 
 
 			const Vector2I& widgetRelPos = event.getPosition();
 			const Vector2I& widgetRelPos = event.getPosition();
-			const Matrix4& worldTfrm = widget->SO()->getWorldTfrm();
+			const Matrix4& worldTfrm = mParent->SO()->getWorldTfrm();
 
 
 			Vector4 tfrmdPos = worldTfrm.multiply3x4(Vector4((float)widgetRelPos.x, (float)widgetRelPos.y, 0.0f, 1.0f));
 			Vector4 tfrmdPos = worldTfrm.multiply3x4(Vector4((float)widgetRelPos.x, (float)widgetRelPos.y, 0.0f, 1.0f));
 			Vector2 windowPosVec(tfrmdPos.x, tfrmdPos.y);
 			Vector2 windowPosVec(tfrmdPos.x, tfrmdPos.y);
@@ -627,6 +634,16 @@ namespace BansheeEditor
 		return false;
 		return false;
 	}
 	}
 
 
+	UINT32 DockManager::getNumChildElements() const
+	{
+		return 0;
+	}
+
+	GUIElement* DockManager::getChildElement(UINT32 idx) const
+	{
+		return nullptr;
+	}
+
 	// TODO - Move to a separate Polygon class?
 	// TODO - Move to a separate Polygon class?
 	bool DockManager::insidePolygon(CM::Vector2* polyPoints, CM::UINT32 numPoints, CM::Vector2 point) const
 	bool DockManager::insidePolygon(CM::Vector2* polyPoints, CM::UINT32 numPoints, CM::Vector2 point) const
 	{
 	{

+ 2 - 2
CamelotClient/Source/BsGUITabbedTitleBar.cpp

@@ -22,7 +22,7 @@ namespace BansheeEditor
 	GUITabbedTitleBar::GUITabbedTitleBar(GUIWidget& parent, RenderWindow* parentWindow, GUIElementStyle* backgroundStyle, GUIElementStyle* tabBtnStyle, 
 	GUITabbedTitleBar::GUITabbedTitleBar(GUIWidget& parent, RenderWindow* parentWindow, GUIElementStyle* backgroundStyle, GUIElementStyle* tabBtnStyle, 
 		GUIElementStyle* minBtnStyle, GUIElementStyle* closeBtnStyle, const GUILayoutOptions& layoutOptions)
 		GUIElementStyle* minBtnStyle, GUIElementStyle* closeBtnStyle, const GUILayoutOptions& layoutOptions)
 		:GUIElementContainer(parent, layoutOptions), mParentWindow(parentWindow), mMinBtn(nullptr), 
 		:GUIElementContainer(parent, layoutOptions), mParentWindow(parentWindow), mMinBtn(nullptr), 
-		mCloseBtn(nullptr), mParentWidget(&parent), mBackgroundImage(nullptr), mUniqueTabIdx(0), mActiveTabIdx(0),
+		mCloseBtn(nullptr), mBackgroundImage(nullptr), mUniqueTabIdx(0), mActiveTabIdx(0),
 		mDragInProgress(false), mDraggedBtn(nullptr), mDragBtnOffset(0), mInitialDragOffset(0), mBackgroundStyle(backgroundStyle),
 		mDragInProgress(false), mDraggedBtn(nullptr), mDragBtnOffset(0), mInitialDragOffset(0), mBackgroundStyle(backgroundStyle),
 		mTabBtnStyle(tabBtnStyle), mMinimizeBtnStyle(minBtnStyle), mCloseBtnStyle(closeBtnStyle)
 		mTabBtnStyle(tabBtnStyle), mMinimizeBtnStyle(minBtnStyle), mCloseBtnStyle(closeBtnStyle)
 	{
 	{
@@ -80,7 +80,7 @@ namespace BansheeEditor
 
 
 	void GUITabbedTitleBar::insertTab(UINT32 idx, const CM::HString& name)
 	void GUITabbedTitleBar::insertTab(UINT32 idx, const CM::HString& name)
 	{
 	{
-		GUITabButton* newTabToggle = GUITabButton::create(*mParentWidget, mTabToggleGroup, mUniqueTabIdx, name, mTabBtnStyle);
+		GUITabButton* newTabToggle = GUITabButton::create(*mParent, mTabToggleGroup, mUniqueTabIdx, name, mTabBtnStyle);
 
 
 		idx = Math::clamp(idx, 0U, (UINT32)mTabButtons.size());
 		idx = Math::clamp(idx, 0U, (UINT32)mTabButtons.size());
 
 

+ 4 - 2
CamelotClient/Source/BsMainEditorWindow.cpp

@@ -28,9 +28,11 @@ namespace BansheeEditor
 	}
 	}
 
 
 	MainEditorWindow::MainEditorWindow(const CM::RenderWindowPtr& renderWindow)
 	MainEditorWindow::MainEditorWindow(const CM::RenderWindowPtr& renderWindow)
-		:EditorWindowBase(renderWindow), mDockManager(cm_new<DockManager>(mGUI.get(), mRenderWindow.get())), 
+		:EditorWindowBase(renderWindow), mDockManager(nullptr), 
 		mMenuBar(cm_new<GUIMenuBar>(mGUI.get(), mRenderWindow.get()))
 		mMenuBar(cm_new<GUIMenuBar>(mGUI.get(), mRenderWindow.get()))
 	{
 	{
+		mDockManager = DockManager::create(*mGUI.get(), mRenderWindow.get());
+
 		updateAreas();
 		updateAreas();
 
 
 		mMenuBar->addMenuItem(L"File/New project", nullptr);
 		mMenuBar->addMenuItem(L"File/New project", nullptr);
@@ -87,7 +89,7 @@ namespace BansheeEditor
 	{
 	{
 		ProfilerOverlay::shutDown();
 		ProfilerOverlay::shutDown();
 
 
-		cm_delete(mDockManager);
+		GUIElement::destroy(mDockManager);
 		cm_delete(mMenuBar);
 		cm_delete(mMenuBar);
 	}
 	}