UI: Fix for rna-enum submenus not showing a right arrow

This commit is contained in:
Campbell Barton 2014-02-20 13:30:52 +11:00
parent e7f3424dca
commit 1df068c39a
2 changed files with 8 additions and 6 deletions

@ -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; 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)) { if (!RNA_property_editable(&but->rnapoin, prop)) {
ui_def_but_rna__disable(but); ui_def_but_rna__disable(but);
} }

@ -1357,12 +1357,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
/* draws text and icons for buttons */ /* draws text and icons for buttons */
static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect) 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; float alpha = (float)wcol->text[3] / 255.0f;
char password_str[UI_MAX_DRAW_STR]; char password_str[UI_MAX_DRAW_STR];
if (but == NULL)
return;
ui_button_text_password_hide(password_str, but, false); ui_button_text_password_hide(password_str, but, false);
/* check for button text label */ /* 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 /* If there's an icon too (made with uiDefIconTextBut) then draw the icon
* and offset the text label to accommodate it */ * and offset the text label to accommodate it */
if (but->flag & UI_HAS_ICON) { if (but->flag & UI_HAS_ICON || show_menu_icon) {
const bool show_menu_icon = ui_but_draw_menu_icon(but); const BIFIconID icon = (but->flag & UI_HAS_ICON) ? but->icon + but->iconadd : ICON_NONE;
const float icon_size = ICON_SIZE_FROM_BUTRECT(rect); const float icon_size = ICON_SIZE_FROM_BUTRECT(rect);
/* menu item - add some more padding so menus don't feel cramped. it must /* 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)) if (ui_block_is_menu(but->block))
rect->xmin += 0.3f * U.widget_unit; 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; rect->xmin += icon_size;
/* without this menu keybindings will overlap the arrow icon [#38083] */ /* without this menu keybindings will overlap the arrow icon [#38083] */