Mercurial > projects > mde
comparison mde/gui/widget/AParentWidget.d @ 172:0dd49f333189
Implemented "void setContent (IContent)".
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 29 Jul 2009 20:28:22 +0200 |
parents | 7f7b2011b759 |
children | a1ba9157510e |
comparison
equal
deleted
inserted
replaced
171:7f7b2011b759 | 172:0dd49f333189 |
---|---|
215 * Not "really" a widget (zero size, no direct interaction), but a handler for | 215 * Not "really" a widget (zero size, no direct interaction), but a handler for |
216 * popup widgets. | 216 * popup widgets. |
217 * | 217 * |
218 * Intended to manage a context menu for WidgetManager, and not to work quite | 218 * Intended to manage a context menu for WidgetManager, and not to work quite |
219 * like a regular IPPW. | 219 * like a regular IPPW. |
220 * | |
221 * Doesn't implement all the IChildWidget methods that would be relevent, | |
222 * because it's not used like a regular widget. | |
220 *****************************************************************************/ | 223 *****************************************************************************/ |
221 class PopupHandlerWidget : APopupParentWidget | 224 class PopupHandlerWidget : APopupParentWidget |
222 { | 225 { |
223 this (IWidgetManager mgr, IParentWidget parent, widgetID id, char[] subWidg, IContent c) { | 226 this (IWidgetManager mgr, IParentWidget parent, widgetID id, char[] subWidg, IContent c) { |
227 assert (parent is mgr); // we're not meant to be used like a normal widget | |
224 super (mgr, parent, id); | 228 super (mgr, parent, id); |
225 | 229 |
226 popup = mgr.makeWidget (this, subWidg, c); | 230 popup = mgr.makeWidget (this, subWidg, c); |
227 subWidgets = [popup]; | 231 subWidgets = [popup]; |
228 | 232 |
231 } | 235 } |
232 | 236 |
233 /// Open a context menu | 237 /// Open a context menu |
234 void openMenu (IChildWidget underMouse, Content contextContent) { | 238 void openMenu (IChildWidget underMouse, Content contextContent) { |
235 if (mAIPPW != MenuPosition.INACTIVE) return; // already in use | 239 if (mAIPPW != MenuPosition.INACTIVE) return; // already in use |
236 //TODO: | 240 subWidgets[0].setContent = contextContent; |
237 //subWidgets[0].setContent (contextContent); | |
238 parentIPPW.addChildIPPW (this); | 241 parentIPPW.addChildIPPW (this); |
239 // For context menus, don't set parentIPPW.menuActive like for clicked menus: | 242 // For context menus, don't set parentIPPW.menuActive like for clicked menus: |
240 menuActive = mgr.positionPopup (underMouse, popup); | 243 menuActive = mgr.positionPopup (underMouse, popup); |
241 mgr.requestRedraw; | 244 mgr.requestRedraw; |
242 } | 245 } |