diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 5669743ec1d..5ef2557383c 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -76,12 +76,12 @@ void BaseButton::_gui_input(Ref p_event) { } status.pressed = !status.pressed; _unpress_group(); - toggled(status.pressed); - pressed(); + _toggled(status.pressed); + _pressed(); } } else { if (!p_event->is_pressed()) { - pressed(); + _pressed(); } } } @@ -159,22 +159,30 @@ void BaseButton::_notification(int p_what) { } } -void BaseButton::pressed() { +void BaseButton::_pressed() { if (get_script_instance()) { get_script_instance()->call(SceneStringNames::get_singleton()->_pressed); } + pressed(); emit_signal("pressed"); } -void BaseButton::toggled(bool p_pressed) { +void BaseButton::_toggled(bool p_pressed) { if (get_script_instance()) { get_script_instance()->call(SceneStringNames::get_singleton()->_toggled, p_pressed); } + toggled(p_pressed); emit_signal("toggled", p_pressed); } +void BaseButton::pressed() { +} + +void BaseButton::toggled(bool p_pressed) { +} + void BaseButton::set_disabled(bool p_disabled) { if (status.disabled == p_disabled) return; @@ -209,7 +217,7 @@ void BaseButton::set_pressed(bool p_pressed) { _unpress_group(); } if (toggle_mode) { - toggled(status.pressed); + _toggled(status.pressed); } update(); diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index 4762c27b28b..abb3f58d6bb 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -71,6 +71,8 @@ private: Ref button_group; void _unpress_group(); + void _pressed(); + void _toggled(bool p_pressed); protected: virtual void pressed();