diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-11-29 16:35:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-29 16:35:15 +0100 |
commit | 0167bfa530bb4c19ff237d2f12927c60ac452ad7 (patch) | |
tree | a5b5f15dcea073058617489f7fd072ec2174d628 | |
parent | 79d569edd44708645611c124182bd2766d005b2f (diff) | |
parent | 12ded391f5fd720fff0c30d41d72600a29cb7937 (diff) |
Merge pull request #43958 from EricEzaM/PR/basebutton-add-property-and-doco
Exposed shortcut_context property to scripting and added documentation.
-rw-r--r-- | doc/classes/BaseButton.xml | 3 | ||||
-rw-r--r-- | scene/gui/base_button.cpp | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index 378df1ce65..45ef4cb14c 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -65,6 +65,9 @@ <member name="shortcut" type="Shortcut" setter="set_shortcut" getter="get_shortcut"> [Shortcut] associated to the button. </member> + <member name="shortcut_context" type="Node" setter="set_shortcut_context" getter="get_shortcut_context"> + 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. + </member> <member name="shortcut_in_tooltip" type="bool" setter="set_shortcut_in_tooltip" getter="is_shortcut_in_tooltip_enabled" default="true"> If [code]true[/code], the button will add information about its shortcut in the tooltip. </member> diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index fab0dea804..dadb1bea31 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); |