diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-12 09:14:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-12 09:14:13 +0300 |
commit | a2027c6587d62fcbd1ac372a0a92a2ec91ef8659 (patch) | |
tree | 1ecf4fe0850d36db95f4576cf54a4a26a7c4a408 /source/blender/editors/interface/interface_widgets.c | |
parent | 35da1afa09d98f1051391da53d17d81a586fe518 (diff) |
UI: replace ui_draw_search_back w/ general code
Useful for drawing any kind of region-background.
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index ac8d900f560..fa099003010 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -4916,30 +4916,32 @@ uiWidgetColors *ui_tooltip_get_theme(void) return wt->wcol_theme; } -void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect) +/** + * Generic drawing for background. + */ +void ui_draw_widget_back(uiWidgetTypeEnum type, bool use_shadow, const rcti *rect) { - uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP); + uiWidgetType *wt = widget_type(type); + + if (use_shadow) { + glEnable(GL_BLEND); + widget_softshadow(rect, UI_CNR_ALL, 0.25f * U.widget_unit); + glDisable(GL_BLEND); + } + + rcti rect_copy = *rect; wt->state(wt, 0); - /* wt->draw ends up using same function to draw the tooltip as menu_back */ - wt->draw(&wt->wcol, rect, 0, 0); + wt->draw(&wt->wcol, &rect_copy, 0, UI_CNR_ALL); } -void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) +void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect) { - uiWidgetType *wt = widget_type(UI_WTYPE_BOX); - - glEnable(GL_BLEND); - widget_softshadow(rect, UI_CNR_ALL, 0.25f * U.widget_unit); - glDisable(GL_BLEND); - + uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP); wt->state(wt, 0); - if (block) - wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL); - else - wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL); + /* wt->draw ends up using same function to draw the tooltip as menu_back */ + wt->draw(&wt->wcol, rect, 0, 0); } - /* helper call to draw a menu item without button */ /* state: UI_ACTIVE or 0 */ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep) |