← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2489: Fix container layout

 

------------------------------------------------------------
revno: 2489
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Wed 2011-04-13 22:18:48 +0200
message:
  Fix container layout
modified:
  dwt/include/dwt/widgets/Container.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/include/dwt/widgets/Container.h'
--- dwt/include/dwt/widgets/Container.h	2011-03-28 19:37:33 +0000
+++ dwt/include/dwt/widgets/Container.h	2011-04-13 20:18:48 +0000
@@ -59,6 +59,7 @@
 	// Use our seed type
 	void create( const Seed& cs = Seed() );
 
+	virtual void layout();
 protected:
 	Container(Widget* parent, Dispatcher& dispatcher = NormalDispatcher::getDefault()) :
 		 BaseType(parent, dispatcher) { }
@@ -73,5 +74,13 @@
 	onWindowPosChanged([this] (const Rectangle &) { this->layout(); });
 }
 
+inline void Container::layout() {
+	// Default layout is to give the first child the whole client area
+	auto c = getChildren<Control>();
+	if(c.first != c.second) {
+		(*c.first)->resize(Rectangle(getClientSize()));
+	}
+}
+
 }
 #endif /*CONTAINER_H_*/