summaryrefslogtreecommitdiff
path: root/scene/gui/base_button.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/base_button.h')
-rw-r--r--scene/gui/base_button.h46
1 files changed, 24 insertions, 22 deletions
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index 05a975e266..d54d63cc39 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 */
@@ -45,21 +45,21 @@ public:
};
private:
- int button_mask;
- bool toggle_mode;
- bool shortcut_in_tooltip;
- bool keep_pressed_outside;
- FocusMode enabled_focus_mode;
- Ref<ShortCut> shortcut;
-
- ActionMode action_mode;
+ int button_mask = BUTTON_MASK_LEFT;
+ bool toggle_mode = false;
+ bool shortcut_in_tooltip = true;
+ bool keep_pressed_outside = false;
+ Ref<Shortcut> shortcut;
+ ObjectID shortcut_context;
+
+ ActionMode action_mode = ACTION_MODE_BUTTON_RELEASE;
struct Status {
- bool pressed;
- bool hovering;
- bool press_attempt;
- bool pressing_inside;
+ bool pressed = false;
+ bool hovering = false;
+ bool press_attempt = false;
+ bool pressing_inside = false;
- bool disabled;
+ bool disabled = false;
} status;
@@ -76,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,
@@ -115,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();
};