UI: Gray out shortcut indicator in search menus

In other menus we already gray out the shortcut string, just in the search menu
that wasn't the case.

We may also want to draw other hints like this in the future, e.g. the library
name for linked data-blocks in search menus. And then it's also nicer to have
it grayed out to separate it visually from the data-block name.
This commit is contained in:
Julian Eisel 2020-05-05 15:29:49 +02:00
parent e7470c9dbe
commit 9535dbcee0
1 changed files with 18 additions and 15 deletions

View File

@ -5409,21 +5409,6 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
}
}
/* part text right aligned */
if (use_sep) {
if (cpoin) {
rect->xmax = _rect.xmax - 5;
UI_fontstyle_draw(fstyle,
rect,
cpoin + 1,
wt->wcol.text,
&(struct uiFontStyleDraw_Params){
.align = UI_STYLE_TEXT_RIGHT,
});
*cpoin = UI_SEP_CHAR;
}
}
/* restore rect, was messed with */
*rect = _rect;
@ -5440,6 +5425,24 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
UI_icon_draw_ex(xs, ys, iconid, aspect, 1.0f, 0.0f, wt->wcol.text, false);
GPU_blend(false);
}
/* part text right aligned */
if (use_sep) {
if (cpoin) {
/* Set inactive state for grayed out text. */
wt->state(wt, state | UI_BUT_INACTIVE, 0);
rect->xmax = _rect.xmax - 5;
UI_fontstyle_draw(fstyle,
rect,
cpoin + 1,
wt->wcol.text,
&(struct uiFontStyleDraw_Params){
.align = UI_STYLE_TEXT_RIGHT,
});
*cpoin = UI_SEP_CHAR;
}
}
}
void ui_draw_preview_item(