comparison mde/gui/widget/AParentWidget.d @ 174:3d58adc17d20

Temporary commit to allow backup
author Diggory Hardy <diggory.hardy@gmail.com>
date Mon, 31 Aug 2009 13:54:23 +0200
parents a1ba9157510e
children af40e9679436
comparison
equal deleted inserted replaced
173:a1ba9157510e 174:3d58adc17d20
56 c |= w.setup (n,flags); 56 c |= w.setup (n,flags);
57 } 57 }
58 return c; 58 return c;
59 } 59 }
60 60
61 override bool saveChanges () { 61 public override bool saveChanges () {
62 bool c = false; 62 bool c = false;
63 foreach (w; subWidgets) 63 foreach (w; subWidgets)
64 c |= w.saveChanges; 64 c |= w.saveChanges;
65 return c; 65 return c;
66 } 66 }
72 72
73 throw new GuiException ("getWidgetIndex: widget not found (code error)"); 73 throw new GuiException ("getWidgetIndex: widget not found (code error)");
74 } 74 }
75 75
76 // Parents taking a content should override, only throwing if both the 76 // Parents taking a content should override, only throwing if both the
77 // widget id and the content are the same (as its it and content). 77 // widget id and the content are the same (as its id and content).
78 override void recursionCheck (widgetID wID, IContent c) { 78 public override void recursionCheck (widgetID wID, IContent c) {
79 debug assert (id !is null && parent !is null, "recursionCheck called before parent and id set"); 79 debug assert (id !is null && parent !is null, "recursionCheck called before parent and id set");
80 if (wID == id) 80 if (wID is id)
81 throw new WidgetRecursionException (wID); 81 throw new WidgetRecursionException (wID);
82 parent.recursionCheck (wID, c); 82 parent.recursionCheck (wID, c);
83 } 83 }
84 84
85 IPopupParentWidget getParentIPPW () { 85 public override 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 // They must at a minimum make sure widget's size is at least nmw by nmh. 90 // They must at a minimum make sure widget's size is at least nmw by nmh.
91 override void minWChange (IChildWidget widget, wdim nmw) { 91 public override void minWChange (IChildWidget widget, wdim nmw) {
92 if (widget.width < nmw) 92 if (widget.width < nmw)
93 widget.setWidth (nmw, -1); 93 widget.setWidth (nmw, -1);
94 } 94 }
95 override void minHChange (IChildWidget widget, wdim nmh) { 95 public override void minHChange (IChildWidget widget, wdim nmh) {
96 if (widget.height < nmh) 96 if (widget.height < nmh)
97 widget.setHeight (nmh, -1); 97 widget.setHeight (nmh, -1);
98 } 98 }
99 99
100 debug override void logWidgetSize () { 100 debug public override void logWidgetSize () {
101 super.logWidgetSize; 101 super.logWidgetSize;
102 foreach (widg; subWidgets) 102 foreach (widg; subWidgets)
103 widg.logWidgetSize; 103 widg.logWidgetSize;
104 } 104 }
105 105
189 popup.draw; 189 popup.draw;
190 if (childIPPW) 190 if (childIPPW)
191 childIPPW.drawPopup; 191 childIPPW.drawPopup;
192 } 192 }
193 193
194 debug invariant () { 194 debug invariant {
195 // True as long as removedIPPW gets called: 195 // True as long as removedIPPW gets called:
196 if (!parentIPPW.isChild (this)) { 196 /+TODO:
197 if (!parentIPPW.isChild (this)) {
197 assert (childIPPW is null, "APPW: childIPPW"); 198 assert (childIPPW is null, "APPW: childIPPW");
198 assert (mAIPPW is false, "APPW: mAIPPW"); 199 assert (mAIPPW is false, "APPW: mAIPPW");
199 } 200 }+/
201 }
202
203 debug override bool isChild (IPopupParentWidget ippw) {
204 return ippw is childIPPW;
200 } 205 }
201 206
202 protected: 207 protected:
203 // How to activate a popup: 208 // How to activate a popup:
204 /+void activatePopup (IChildWidget widget) { 209 /+void activatePopup (IChildWidget widget) {
205 parentIPPW.addChildIPPW (this); 210 parentIPPW.addChildIPPW (this);
206 popup = widget; 211 popup = widget;
207 mgr.positionPopup (this, popup); 212 mgr.positionPopup (this, popup);
208 }+/ 213 }+/
209
210 debug override bool isChild (IPopupParentWidget ippw) {
211 return ippw is childIPPW;
212 }
213 214
214 IPopupParentWidget parentIPPW; 215 IPopupParentWidget parentIPPW;
215 IPopupParentWidget childIPPW; 216 IPopupParentWidget childIPPW;
216 IChildWidget popup; 217 IChildWidget popup;
217 MenuPosition mAIPPW; 218 MenuPosition mAIPPW;