Mercurial > projects > mde
comparison mde/gui/widget/layout.d @ 113:9824bee909fd
Popup menu; works for simple menus except that clicking an item doesn't close it.
Revised popup support a bit; EnumContentWidget is broken and due to be replaced.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 19 Dec 2008 10:32:28 +0000 |
parents | fe061009029d |
children | b16a534f5302 |
comparison
equal
deleted
inserted
replaced
112:fe061009029d | 113:9824bee909fd |
---|---|
97 * ContentList. | 97 * ContentList. |
98 *************************************************************************************************/ | 98 *************************************************************************************************/ |
99 class ContentListWidget : GridWidget | 99 class ContentListWidget : GridWidget |
100 { | 100 { |
101 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent content) { | 101 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent content) { |
102 debug scope (failure) | |
103 logger.warn ("TrialContentLayoutWidget: failure"); | |
104 cList = cast(ContentList) content; | 102 cList = cast(ContentList) content; |
105 WDCCheck (data, 2, 1, cList); | 103 WDCCheck (data, 2, 1, cList); |
106 | 104 |
107 cols = 1; | 105 cols = 1; |
108 if ((rows = cList.list.length) > 0) { | 106 if ((rows = cList.list.length) > 0) { |
233 | 231 |
234 | 232 |
235 // Find the relevant widget. | 233 // Find the relevant widget. |
236 IChildWidget getWidget (wdim cx, wdim cy) { | 234 IChildWidget getWidget (wdim cx, wdim cy) { |
237 debug scope (failure) | 235 debug scope (failure) |
238 logger.warn ("getWidget: failure; values: click, pos, width - {}, {}, {} - {}, {}, {}", cx, x, w, cy, y, h); | 236 logger.warn ("getWidget: failure; values: click; pos; width: {},{}; {},{}; {},{}", cx, cy, x, y, w, h); |
239 debug assert (cx >= x && cx < x + w && cy >= y && cy < y + h, "getWidget: not on widget (code error)"); | 237 debug assert (cx >= x && cx < x + w && cy >= y && cy < y + h, "getWidget: not on widget (code error)"); |
240 | 238 |
241 // Find row/column: | 239 // Find row/column: |
242 myDiff i = col.getCell (cx - x); | 240 myDiff i = col.getCell (cx - x); |
243 myDiff j = row.getCell (cy - y); | 241 myDiff j = row.getCell (cy - y); |
289 * (col and row). subWidgets need to know their minimal size and resizability. */ | 287 * (col and row). subWidgets need to know their minimal size and resizability. */ |
290 void setupAlignDimData (uint n, uint flags) { | 288 void setupAlignDimData (uint n, uint flags) { |
291 if (sADD_n == n) return; // cached data is current | 289 if (sADD_n == n) return; // cached data is current |
292 sADD_n = n; | 290 sADD_n = n; |
293 | 291 |
294 foreach (widg; subWidgets) // make sure all subwidgets have been set up | 292 foreach (widg; subWidgets) { // make sure all subwidgets have been set up |
293 debug assert (widg); | |
295 widg.setup (n,flags); | 294 widg.setup (n,flags); |
295 } | |
296 // make sure both AlignColumns are set up (since first call to setup(n) calls reset): | 296 // make sure both AlignColumns are set up (since first call to setup(n) calls reset): |
297 col.setup (n, flags); | 297 col.setup (n, flags); |
298 row.setup (n, flags); | 298 row.setup (n, flags); |
299 | 299 |
300 // Note: shared AlignColumns get this set by all sharing GridWidgets | 300 // Note: shared AlignColumns get this set by all sharing GridWidgets |