Mercurial > projects > mde
comparison mde/gui/widget/AParentWidget.d @ 173:a1ba9157510e
Enabled ServiceContentList to call its callbacks when its value changes. Tried to fix some other bugs, but this is not a very clean commit, due to wanting to make some big changes to enable better use of invariants next.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 08 Aug 2009 15:53:10 +0200 |
parents | 0dd49f333189 |
children | 3d58adc17d20 |
comparison
equal
deleted
inserted
replaced
172:0dd49f333189 | 173:a1ba9157510e |
---|---|
85 IPopupParentWidget getParentIPPW () { | 85 IPopupParentWidget getParentIPPW () { |
86 return parent.getParentIPPW; | 86 return parent.getParentIPPW; |
87 } | 87 } |
88 | 88 |
89 // Most parent widgets need to implement these, although not all | 89 // Most parent widgets need to implement these, although not all |
90 void minWChange (IChildWidget widget, wdim mw) {} | 90 // They must at a minimum make sure widget's size is at least nmw by nmh. |
91 void minHChange (IChildWidget widget, wdim mh) {} | 91 override void minWChange (IChildWidget widget, wdim nmw) { |
92 if (widget.width < nmw) | |
93 widget.setWidth (nmw, -1); | |
94 } | |
95 override void minHChange (IChildWidget widget, wdim nmh) { | |
96 if (widget.height < nmh) | |
97 widget.setHeight (nmh, -1); | |
98 } | |
92 | 99 |
93 debug override void logWidgetSize () { | 100 debug override void logWidgetSize () { |
94 super.logWidgetSize; | 101 super.logWidgetSize; |
95 foreach (widg; subWidgets) | 102 foreach (widg; subWidgets) |
96 widg.logWidgetSize; | 103 widg.logWidgetSize; |
235 } | 242 } |
236 | 243 |
237 /// Open a context menu | 244 /// Open a context menu |
238 void openMenu (IChildWidget underMouse, Content contextContent) { | 245 void openMenu (IChildWidget underMouse, Content contextContent) { |
239 if (mAIPPW != MenuPosition.INACTIVE) return; // already in use | 246 if (mAIPPW != MenuPosition.INACTIVE) return; // already in use |
240 subWidgets[0].setContent = contextContent; | 247 //NOTE: Disabled since it doesn't work correctly atm: |
248 //subWidgets[0].setContent = contextContent; | |
241 parentIPPW.addChildIPPW (this); | 249 parentIPPW.addChildIPPW (this); |
242 // For context menus, don't set parentIPPW.menuActive like for clicked menus: | 250 // For context menus, don't set parentIPPW.menuActive like for clicked menus: |
243 menuActive = mgr.positionPopup (underMouse, popup); | 251 menuActive = mgr.positionPopup (underMouse, popup); |
244 mgr.requestRedraw; | 252 mgr.requestRedraw; |
245 } | 253 } |