Mercurial > projects > mde
comparison mde/gui/WidgetManager.d @ 112:fe061009029d
EnumContent; log level can be selected from a popup list.
New EnumContent, with code to load translations in Items. Editable as an AStringContent.
Hacked OptionsMisc to use an EnumContent.
Implemented a EnumContentWidget providing a pop-up list to select from (still needs improving).
Moved IContent to its own module.
ContentExceptions thrown via WDCCheck now.
Fixed a small bug with reloading translations.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 13 Dec 2008 12:54:43 +0000 |
parents | 1655693702fc |
children | 9824bee909fd |
comparison
equal
deleted
inserted
replaced
111:1655693702fc | 112:fe061009029d |
---|---|
189 if (y < 0) y = 0; | 189 if (y < 0) y = 0; |
190 widget.setPosition (x, y); | 190 widget.setPosition (x, y); |
191 } | 191 } |
192 popups.prepend (popup); | 192 popups.prepend (popup); |
193 } | 193 } |
194 void removePopup (IChildWidget widg) { //FIXME: not optimal (maybe change popups though?) | |
195 auto i = popups.iterator; | |
196 foreach (popup; i) { | |
197 if (popup.widget is widg) | |
198 i.remove; | |
199 } | |
200 requestRedraw; | |
201 } | |
194 | 202 |
195 void requestRedraw () { | 203 void requestRedraw () { |
196 imde.mainSchedule.request(imde.SCHEDULE.DRAW); | 204 imde.mainSchedule.request(imde.SCHEDULE.DRAW); |
197 } | 205 } |
198 | 206 |
245 wdabs x,y; | 253 wdabs x,y; |
246 wdsize w,h; | 254 wdsize w,h; |
247 } | 255 } |
248 IRenderer rend; | 256 IRenderer rend; |
249 CircularList!(ActivePopup) popups;// Pop-up [menus] to draw. First element is top popup. | 257 CircularList!(ActivePopup) popups;// Pop-up [menus] to draw. First element is top popup. |
250 wdim w,h; // area available to the widgets | |
251 wdim mw,mh; // minimal area required by widgets (ideally for limiting w,h) | |
252 // callbacks indexed by their frame pointers: | 258 // callbacks indexed by their frame pointers: |
253 bool delegate(wdabs cx, wdabs cy, ubyte b, bool state) [void*] clickCallbacks; | 259 bool delegate(wdabs cx, wdabs cy, ubyte b, bool state) [void*] clickCallbacks; |
254 void delegate(wdabs cx, wdabs cy) [void*] motionCallbacks; | 260 void delegate(wdabs cx, wdabs cy) [void*] motionCallbacks; |
255 IChildWidget keyFocus; // widget receiving keyboard input when non-null | 261 IChildWidget keyFocus; // widget receiving keyboard input when non-null |
256 } | 262 } |
257 | 263 |
258 | 264 |
259 import mde.gui.exception; | 265 import mde.gui.exception; |
260 import mde.gui.widget.Ifaces; | 266 import mde.content.Content; // AContent passed to a callback |
261 import mde.content.Content; | |
262 import mde.gui.widget.createWidget; | 267 import mde.gui.widget.createWidget; |
263 | 268 |
264 import mde.file.mergetag.Reader; | 269 import mde.file.mergetag.Reader; |
265 import mde.file.mergetag.Writer; | 270 import mde.file.mergetag.Writer; |
266 import mde.setup.paths; | 271 import mde.setup.paths; |
444 return data.keys; | 449 return data.keys; |
445 } | 450 } |
446 } | 451 } |
447 | 452 |
448 /** Called when translation strings have been reloaded. */ | 453 /** Called when translation strings have been reloaded. */ |
449 void reloadStrings (AContent c) { | 454 void reloadStrings (AContent) { |
450 Items.loadTranslation; | 455 Items.loadTranslation; |
451 child.setup (++setupN, 2); | 456 child.setup (++setupN, 2); |
457 child.setWidth (w, -1); | |
458 child.setHeight (h, -1); | |
452 child.setPosition (0,0); | 459 child.setPosition (0,0); |
453 requestRedraw; | 460 requestRedraw; |
454 } | 461 } |
455 | 462 |
456 protected: | 463 protected: |
507 WidgetDataSet curData; // Current data | 514 WidgetDataSet curData; // Current data |
508 WidgetDataChanges changes; // Changes for the current design. | 515 WidgetDataChanges changes; // Changes for the current design. |
509 scope mt.DataSet changesDS; // changes and sections from user file (used for saving) | 516 scope mt.DataSet changesDS; // changes and sections from user file (used for saving) |
510 bool loadUserFile = true; // still need to load user file for saving? | 517 bool loadUserFile = true; // still need to load user file for saving? |
511 | 518 |
519 wdim w,h; // area available to the widgets | |
520 wdim mw,mh; // minimal area required by widgets (ideally for limiting w,h) | |
512 scope IChildWidget child; // The primary widget. | 521 scope IChildWidget child; // The primary widget. |
513 uint setupN; // n to pass to IChildWidget.setup | 522 uint setupN; // n to pass to IChildWidget.setup |
514 | 523 |
515 Mutex mutex; // lock on methods for use outside the package. | 524 Mutex mutex; // lock on methods for use outside the package. |
516 } | 525 } |