diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 13:39:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 16:26:00 +0300 |
commit | 2d34420648e5feacf1237abc975f8ff2a0c2a907 (patch) | |
tree | 1a59f1e4afa3d84e6b7899f9501ad5a346054571 /source/blender/editors/interface/interface_query.c | |
parent | e3b83e2921922a45db5a33c739e1d993452944d0 (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_query.c')
-rw-r--r-- | source/blender/editors/interface/interface_query.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index 8300ee71c50..1954e20ab8b 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -469,6 +469,21 @@ uiBut *ui_region_find_active_but(ARegion *ar) return NULL; } +uiBut *ui_region_find_first_but_test_flag(ARegion *ar, int flag_include, int flag_exclude) +{ + for (uiBlock *block = ar->uiblocks.first; block; block = block->next) { + for (uiBut *but = block->buttons.first; but; but = but->next) { + if (((but->flag & flag_include) == flag_include) && + ((but->flag & flag_exclude) == 0)) + { + return but; + } + } + } + + return NULL; +} + /** \} */ /* -------------------------------------------------------------------- */ |