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_layout.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_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c15
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;