diff options
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index 6412481b..c1c920d2 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -54,6 +54,7 @@ void init_Widget(iWidget *d) { | |||
54 | d->flags = 0; | 54 | d->flags = 0; |
55 | d->rect = zero_Rect(); | 55 | d->rect = zero_Rect(); |
56 | d->minSize = zero_I2(); | 56 | d->minSize = zero_I2(); |
57 | d->sizeRef = NULL; | ||
57 | d->bgColor = none_ColorId; | 58 | d->bgColor = none_ColorId; |
58 | d->frameColor = none_ColorId; | 59 | d->frameColor = none_ColorId; |
59 | init_Anim(&d->visualOffset, 0.0f); | 60 | init_Anim(&d->visualOffset, 0.0f); |
@@ -329,6 +330,9 @@ static void setWidth_Widget_(iWidget *d, int width) { | |||
329 | 330 | ||
330 | static void setHeight_Widget_(iWidget *d, int height) { | 331 | static void setHeight_Widget_(iWidget *d, int height) { |
331 | iAssert(height >= 0); | 332 | iAssert(height >= 0); |
333 | if (d->sizeRef) { | ||
334 | return; /* height defined by another widget */ | ||
335 | } | ||
332 | TRACE(d, "attempt to set height to %d (current: %d, min height: %d)", height, d->rect.size.y, d->minSize.y); | 336 | TRACE(d, "attempt to set height to %d (current: %d, min height: %d)", height, d->rect.size.y, d->minSize.y); |
333 | height = iMax(height, d->minSize.y); | 337 | height = iMax(height, d->minSize.y); |
334 | if (~d->flags & fixedHeight_WidgetFlag) { //} || d->flags & collapse_WidgetFlag) { | 338 | if (~d->flags & fixedHeight_WidgetFlag) { //} || d->flags & collapse_WidgetFlag) { |
@@ -415,6 +419,10 @@ static void boundsOfChildren_Widget_(const iWidget *d, iRect *bounds_out) { | |||
415 | 419 | ||
416 | static void arrange_Widget_(iWidget *d) { | 420 | static void arrange_Widget_(iWidget *d) { |
417 | TRACE(d, "arranging..."); | 421 | TRACE(d, "arranging..."); |
422 | if (d->sizeRef) { | ||
423 | d->rect.size.y = height_Widget(d->sizeRef); | ||
424 | TRACE(d, "use referenced height: %d", d->rect.size.y); | ||
425 | } | ||
418 | if (d->flags & moveToParentLeftEdge_WidgetFlag) { | 426 | if (d->flags & moveToParentLeftEdge_WidgetFlag) { |
419 | d->rect.pos.x = d->padding[0]; /* FIXME: Shouldn't this be d->parent->padding[0]? */ | 427 | d->rect.pos.x = d->padding[0]; /* FIXME: Shouldn't this be d->parent->padding[0]? */ |
420 | TRACE(d, "move to parent left edge: %d", d->rect.pos.x); | 428 | TRACE(d, "move to parent left edge: %d", d->rect.pos.x); |