Browse Source

Fixed an issue where editor window non-client areas were not properly set up right after creation

Marko Pintera 10 years ago
parent
commit
7f224d0279

+ 1 - 0
BansheeEditor/Include/BsEditorWidgetContainer.h

@@ -32,6 +32,7 @@ namespace BansheeEngine
 
 
 		void _notifyWidgetDestroyed(EditorWidgetBase* widget);
 		void _notifyWidgetDestroyed(EditorWidgetBase* widget);
 
 
+		Event<void()> onWidgetAdded;
 		Event<void()> onWidgetClosed;
 		Event<void()> onWidgetClosed;
 	private:
 	private:
 		EditorWindowBase* mParentWindow;
 		EditorWindowBase* mParentWindow;

+ 1 - 0
BansheeEditor/Include/BsEditorWindow.h

@@ -25,6 +25,7 @@ namespace BansheeEngine
 		EditorWidgetContainer* mWidgets;
 		EditorWidgetContainer* mWidgets;
 
 
 		void updateSize();
 		void updateSize();
+		void widgetAdded();
 		void widgetRemoved();
 		void widgetRemoved();
 		void closeWindowDelayed();
 		void closeWindowDelayed();
 	};
 	};

+ 2 - 0
BansheeEditor/Source/BsEditorWidgetContainer.cpp

@@ -108,6 +108,8 @@ namespace BansheeEngine
 			setActiveWidget(mTitleBar->getTabIdx(mTitleBar->getNumTabs() - 1));
 			setActiveWidget(mTitleBar->getTabIdx(mTitleBar->getNumTabs() - 1));
 		else
 		else
 			widget._disable();
 			widget._disable();
+
+		onWidgetAdded();
 	}
 	}
 
 
 	bool EditorWidgetContainer::contains(EditorWidgetBase& widget)
 	bool EditorWidgetContainer::contains(EditorWidgetBase& widget)

+ 6 - 0
BansheeEditor/Source/BsEditorWindow.cpp

@@ -11,6 +11,7 @@ namespace BansheeEngine
 	{
 	{
 		updateSize();
 		updateSize();
 		
 		
+		mWidgets->onWidgetAdded.connect(std::bind(&EditorWindow::widgetAdded, this));
 		mWidgets->onWidgetClosed.connect(std::bind(&EditorWindow::widgetRemoved, this));
 		mWidgets->onWidgetClosed.connect(std::bind(&EditorWindow::widgetRemoved, this));
 	}
 	}
 
 
@@ -43,6 +44,11 @@ namespace BansheeEngine
 		Platform::setCaptionNonClientAreas(*mRenderWindow->getCore().get(), mWidgets->getDraggableAreas());
 		Platform::setCaptionNonClientAreas(*mRenderWindow->getCore().get(), mWidgets->getDraggableAreas());
 	}
 	}
 
 
+	void EditorWindow::widgetAdded()
+	{
+		Platform::setCaptionNonClientAreas(*mRenderWindow->getCore().get(), mWidgets->getDraggableAreas());
+	}
+
 	void EditorWindow::widgetRemoved()
 	void EditorWindow::widgetRemoved()
 	{
 	{
 		if(mWidgets->getNumWidgets() == 0)
 		if(mWidgets->getNumWidgets() == 0)

+ 1 - 1
TODO.txt

@@ -67,7 +67,7 @@ Click on empty part of the menu bar doesn't close the menu bar (ignoring NC area
 Clicking on a parent of a menu item just reopens that item but I would expect it to close it
 Clicking on a parent of a menu item just reopens that item but I would expect it to close it
 Clicking on menu items doesn't seem to work
 Clicking on menu items doesn't seem to work
 Attempting to dock a window that is not in focus will start drag instead (NC area incorrectly set up?)
 Attempting to dock a window that is not in focus will start drag instead (NC area incorrectly set up?)
-Dropping an element in "None" dock area closes the window
+Docking a window to another windows title bar doesn't seem to work
 Decent looking default layout
 Decent looking default layout
 Fix DX11 (and possibly DX9) rendering
 Fix DX11 (and possibly DX9) rendering
 Missing Inspector values (name + transform fields)
 Missing Inspector values (name + transform fields)