Mercurial > projects > mde
comparison mde/gui/widget/ParentContent.d @ 179:1f9d00f392bd default tip
Fixed a bug where (non-resizible) widgets wouldn't get shrunk when minimal size decreases, meaning optional context menus are hiden properly now.
Optimised when ServiceContentList.opCall is called, I think without breaking anything.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Tue, 15 Sep 2009 20:09:59 +0200 |
parents | af40e9679436 |
children |
comparison
equal
deleted
inserted
replaced
178:62aa8845edd2 | 179:1f9d00f392bd |
---|---|
206 override void minWChange (IChildWidget widget, wdim nmw) { | 206 override void minWChange (IChildWidget widget, wdim nmw) { |
207 if (widget is currentW) { | 207 if (widget is currentW) { |
208 mw = nmw; | 208 mw = nmw; |
209 parent.minWChange (this, nmw); | 209 parent.minWChange (this, nmw); |
210 } else { // changes won't be seen, but we must follow function spec | 210 } else { // changes won't be seen, but we must follow function spec |
211 if (widget.width < nmw) | 211 if (!widget.isWSizable || widget.width < nmw) |
212 widget.setWidth (nmw, -1); | 212 widget.setWidth (nmw, -1); |
213 } | 213 } |
214 } | 214 } |
215 override void minHChange (IChildWidget widget, wdim nmh) { | 215 override void minHChange (IChildWidget widget, wdim nmh) { |
216 if (widget is currentW) { | 216 if (widget is currentW) { |
217 mh = nmh; | 217 mh = nmh; |
218 parent.minHChange (this, nmh); | 218 parent.minHChange (this, nmh); |
219 } else { | 219 } else { |
220 if (widget.height < nmh) | 220 if (!widget.isHSizable || widget.height < nmh) |
221 widget.setHeight (nmh, -1); | 221 widget.setHeight (nmh, -1); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 override bool isWSizable () { | 225 override bool isWSizable () { |
334 parent.minWChange (this, nmw); | 334 parent.minWChange (this, nmw); |
335 } else // update widget without affecting self | 335 } else // update widget without affecting self |
336 super.minWChange (widget, nmw); | 336 super.minWChange (widget, nmw); |
337 } | 337 } |
338 override void minHChange (IChildWidget widget, wdim nmh) { | 338 override void minHChange (IChildWidget widget, wdim nmh) { |
339 debug assert (widget is subWidgets[0]); | 339 debug assert (widget is subWidgets[0]); |
340 if (display) { | 340 if (display) { |
341 mh = nmh; | 341 mh = nmh; |
342 parent.minHChange (this, nmh); | 342 parent.minHChange (this, nmh); |
343 } else | 343 } else |
344 super.minHChange (widget, nmh); | 344 super.minHChange (widget, nmh); |
384 protected: | 384 protected: |
385 // callback on content_ | 385 // callback on content_ |
386 void cbDisplay (IContent) { | 386 void cbDisplay (IContent) { |
387 if (display == content_()) return; | 387 if (display == content_()) return; |
388 display = content_(); | 388 display = content_(); |
389 logger.trace ("{}.cbDisplay ({})", id, display); | 389 if (display) { |
390 if (display) { | |
391 mw = subWidgets[0].minWidth; | 390 mw = subWidgets[0].minWidth; |
392 mh = subWidgets[0].minHeight; | 391 mh = subWidgets[0].minHeight; |
393 } else { | 392 } else { |
394 mw = mh = 0; | 393 mw = mh = 0; |
395 } | 394 } |
396 parent.minWChange (this, mw); | 395 parent.minWChange (this, mw); |
397 parent.minHChange (this, mh); | 396 parent.minHChange (this, mh); |
398 if (!display) return; | 397 if (!display) return; |
399 // set incase parent didn't: | 398 // set incase parent didn't: |
400 subWidgets[0].setWidth (w, -1); | 399 subWidgets[0].setWidth (w, -1); |
401 subWidgets[0].setHeight (h, -1); | 400 subWidgets[0].setHeight (h, -1); |
402 subWidgets[0].setPosition (x,y); | 401 subWidgets[0].setPosition (x,y); |
403 } | 402 } |