UI: support red alert on labels, not just buttons.

This commit is contained in:
2018-11-01 19:43:46 +01:00
parent c7752df86d
commit 1e8a2e1a10
2 changed files with 15 additions and 1 deletions

View File

@@ -2371,6 +2371,10 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
but->flag |= UI_BUT_LIST_ITEM;
}
if (layout->redalert) {
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
return but;
}

View File

@@ -2281,7 +2281,12 @@ static void widget_state(uiWidgetType *wt, int state)
if (state & UI_BUT_REDALERT) {
char red[4] = {255, 0, 0};
widget_state_blend(wt->wcol.inner, red, 0.4f);
if (wt->draw) {
widget_state_blend(wt->wcol.inner, red, 0.4f);
}
else {
widget_state_blend(wt->wcol.text, red, 0.4f);
}
}
if (state & UI_BUT_DRAG_MULTI) {
@@ -3654,6 +3659,11 @@ static void widget_state_label(uiWidgetType *wt, int state)
else
UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
}
if (state & UI_BUT_REDALERT) {
char red[4] = {255, 0, 0};
widget_state_blend(wt->wcol.text, red, 0.4f);
}
}
static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)