From 2d34420648e5feacf1237abc975f8ff2a0c2a907 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 27 Mar 2019 21:39:44 +1100 Subject: 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 --- source/blender/editors/include/UI_interface.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/editors/include') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 6a9034f9097..ec88278ec88 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -193,6 +193,9 @@ enum { UI_BUT_IMMEDIATE = 1 << 20, UI_BUT_NO_UTF8 = 1 << 21, + /** For popups, pressing return activates this button, overriding the highlighed button. */ + UI_BUT_ACTIVE_DEFAULT = 1 << 23, + /** This but is "inside" a list item (currently used to change theme colors). */ UI_BUT_LIST_ITEM = 1 << 24, /** edit this button as well as the active button (not just dragging) */ @@ -1053,6 +1056,7 @@ void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but); void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext); void uiLayoutSetActive(uiLayout *layout, bool active); +void uiLayoutSetActiveDefault(uiLayout *layout, bool active_default); void uiLayoutSetActivateInit(uiLayout *layout, bool active); void uiLayoutSetEnabled(uiLayout *layout, bool enabled); void uiLayoutSetRedAlert(uiLayout *layout, bool redalert); @@ -1069,6 +1073,7 @@ int uiLayoutGetLocalDir(const uiLayout *layout); int uiLayoutGetOperatorContext(uiLayout *layout); bool uiLayoutGetActive(uiLayout *layout); +bool uiLayoutGetActiveDefault(uiLayout *layout); bool uiLayoutGetActivateInit(uiLayout *layout); bool uiLayoutGetEnabled(uiLayout *layout); bool uiLayoutGetRedAlert(uiLayout *layout); -- cgit v1.2.3