UI: only use toolbar draw-style for buttons with icons

This allows tool buttons to be used in menus or popovers
and show as regular button styles.
This commit is contained in:
2019-12-07 04:03:02 +11:00
parent bd53c053f3
commit 8a8b549e56

View File

@@ -1609,7 +1609,7 @@ static void widget_draw_icon(
else if ((but->flag & (UI_ACTIVE | UI_SELECT | UI_SELECT_DRAW))) {
UI_icon_draw_ex(xs, ys, icon, aspect, alpha, 0.0f, color, has_theme);
}
else if (!UI_but_is_tool(but)) {
else if (!((but->icon != ICON_NONE) && UI_but_is_tool(but))) {
if (has_theme) {
alpha *= 0.8f;
}
@@ -2459,7 +2459,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
}
/* Icons on the left with optional text label on the right */
else if (but->flag & UI_HAS_ICON || show_menu_icon) {
const bool is_tool = UI_but_is_tool(but);
const bool is_tool = ((but->icon != ICON_NONE) & UI_but_is_tool(but));
/* XXX add way to draw icons at a different size!
* Use small icons for popup. */
@@ -4626,7 +4626,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case UI_BTYPE_BUT:
#ifdef USE_UI_TOOLBAR_HACK
if (UI_but_is_tool(but)) {
if ((but->icon != ICON_NONE) && UI_but_is_tool(but)) {
wt = widget_type(UI_WTYPE_TOOLBAR_ITEM);
}
else {