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-20 14:40:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-20 15:10:34 +0300
commita1addc5c633d4c35eeb491c698052ec9300271dc (patch)
tree2f8cf2086db19233c3e641662f8a3cd540a5fd1e /source/blender/editors/interface/interface_layout.c
parent69fb859909c8e99a8e5e9e06607992d5b9a41473 (diff)
UI: support for popups starting with buttons activated
While this could already be done from C, this is now exposed to Python
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a828c19be54..95791dc8811 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 activate_init;
bool enabled;
bool redalert;
bool keepaspect;
@@ -1818,6 +1819,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if (layout->redalert)
UI_but_flag_enable(but, UI_BUT_REDALERT);
+
+ if (layout->activate_init)
+ UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT);
}
/* single button */
else {
@@ -1831,6 +1835,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if (layout->redalert)
UI_but_flag_enable(but, UI_BUT_REDALERT);
+
+ if (layout->activate_init)
+ UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT);
}
/* Mark non-embossed textfields inside a listbox. */
@@ -3949,6 +3956,11 @@ void uiLayoutSetActive(uiLayout *layout, bool active)
layout->active = active;
}
+void uiLayoutSetActivateInit(uiLayout *layout, bool activate_init)
+{
+ layout->activate_init = activate_init;
+}
+
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
{
layout->enabled = enabled;
@@ -4019,6 +4031,11 @@ bool uiLayoutGetActive(uiLayout *layout)
return layout->active;
}
+bool uiLayoutGetActivateInit(uiLayout *layout)
+{
+ return layout->activate_init;
+}
+
bool uiLayoutGetEnabled(uiLayout *layout)
{
return layout->enabled;