comparison mde/gui/widget/AParentWidget.d @ 152:c67d074a7111

Menu placement now takes into account left/right placement of parent menus.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 10 Apr 2009 15:19:46 +0200
parents 9f035cd139c6
children 7f7b2011b759
comparison
equal deleted inserted replaced
151:e785e98d3b78 152:c67d074a7111
128 override bool removeChildIPPW (IPopupParentWidget ippw) { 128 override bool removeChildIPPW (IPopupParentWidget ippw) {
129 if (childIPPW !is ippw) return false; 129 if (childIPPW !is ippw) return false;
130 childIPPW.removedIPPW; 130 childIPPW.removedIPPW;
131 childIPPW = null; 131 childIPPW = null;
132 mgr.requestRedraw; 132 mgr.requestRedraw;
133 mAIPPW = false; 133 mAIPPW = MenuPosition.INACTIVE;
134 return true; 134 return true;
135 } 135 }
136 136
137 // If this function is overriden, you MUST still call it (super.removedIPPW)! 137 // If this function is overriden, you MUST still call it (super.removedIPPW)!
138 // Or invariant will throw assert errors. 138 // Or invariant will throw assert errors.
139 override void removedIPPW () { 139 override void removedIPPW () {
140 if (childIPPW) { 140 if (childIPPW) {
141 childIPPW.removedIPPW; 141 childIPPW.removedIPPW;
142 childIPPW = null; 142 childIPPW = null;
143 } 143 }
144 mAIPPW = false; 144 mAIPPW = MenuPosition.INACTIVE;
145 } 145 }
146 146
147 override void menuActive (bool mA) { 147 override void menuActive (MenuPosition mA) {
148 mAIPPW = mA; 148 mAIPPW = mA;
149 if (childIPPW) 149 if (childIPPW)
150 childIPPW.menuActive = mA; 150 childIPPW.menuActive = mA;
151 } 151 }
152 override bool menuActive () { 152 override MenuPosition menuActive () {
153 return mAIPPW; 153 return mAIPPW;
154 } 154 }
155 override bool parentMenuActive () { 155 override MenuPosition parentMenuActive () {
156 return parentIPPW.menuActive; 156 return parentIPPW.menuActive;
157 } 157 }
158 158
159 override void menuDone () { // default actions, for popup menus: 159 override void menuDone () { // default actions, for popup menus:
160 parentIPPW.removeChildIPPW (this); // remove self 160 parentIPPW.removeChildIPPW (this); // remove self
164 override IChildWidget getPopupWidget (wdabs cx, wdabs cy, bool closePopup) { 164 override IChildWidget getPopupWidget (wdabs cx, wdabs cy, bool closePopup) {
165 IChildWidget ret; 165 IChildWidget ret;
166 if (childIPPW) { 166 if (childIPPW) {
167 ret = childIPPW.getPopupWidget (cx, cy, closePopup); 167 ret = childIPPW.getPopupWidget (cx, cy, closePopup);
168 if (closePopup && ret is null) { 168 if (closePopup && ret is null) {
169 menuActive = false; 169 menuActive = MenuPosition.INACTIVE;
170 removeChildIPPW (childIPPW); 170 removeChildIPPW (childIPPW);
171 } 171 }
172 } 172 }
173 if (ret is null) { 173 if (ret is null) {
174 if (popup.onSelf (cx, cy)) 174 if (popup.onSelf (cx, cy))
206 } 206 }
207 207
208 IPopupParentWidget parentIPPW; 208 IPopupParentWidget parentIPPW;
209 IPopupParentWidget childIPPW; 209 IPopupParentWidget childIPPW;
210 IChildWidget popup; 210 IChildWidget popup;
211 bool mAIPPW; 211 MenuPosition mAIPPW;
212 } 212 }