diff options
author | Julian Eisel <julian@blender.org> | 2020-05-05 16:29:49 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-05-05 16:37:11 +0300 |
commit | 9535dbcee0bde24f11457d17d0f4cd5424711e86 (patch) | |
tree | a71225ce5f888f551d697261e40f59ee517e591f /source/blender/editors/interface/interface_widgets.c | |
parent | e7470c9dbe4cbda1c94ce3c25285696b6047ee77 (diff) |
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.
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 0d4eff2ba31..231c2093143 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -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( |