diff options
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r-- | src/ui/labelwidget.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 44ae3eec..89e95c85 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -205,6 +205,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
205 | const iBool isSel = (flags & selected_WidgetFlag) != 0; | 205 | const iBool isSel = (flags & selected_WidgetFlag) != 0; |
206 | const iBool isFrameless = (flags & frameless_WidgetFlag) != 0; | 206 | const iBool isFrameless = (flags & frameless_WidgetFlag) != 0; |
207 | const iBool isButton = d->click.button != 0; | 207 | const iBool isButton = d->click.button != 0; |
208 | const iBool isMenuItem = !cmp_String(id_Widget(parent_Widget(d)), "menu"); | ||
208 | const iBool isKeyRoot = (w->root == get_Window()->keyRoot); | 209 | const iBool isKeyRoot = (w->root == get_Window()->keyRoot); |
209 | const iBool isDarkTheme = isDark_ColorTheme(colorTheme_App()); | 210 | const iBool isDarkTheme = isDark_ColorTheme(colorTheme_App()); |
210 | /* Default color state. */ | 211 | /* Default color state. */ |
@@ -229,7 +230,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
229 | *bg = uiBackgroundSelected_ColorId; | 230 | *bg = uiBackgroundSelected_ColorId; |
230 | if (!isKeyRoot) { | 231 | if (!isKeyRoot) { |
231 | *bg = isDark_ColorTheme(colorTheme_App()) ? uiBackgroundUnfocusedSelection_ColorId | 232 | *bg = isDark_ColorTheme(colorTheme_App()) ? uiBackgroundUnfocusedSelection_ColorId |
232 | : uiMarked_ColorId; | 233 | : uiMarked_ColorId; |
233 | } | 234 | } |
234 | } | 235 | } |
235 | *fg = uiTextSelected_ColorId; | 236 | *fg = uiTextSelected_ColorId; |
@@ -294,7 +295,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
294 | } | 295 | } |
295 | *fg = *icon = *meta = uiTextPressed_ColorId | permanent_ColorId; | 296 | *fg = *icon = *meta = uiTextPressed_ColorId | permanent_ColorId; |
296 | } | 297 | } |
297 | } | 298 | } |
298 | if (((isSel || isHover) && isFrameless) || isPress) { | 299 | if (((isSel || isHover) && isFrameless) || isPress) { |
299 | /* Ensure that the full label text remains readable. */ | 300 | /* Ensure that the full label text remains readable. */ |
300 | *fg |= permanent_ColorId; | 301 | *fg |= permanent_ColorId; |
@@ -429,7 +430,7 @@ static void draw_LabelWidget_(const iLabelWidget *d) { | |||
429 | moved_Rect( | 430 | moved_Rect( |
430 | adjusted_Rect(bounds, | 431 | adjusted_Rect(bounds, |
431 | init_I2(iconPad * (flags & tight_WidgetFlag ? 1.0f : 1.5f), 0), | 432 | init_I2(iconPad * (flags & tight_WidgetFlag ? 1.0f : 1.5f), 0), |
432 | init_I2(-iconPad * (flags & tight_WidgetFlag ? 0.5f : 1.0f), 0)), | 433 | init_I2(-iconPad * (flags & tight_WidgetFlag ? 0.5f : 1.0f), 0)), |
433 | d->labelOffset), | 434 | d->labelOffset), |
434 | d->flags.alignVisual, | 435 | d->flags.alignVisual, |
435 | d->flags.drawAsOutline ? fg : none_ColorId, | 436 | d->flags.drawAsOutline ? fg : none_ColorId, |
@@ -566,20 +567,20 @@ void setTextColor_LabelWidget(iLabelWidget *d, int color) { | |||
566 | 567 | ||
567 | void setText_LabelWidget(iLabelWidget *d, const iString *text) { | 568 | void setText_LabelWidget(iLabelWidget *d, const iString *text) { |
568 | if (d) { | 569 | if (d) { |
569 | updateText_LabelWidget(d, text); | 570 | updateText_LabelWidget(d, text); |
570 | updateSize_LabelWidget(d); | 571 | updateSize_LabelWidget(d); |
571 | if (isWrapped_LabelWidget(d)) { | 572 | if (isWrapped_LabelWidget(d)) { |
572 | sizeChanged_LabelWidget_(d); | 573 | sizeChanged_LabelWidget_(d); |
573 | } | 574 | } |
574 | } | 575 | } |
575 | } | 576 | } |
576 | 577 | ||
577 | void setTextCStr_LabelWidget(iLabelWidget *d, const char *text) { | 578 | void setTextCStr_LabelWidget(iLabelWidget *d, const char *text) { |
578 | if (d) { | 579 | if (d) { |
579 | updateTextCStr_LabelWidget(d, text); | 580 | updateTextCStr_LabelWidget(d, text); |
580 | updateSize_LabelWidget(d); | 581 | updateSize_LabelWidget(d); |
581 | if (isWrapped_LabelWidget(d)) { | 582 | if (isWrapped_LabelWidget(d)) { |
582 | sizeChanged_LabelWidget_(d); | 583 | sizeChanged_LabelWidget_(d); |
583 | } | 584 | } |
584 | } | 585 | } |
585 | } | 586 | } |