From 12ded391f5fd720fff0c30d41d72600a29cb7937 Mon Sep 17 00:00:00 2001 From: Eric M Date: Mon, 30 Nov 2020 00:11:40 +1000 Subject: [PATCH] Exposed shortcut_context property to scripting and added documentation. I didn't expose this as a property or add documentation in the original PR #42109. --- doc/classes/BaseButton.xml | 3 +++ scene/gui/base_button.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index 378df1ce659c..45ef4cb14c62 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -65,6 +65,9 @@ [Shortcut] associated to the button. + + The [Node] which must be a parent of the focused GUI [Control] for the shortcut to be activated. If [code]null[/code], the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused. + If [code]true[/code], the button will add information about its shortcut in the tooltip. diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index fab0dea804b7..dadb1bea31d7 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -435,6 +435,7 @@ void BaseButton::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_pressed_outside"), "set_keep_pressed_outside", "is_keep_pressed_outside"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "Shortcut"), "set_shortcut", "get_shortcut"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "button_group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut_context", PROPERTY_HINT_RESOURCE_TYPE, "Node"), "set_shortcut_context", "get_shortcut_context"); BIND_ENUM_CONSTANT(DRAW_NORMAL); BIND_ENUM_CONSTANT(DRAW_PRESSED);