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_layout.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_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e2933f75440..6c4389aabd9 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -160,6 +160,7 @@ struct uiLayout { short space; bool align; bool active; + bool active_default; bool activate_init; bool enabled; bool redalert; @@ -1060,6 +1061,10 @@ static uiBut *uiItemFullO_ptr_ex( UI_but_flag_enable(but, UI_BUT_REDALERT); } + if (layout->active_default) { + UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT); + } + /* assign properties */ if (properties || r_opptr) { PointerRNA *opptr = UI_but_operator_ptr_get(but); @@ -4150,6 +4155,11 @@ void uiLayoutSetActive(uiLayout *layout, bool active) layout->active = active; } +void uiLayoutSetActiveDefault(uiLayout *layout, bool active_default) +{ + layout->active_default = active_default; +} + void uiLayoutSetActivateInit(uiLayout *layout, bool activate_init) { layout->activate_init = activate_init; @@ -4225,6 +4235,11 @@ bool uiLayoutGetActive(uiLayout *layout) return layout->active; } +bool uiLayoutGetActiveDefault(uiLayout *layout) +{ + return layout->active_default; +} + bool uiLayoutGetActivateInit(uiLayout *layout) { return layout->activate_init; |