summaryrefslogtreecommitdiff
path: root/new/stack.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-11 14:30:07 -0400
committerPietro Gagliardi <[email protected]>2015-04-11 14:30:07 -0400
commit0430ca9102b54fd9127d8b998d45f1941c1a278a (patch)
tree3f13950b7d6268716d737df52e60e0d8dc3e670f /new/stack.c
parentb57c885505e7d5f53fef5c28934bbe43908d04e5 (diff)
Implemented making invisible children of uiStacks not count when drawing or calculating preferred size. Need to implement the new methods on uiStack itself before we can test.
Diffstat (limited to 'new/stack.c')
-rw-r--r--new/stack.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/new/stack.c b/new/stack.c
index 4c817d2..3899f83 100644
--- a/new/stack.c
+++ b/new/stack.c
@@ -97,6 +97,8 @@ static void stackPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intma
maxStretchyWidth = 0;
maxStretchyHeight = 0;
for (i = 0; i < s->len; i++) {
+ if (!uiControlVisible(s->controls[i].c))
+ continue;
uiControlPreferredSize(s->controls[i].c, d, &preferredWidth, &preferredHeight);
if (s->controls[i].stretchy) {
nStretchy++;
@@ -157,6 +159,8 @@ static void stackResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, in
stretchyht = height;
nStretchy = 0;
for (i = 0; i < s->len; i++) {
+ if (!uiControlVisible(s->controls[i].c))
+ continue;
if (s->controls[i].stretchy) {
nStretchy++;
continue;
@@ -180,14 +184,19 @@ static void stackResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, in
stretchyht /= nStretchy;
else
stretchywid /= nStretchy;
- for (i = 0; i < s->len; i++)
+ for (i = 0; i < s->len; i++) {
+ if (!uiControlVisible(s->controls[i].c))
+ continue;
if (s->controls[i].stretchy) {
s->controls[i].width = stretchywid;
s->controls[i].height = stretchyht;
}
+ }
// 3) now we can position controls
for (i = 0; i < s->len; i++) {
+ if (!uiControlVisible(s->controls[i].c))
+ continue;
uiControlResize(s->controls[i].c, x, y, s->controls[i].width, s->controls[i].height, d);
if (s->vertical)
y += s->controls[i].height + ypadding;