From 1df068c39a8a4d58272795aff135867f76b2b937 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Feb 2014 13:30:52 +1100 Subject: UI: Fix for rna-enum submenus not showing a right arrow --- source/blender/editors/interface/interface.c | 4 ++++ source/blender/editors/interface/interface_widgets.c | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 2e7bfb162ae..d2a4dab21d7 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3255,6 +3255,10 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s but->drawflag |= UI_BUT_ICON_LEFT; } + if ((type == MENU) && (but->dt == UI_EMBOSSP)) { + but->flag |= UI_ICON_SUBMENU; + } + if (!RNA_property_editable(&but->rnapoin, prop)) { ui_def_but_rna__disable(but); } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d19b16250cd..8ce7503e50f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1357,12 +1357,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b /* draws text and icons for buttons */ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect) { + const bool show_menu_icon = ui_but_draw_menu_icon(but); float alpha = (float)wcol->text[3] / 255.0f; char password_str[UI_MAX_DRAW_STR]; - if (but == NULL) - return; - ui_button_text_password_hide(password_str, but, false); /* check for button text label */ @@ -1375,8 +1373,8 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB /* If there's an icon too (made with uiDefIconTextBut) then draw the icon * and offset the text label to accommodate it */ - if (but->flag & UI_HAS_ICON) { - const bool show_menu_icon = ui_but_draw_menu_icon(but); + if (but->flag & UI_HAS_ICON || show_menu_icon) { + const BIFIconID icon = (but->flag & UI_HAS_ICON) ? but->icon + but->iconadd : ICON_NONE; const float icon_size = ICON_SIZE_FROM_BUTRECT(rect); /* menu item - add some more padding so menus don't feel cramped. it must @@ -1384,7 +1382,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB if (ui_block_is_menu(but->block)) rect->xmin += 0.3f * U.widget_unit; - widget_draw_icon(but, but->icon + but->iconadd, alpha, rect, show_menu_icon); + widget_draw_icon(but, icon, alpha, rect, show_menu_icon); rect->xmin += icon_size; /* without this menu keybindings will overlap the arrow icon [#38083] */ -- cgit v1.2.3