Mercurial > projects > mde
diff mde/gui/widget/layout.d @ 66:f54ae4fc2b2f
Replaced IWidget.getMinimalSize(out w,out h) with minWidth() and minHeight().
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 02 Jul 2008 17:10:07 +0100 |
parents | 891211f034f2 |
children | 77c7d3235114 |
line wrap: on
line diff
--- a/mde/gui/widget/layout.d Sun Jun 29 15:40:37 2008 +0100 +++ b/mde/gui/widget/layout.d Wed Jul 02 17:10:07 2008 +0100 @@ -35,6 +35,10 @@ * Since a grid with either dimension zero is not useful, there must be at least one sub-widget. * * The grid has no border but has spacing between widgets. */ +/* TODO: + separate positioning & sub-widget handling from creation/saving + other types of layouts (e.g. lists from content) +*/ class GridLayoutWidget : Widget { //BEGIN Creation & saving @@ -137,12 +141,6 @@ return row.firstSizable >= 0; } - /* Calculates the minimal size from all rows and columns of widgets. */ - void getMinimalSize (out wdim mw, out wdim mh) { - mw = this.mw; - mh = this.mh; - } - void setWidth (wdim nw, int dir) { if (nw == w) return; @@ -223,15 +221,14 @@ // set length, making sure the arrays are initialised to zero: col.minWidth = new wdim[cols]; row.minWidth = new wdim[rows]; - wdim ww, wh; // sub-widget minimal sizes foreach (i,widget; subWidgets) { - widget.getMinimalSize (ww, wh); - // Increase dimensions if current minimal size is larger: myIt n = i % cols; // column - if (col.minWidth[n] < ww) col.minWidth[n] = ww; + wdim md = widget.minWidth; + if (col.minWidth[n] < md) col.minWidth[n] = md; n = i / cols; // row - if (row.minWidth[n] < wh) row.minWidth[n] = wh; + md = widget.minHeight; + if (row.minWidth[n] < md) row.minWidth[n] = md; }