Media/Themes/Umami: Handle disabled attribute for TextLabelWidget and MenuItemWidget

This commit is contained in:
Alec Murphy
2025-09-12 08:22:38 -04:00
parent 7a3190d77e
commit 9bb7db2b23

View File

@@ -911,9 +911,17 @@ U0 @umami_label_repaint(Window* win, BitmapFontTextLabelWidget* widget, I64 x,
color.u8[3] = win->opacity;
if (!widget->font)
widget->font = Compositor.theme.font.sans;
if (widget->text && win->opacity > 0)
PutS2D(win->render_ctx, widget->font, x, y, color, -1,
widget->text);
if (widget->text && win->opacity > 0) {
if (widget->disabled) {
PutS2D(win->render_ctx, widget->font, x + 1, y + 1, Color(255, 255, 255), -1,
widget->text);
PutS2D(win->render_ctx, widget->font, x, y, Color(128, 128, 128), -1,
widget->text);
} else {
PutS2D(win->render_ctx, widget->font, x, y, color, -1,
widget->text);
}
}
}
U0 @umami_list_view_repaint(Window* win, ListViewWidget* widget, I64 x, I64 y)
@@ -929,7 +937,7 @@ U0 @umami_menu_item_repaint(Window* win, MenuItemWidget* widget, I64 x, I64 y)
I64 icon_x = 4;
I64 icon_y = 0;
I64 arrow_y = 4 + (widget->height / 2) - (umami_widget_submenu_arrow->height / 2) - 3;
Bool widget_is_hovered = @widget_is_hovered(win->x + x, win->y + y, widget);
Bool widget_is_hovered = !widget->disabled && @widget_is_hovered(win->x + x, win->y + y, widget);
if (widget->icon) {
icon_y = 4 + (widget->height / 2) - (widget->icon->height / 2) - 3;
}
@@ -960,9 +968,17 @@ U0 @umami_menu_item_repaint(Window* win, MenuItemWidget* widget, I64 x, I64 y)
ctx->blot(x + widget->width - 8 - umami_widget_submenu_arrow->width, y + arrow_y,
T(widget_is_hovered, umami_widget_submenu_arrow_hover, umami_widget_submenu_arrow));
}
if (widget->text)
PutS2D(win->render_ctx, widget->font, x + text_x, y + text_y,
T(widget->color, widget->color, text_color), -1, widget->text);
if (widget->text) {
if (widget->disabled) {
PutS2D(win->render_ctx, widget->font, x + text_x + 1, y + text_y + 1, Color(255, 255, 255), -1,
widget->text);
PutS2D(win->render_ctx, widget->font, x + text_x, y + text_y, Color(128, 128, 128), -1,
widget->text);
} else {
PutS2D(win->render_ctx, widget->font, x + text_x, y + text_y,
T(widget->color, widget->color, text_color), -1, widget->text);
}
}
}
U0 @umami_radio_repaint(Window* win, RadioButtonWidget* widget, I64 x, I64 y)