diff options
Diffstat (limited to 'scene/gui/base_button.h')
-rw-r--r-- | scene/gui/base_button.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index 21757488a6..b349b75761 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -36,7 +36,6 @@ class ButtonGroup; class BaseButton : public Control { - GDCLASS(BaseButton, Control); public: @@ -50,12 +49,11 @@ private: bool toggle_mode; bool shortcut_in_tooltip; bool keep_pressed_outside; - FocusMode enabled_focus_mode; - Ref<ShortCut> shortcut; + Ref<Shortcut> shortcut; + ObjectID shortcut_context; ActionMode action_mode; struct Status { - bool pressed; bool hovering; bool press_attempt; @@ -78,9 +76,11 @@ protected: virtual void toggled(bool p_pressed); static void _bind_methods(); virtual void _gui_input(Ref<InputEvent> p_event); - virtual void _unhandled_input(Ref<InputEvent> p_event); + virtual void _unhandled_key_input(Ref<InputEvent> p_event); void _notification(int p_what); + bool _is_focus_owner_in_shorcut_context() const; + public: enum DrawMode { DRAW_NORMAL, @@ -117,17 +117,17 @@ public: void set_button_mask(int p_mask); int get_button_mask() const; - void set_enabled_focus_mode(FocusMode p_mode); - FocusMode get_enabled_focus_mode() const; + void set_shortcut(const Ref<Shortcut> &p_shortcut); + Ref<Shortcut> get_shortcut() const; - void set_shortcut(const Ref<ShortCut> &p_shortcut); - Ref<ShortCut> get_shortcut() const; - - virtual String get_tooltip(const Point2 &p_pos) const; + virtual String get_tooltip(const Point2 &p_pos) const override; void set_button_group(const Ref<ButtonGroup> &p_group); Ref<ButtonGroup> get_button_group() const; + void set_shortcut_context(Node *p_node); + Node *get_shortcut_context() const; + BaseButton(); ~BaseButton(); }; @@ -136,7 +136,6 @@ VARIANT_ENUM_CAST(BaseButton::DrawMode) VARIANT_ENUM_CAST(BaseButton::ActionMode) class ButtonGroup : public Resource { - GDCLASS(ButtonGroup, Resource); friend class BaseButton; Set<BaseButton *> buttons; |