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/makesrna/intern/rna_ui.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/makesrna/intern/rna_ui.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 7c10b3eff77..b6e75cf3507 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -881,6 +881,16 @@ static void rna_UILayout_active_set(PointerRNA *ptr, bool value) uiLayoutSetActive(ptr->data, value); } +static bool rna_UILayout_active_default_get(PointerRNA *ptr) +{ + return uiLayoutGetActiveDefault(ptr->data); +} + +static void rna_UILayout_active_default_set(PointerRNA *ptr, bool value) +{ + uiLayoutSetActiveDefault(ptr->data, value); +} + static bool rna_UILayout_activate_init_get(PointerRNA *ptr) { return uiLayoutGetActivateInit(ptr->data); @@ -1066,6 +1076,13 @@ static void rna_def_ui_layout(BlenderRNA *brna) prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set"); + prop = RNA_def_property(srna, "active_default", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_default_get", "rna_UILayout_active_default_set"); + RNA_def_property_ui_text( + prop, "Active Default", + "When true, an operator button defined after this will be activated when pressing return" + "(use with popup dialogs)"); + prop = RNA_def_property(srna, "activate_init", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_activate_init_get", "rna_UILayout_activate_init_set"); RNA_def_property_ui_text( |