From 35b5888b157d05d378df3acc899d28856a9eb9a4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 5 Dec 2019 00:04:16 +0100 Subject: Fix menu buttons not displaying down arrow with emboss=False --- .../blender/editors/interface/interface_widgets.c | 69 +++++++++++++++------- 1 file changed, 48 insertions(+), 21 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 9e0d34e386d..d313310bfa1 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -3495,6 +3495,50 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round widget_numbut_draw(wcol, rect, state, roundboxalign, false); } +static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) +{ + uiWidgetBase wtb; + float rad; + + widget_init(&wtb); + + rad = wcol->roundness * U.widget_unit; + round_box_edges(&wtb, roundboxalign, rect, rad); + + /* decoration */ + shape_preset_trias_from_rect_menu(&wtb.tria1, rect); + /* copy size and center to 2nd tria */ + wtb.tria2 = wtb.tria1; + + widgetbase_draw(&wtb, wcol); + + /* text space, arrows are about 0.6 height of button */ + rect->xmax -= (6 * BLI_rcti_size_y(rect)) / 10; +} + +/** + * Draw menu buttons still with triangles when field is not embossed + */ +static void widget_menubut_embossn(uiBut *UNUSED(but), + uiWidgetColors *wcol, + rcti *rect, + int UNUSED(state), + int UNUSED(roundboxalign)) +{ + uiWidgetBase wtb; + + widget_init(&wtb); + wtb.draw_inner = false; + wtb.draw_outline = false; + + /* decoration */ + shape_preset_trias_from_rect_menu(&wtb.tria1, rect); + /* copy size and center to 2nd tria */ + wtb.tria2 = wtb.tria1; + + widgetbase_draw(&wtb, wcol); +} + /** * Draw number buttons still with triangles when field is not embossed */ @@ -3931,6 +3975,10 @@ static void widget_icon_has_anim( * triangles when field is not embossed */ widget_numbut_embossn(but, wcol, rect, state, roundboxalign); } + else if (but->type == UI_BTYPE_MENU) { + /* Draw menu buttons still with down arrow. */ + widget_menubut_embossn(but, wcol, rect, state, roundboxalign); + } } static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) @@ -3950,27 +3998,6 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun widgetbase_draw(&wtb, wcol); } -static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) -{ - uiWidgetBase wtb; - float rad; - - widget_init(&wtb); - - rad = wcol->roundness * U.widget_unit; - round_box_edges(&wtb, roundboxalign, rect, rad); - - /* decoration */ - shape_preset_trias_from_rect_menu(&wtb.tria1, rect); - /* copy size and center to 2nd tria */ - wtb.tria2 = wtb.tria1; - - widgetbase_draw(&wtb, wcol); - - /* text space, arrows are about 0.6 height of button */ - rect->xmax -= (6 * BLI_rcti_size_y(rect)) / 10; -} - static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), -- cgit v1.2.3