Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-03-27 13:39:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-27 16:26:00 +0300
commit2d34420648e5feacf1237abc975f8ff2a0c2a907 (patch)
tree1a59f1e4afa3d84e6b7899f9501ad5a346054571 /source/blender/editors/interface/interface_widgets.c
parente3b83e2921922a45db5a33c739e1d993452944d0 (diff)
UI: support an 'active default' button for pop-ups
Use this for the save confirmation dialog so it has a default action when pressing enter which draws with a highlight so it's clear what the default action is (the dialog was just closing before). Resolves T57686
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index be571de4c4e..6528faca265 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -4563,23 +4563,32 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
GPU_blend(true);
}
+ bool show_semi_highlight = false;
+
#ifdef USE_UI_POPOVER_ONCE
if (but->block->flag & UI_BLOCK_POPOVER_ONCE) {
if ((state & UI_ACTIVE) && ui_but_is_popover_once_compat(but)) {
- uiWidgetType wt_back = *wt;
- uiWidgetType *wt_temp = widget_type(UI_WTYPE_MENU_ITEM);
- wt_temp->state(wt_temp, state, drawflag);
- copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
- wt->wcol.inner[3] = 128;
- wt->wcol.roundness = 0.5f;
- ui_draw_roundbox(
- &rect_orig,
- 0.25f * min_ff(BLI_rcti_size_x(&rect_orig), BLI_rcti_size_y(&rect_orig)),
- &wt_temp->wcol);
- *wt = wt_back;
+ show_semi_highlight = true;
}
}
#endif
+ if (but->flag & UI_BUT_ACTIVE_DEFAULT) {
+ show_semi_highlight = true;
+ }
+
+ if (show_semi_highlight) {
+ uiWidgetType wt_back = *wt;
+ uiWidgetType *wt_temp = widget_type(UI_WTYPE_MENU_ITEM);
+ wt_temp->state(wt_temp, state, drawflag);
+ copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
+ wt->wcol.inner[3] = 128;
+ wt->wcol.roundness = 0.5f;
+ ui_draw_roundbox(
+ &rect_orig,
+ 0.25f * min_ff(BLI_rcti_size_x(&rect_orig), BLI_rcti_size_y(&rect_orig)),
+ &wt_temp->wcol);
+ *wt = wt_back;
+ }
wt->text(fstyle, &wt->wcol, but, rect);
if (disabled) {