diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-30 12:37:57 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-30 12:37:57 +0300 |
commit | ade0ed91adfaad12a51d3ee19e0077151457670f (patch) | |
tree | 707c1c5e306cadf52e7658b76d991228db8b8fad /src/ui/labelwidget.c | |
parent | 1495d08163a4bfcd5db5f6c3b06f031032c5461f (diff) |
LabelWidget: Implicit minimum size
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r-- | src/ui/labelwidget.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 45c02827..6847ddf1 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -391,6 +391,7 @@ void updateSize_LabelWidget(iLabelWidget *d) { | |||
391 | iWidget *w = as_Widget(d); | 391 | iWidget *w = as_Widget(d); |
392 | const int64_t flags = flags_Widget(w); | 392 | const int64_t flags = flags_Widget(w); |
393 | const iInt2 size = defaultSize_LabelWidget(d); | 393 | const iInt2 size = defaultSize_LabelWidget(d); |
394 | w->minSize.y = size.y; /* vertically text must remain visible */ | ||
394 | /* Wrapped text implies that width must be defined by arrangement. */ | 395 | /* Wrapped text implies that width must be defined by arrangement. */ |
395 | if (!(flags & (fixedWidth_WidgetFlag | wrapText_WidgetFlag))) { | 396 | if (!(flags & (fixedWidth_WidgetFlag | wrapText_WidgetFlag))) { |
396 | w->rect.size.x = size.x; | 397 | w->rect.size.x = size.x; |
@@ -405,7 +406,8 @@ static void replaceVariables_LabelWidget_(iLabelWidget *d) { | |||
405 | } | 406 | } |
406 | 407 | ||
407 | void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) { | 408 | void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) { |
408 | init_Widget(&d->widget); | 409 | iWidget *w = &d->widget; |
410 | init_Widget(w); | ||
409 | d->font = uiLabel_FontId; | 411 | d->font = uiLabel_FontId; |
410 | d->forceFg = none_ColorId; | 412 | d->forceFg = none_ColorId; |
411 | d->icon = 0; | 413 | d->icon = 0; |
@@ -416,13 +418,13 @@ void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) { | |||
416 | initCStr_String(&d->command, cmd); | 418 | initCStr_String(&d->command, cmd); |
417 | } | 419 | } |
418 | else { | 420 | else { |
419 | setFrameColor_Widget(&d->widget, uiFrame_ColorId); | 421 | setFrameColor_Widget(w, uiFrame_ColorId); |
420 | init_String(&d->command); | 422 | init_String(&d->command); |
421 | } | 423 | } |
422 | d->key = 0; | 424 | d->key = 0; |
423 | d->kmods = 0; | 425 | d->kmods = 0; |
424 | init_Click(&d->click, d, !isEmpty_String(&d->command) ? SDL_BUTTON_LEFT : 0); | 426 | init_Click(&d->click, d, !isEmpty_String(&d->command) ? SDL_BUTTON_LEFT : 0); |
425 | setFlags_Widget(&d->widget, hover_WidgetFlag, d->click.button != 0); | 427 | setFlags_Widget(w, hover_WidgetFlag, d->click.button != 0); |
426 | d->alignVisual = iFalse; | 428 | d->alignVisual = iFalse; |
427 | updateSize_LabelWidget(d); | 429 | updateSize_LabelWidget(d); |
428 | updateKey_LabelWidget_(d); /* could be bound to another key */ | 430 | updateKey_LabelWidget_(d); /* could be bound to another key */ |