comparison 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
comparison
equal deleted inserted replaced
128:41582439a42b 129:ad91de8867a0
132 EventContent content; 132 EventContent content;
133 int index; 133 int index;
134 } 134 }
135 135
136 /** A "tab" widget: it doesn't display the tabs, but shows one of a number of widgets dependant on 136 /** A "tab" widget: it doesn't display the tabs, but shows one of a number of widgets dependant on
137 * an EnumContent. */ 137 * an EnumContent.
138 *
139 * Sizability is set once (currently true if any widget is sizable). Size is kept when switching
140 * widgets if allowed (if this is large enough and resizable). */
138 class SwitchWidget : AParentWidget 141 class SwitchWidget : AParentWidget
139 { 142 {
140 this (IWidgetManager mgr, IParentWidget parent, widgetID id, WidgetData data, IContent c) { 143 this (IWidgetManager mgr, IParentWidget parent, widgetID id, WidgetData data, IContent c) {
141 super (mgr, parent, id); 144 super (mgr, parent, id);
142 content = cast(EnumContent) c; 145 content = cast(EnumContent) c;
212 currentW = subWidgets[content()]; 215 currentW = subWidgets[content()];
213 mw = currentW.minWidth; 216 mw = currentW.minWidth;
214 mh = currentW.minHeight; 217 mh = currentW.minHeight;
215 parent.minWChange (this, mw); 218 parent.minWChange (this, mw);
216 parent.minHChange (this, mh); 219 parent.minHChange (this, mh);
217 w = currentW.width; 220 // If resizable and already large enough, don't resize; else do.
218 h = currentW.height; 221 if (isWS && w > mw) currentW.setWidth (w, -1);
222 else w = currentW.width;
223 if (isHS && h > mh) currentW.setHeight (h, -1);
224 else h = currentW.height;
219 currentW.setPosition (x,y); 225 currentW.setPosition (x,y);
220 } 226 }
221 227
222 IChildWidget currentW; 228 IChildWidget currentW;
223 EnumContent content; 229 EnumContent content;