Mercurial > projects > mde
diff mde/gui/widget/miscContent.d @ 129:ad91de8867a0
Added a widget size printing debug function. Fixed a bug in SwitchWidget.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 15 Jan 2009 16:52:46 +0000 |
parents | 41582439a42b |
children | c5c38eaadb64 |
line wrap: on
line diff
--- a/mde/gui/widget/miscContent.d Wed Jan 14 20:24:14 2009 +0000 +++ b/mde/gui/widget/miscContent.d Thu Jan 15 16:52:46 2009 +0000 @@ -134,7 +134,10 @@ } /** A "tab" widget: it doesn't display the tabs, but shows one of a number of widgets dependant on - * an EnumContent. */ + * an EnumContent. + * + * Sizability is set once (currently true if any widget is sizable). Size is kept when switching + * widgets if allowed (if this is large enough and resizable). */ class SwitchWidget : AParentWidget { this (IWidgetManager mgr, IParentWidget parent, widgetID id, WidgetData data, IContent c) { @@ -214,8 +217,11 @@ mh = currentW.minHeight; parent.minWChange (this, mw); parent.minHChange (this, mh); - w = currentW.width; - h = currentW.height; + // If resizable and already large enough, don't resize; else do. + if (isWS && w > mw) currentW.setWidth (w, -1); + else w = currentW.width; + if (isHS && h > mh) currentW.setHeight (h, -1); + else h = currentW.height; currentW.setPosition (x,y); }