Mercurial > projects > mde
comparison mde/gui/widget/Widget.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 | c9843fbaac88 |
children | c5c38eaadb64 |
comparison
equal
deleted
inserted
replaced
128:41582439a42b | 129:ad91de8867a0 |
---|---|
157 //END Events | 157 //END Events |
158 | 158 |
159 /* Basic draw method: draw the background (all widgets should do this). */ | 159 /* Basic draw method: draw the background (all widgets should do this). */ |
160 override void draw () { | 160 override void draw () { |
161 mgr.renderer.drawWidgetBack (x,y, w,h); | 161 mgr.renderer.drawWidgetBack (x,y, w,h); |
162 } | |
163 | |
164 // Debug function to print size info. Intended to be correct not optimal. | |
165 debug override void logWidgetSize () { | |
166 logger.trace ("Current size: {,4},{,4}; minimal: {,4},{,4} - {,-50} {}", w,h, this.minWidth, this.minHeight, this, id); | |
162 } | 167 } |
163 | 168 |
164 protected: | 169 protected: |
165 /********************************************************************************************** | 170 /********************************************************************************************** |
166 * Widgets may use W*Check as a utility to check for existance of data. Its use is encouraged, | 171 * Widgets may use W*Check as a utility to check for existance of data. Its use is encouraged, |
243 return i; | 248 return i; |
244 | 249 |
245 throw new GuiException ("getWidgetIndex: widget not found (code error)"); | 250 throw new GuiException ("getWidgetIndex: widget not found (code error)"); |
246 } | 251 } |
247 | 252 |
253 debug override void logWidgetSize () { | |
254 super.logWidgetSize; | |
255 foreach (widg; subWidgets) | |
256 widg.logWidgetSize; | |
257 } | |
258 | |
248 protected: | 259 protected: |
249 IChildWidget[] subWidgets; | 260 IChildWidget[] subWidgets; |
250 } | 261 } |
251 /** ditto */ | 262 /** ditto */ |
252 abstract class AParentSingleWidget : AWidget | 263 abstract class AParentSingleWidget : AWidget |
261 return subWidget.setup (n,flags); | 272 return subWidget.setup (n,flags); |
262 } | 273 } |
263 | 274 |
264 override bool saveChanges () { | 275 override bool saveChanges () { |
265 return subWidget.saveChanges; | 276 return subWidget.saveChanges; |
277 } | |
278 | |
279 debug override void logWidgetSize () { | |
280 super.logWidgetSize; | |
281 subWidget.logWidgetSize; | |
266 } | 282 } |
267 | 283 |
268 protected: | 284 protected: |
269 IChildWidget subWidget; | 285 IChildWidget subWidget; |
270 } | 286 } |