summaryrefslogtreecommitdiff
path: root/src/ui/labelwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-12-03 07:46:16 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-12-03 07:46:16 +0200
commit6e917280380316eba77b1dfa983daf488510e70f (patch)
tree50b31d131b6a4aa7edd6b90e8ed34b4706cf74ac /src/ui/labelwidget.c
parentba90c9f0b61419b4d8878276be898cc0012a37a0 (diff)
Mobile: Manage Identities via Settings
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r--src/ui/labelwidget.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index 947d5daa..d00733e1 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -36,6 +36,7 @@ struct Impl_LabelWidget {
36 iWidget widget; 36 iWidget widget;
37 iString srcLabel; 37 iString srcLabel;
38 iString label; 38 iString label;
39 iInt2 labelOffset;
39 int font; 40 int font;
40 int key; 41 int key;
41 int kmods; 42 int kmods;
@@ -362,10 +363,6 @@ static void draw_LabelWidget_(const iLabelWidget *d) {
362 } 363 }
363 setClip_Paint(&p, rect); 364 setClip_Paint(&p, rect);
364 const int iconPad = iconPadding_LabelWidget_(d); 365 const int iconPad = iconPadding_LabelWidget_(d);
365// const int iconColor = isCaution ? uiTextCaution_ColorId
366// : flags & (disabled_WidgetFlag | pressed_WidgetFlag) ? fg
367// : isHover ? uiIconHover_ColorId
368// : uiIcon_ColorId;
369 if (d->icon && d->icon != 0x20) { /* no need to draw an empty icon */ 366 if (d->icon && d->icon != 0x20) { /* no need to draw an empty icon */
370 iString str; 367 iString str;
371 initUnicodeN_String(&str, &d->icon, 1); 368 initUnicodeN_String(&str, &d->icon, 1);
@@ -427,8 +424,11 @@ static void draw_LabelWidget_(const iLabelWidget *d) {
427 else { 424 else {
428 drawCenteredOutline_Text( 425 drawCenteredOutline_Text(
429 d->font, 426 d->font,
430 adjusted_Rect(bounds, init_I2(iconPad * (flags & tight_WidgetFlag ? 1.0f : 1.5f), 0), 427 moved_Rect(
431 init_I2(-iconPad * (flags & tight_WidgetFlag ? 0.5f : 1.0f), 0)), 428 adjusted_Rect(bounds,
429 init_I2(iconPad * (flags & tight_WidgetFlag ? 1.0f : 1.5f), 0),
430 init_I2(-iconPad * (flags & tight_WidgetFlag ? 0.5f : 1.0f), 0)),
431 d->labelOffset),
432 d->flags.alignVisual, 432 d->flags.alignVisual,
433 d->flags.drawAsOutline ? fg : none_ColorId, 433 d->flags.drawAsOutline ? fg : none_ColorId,
434 d->flags.drawAsOutline ? d->widget.bgColor : fg, 434 d->flags.drawAsOutline ? d->widget.bgColor : fg,
@@ -523,6 +523,7 @@ void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) {
523 d->font = uiLabel_FontId; 523 d->font = uiLabel_FontId;
524 d->forceFg = none_ColorId; 524 d->forceFg = none_ColorId;
525 d->icon = 0; 525 d->icon = 0;
526 d->labelOffset = zero_I2();
526 initCStr_String(&d->srcLabel, label); 527 initCStr_String(&d->srcLabel, label);
527 initCopy_String(&d->label, &d->srcLabel); 528 initCopy_String(&d->label, &d->srcLabel);
528 replaceVariables_LabelWidget_(d); 529 replaceVariables_LabelWidget_(d);
@@ -623,6 +624,10 @@ void setRemoveTrailingColon_LabelWidget(iLabelWidget *d, iBool removeTrailingCol
623 } 624 }
624} 625}
625 626
627void setTextOffset_LabelWidget(iLabelWidget *d, iInt2 offset) {
628 d->labelOffset = offset;
629}
630
626void updateText_LabelWidget(iLabelWidget *d, const iString *text) { 631void updateText_LabelWidget(iLabelWidget *d, const iString *text) {
627 set_String(&d->label, text); 632 set_String(&d->label, text);
628 set_String(&d->srcLabel, text); 633 set_String(&d->srcLabel, text);