feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -31,11 +31,11 @@
|
|||
#include "base_button.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "scene/gui/label.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
void BaseButton::_unpress_group() {
|
||||
if (!button_group.is_valid()) {
|
||||
if (button_group.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -114,6 +114,11 @@ void BaseButton::_notification(int p_what) {
|
|||
} else if (status.hovering) {
|
||||
queue_redraw();
|
||||
}
|
||||
|
||||
if (status.pressed_down_with_focus) {
|
||||
status.pressed_down_with_focus = false;
|
||||
emit_signal(SNAME("button_up"));
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_VISIBILITY_CHANGED:
|
||||
|
|
@ -140,14 +145,19 @@ void BaseButton::_pressed() {
|
|||
void BaseButton::_toggled(bool p_pressed) {
|
||||
GDVIRTUAL_CALL(_toggled, p_pressed);
|
||||
toggled(p_pressed);
|
||||
emit_signal(SNAME("toggled"), p_pressed);
|
||||
emit_signal(SceneStringName(toggled), p_pressed);
|
||||
}
|
||||
|
||||
void BaseButton::on_action_event(Ref<InputEvent> p_event) {
|
||||
if (p_event->is_pressed()) {
|
||||
Ref<InputEventMouseButton> mouse_button = p_event;
|
||||
|
||||
if (p_event->is_pressed() && (mouse_button.is_null() || status.hovering)) {
|
||||
status.press_attempt = true;
|
||||
status.pressing_inside = true;
|
||||
emit_signal(SNAME("button_down"));
|
||||
if (!status.pressed_down_with_focus) {
|
||||
status.pressed_down_with_focus = true;
|
||||
emit_signal(SNAME("button_down"));
|
||||
}
|
||||
}
|
||||
|
||||
if (status.press_attempt && status.pressing_inside) {
|
||||
|
|
@ -174,15 +184,12 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) {
|
|||
}
|
||||
|
||||
if (!p_event->is_pressed()) {
|
||||
Ref<InputEventMouseButton> mouse_button = p_event;
|
||||
if (mouse_button.is_valid()) {
|
||||
if (!has_point(mouse_button->get_position())) {
|
||||
status.hovering = false;
|
||||
}
|
||||
}
|
||||
status.press_attempt = false;
|
||||
status.pressing_inside = false;
|
||||
emit_signal(SNAME("button_up"));
|
||||
if (status.pressed_down_with_focus) {
|
||||
status.pressed_down_with_focus = false;
|
||||
emit_signal(SNAME("button_up"));
|
||||
}
|
||||
}
|
||||
|
||||
queue_redraw();
|
||||
|
|
@ -208,6 +215,7 @@ void BaseButton::set_disabled(bool p_disabled) {
|
|||
status.pressing_inside = false;
|
||||
}
|
||||
queue_redraw();
|
||||
update_minimum_size();
|
||||
}
|
||||
|
||||
bool BaseButton::is_disabled() const {
|
||||
|
|
@ -394,16 +402,31 @@ void BaseButton::shortcut_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
}
|
||||
|
||||
String BaseButton::get_tooltip(const Point2 &p_pos) const {
|
||||
String tooltip = Control::get_tooltip(p_pos);
|
||||
if (shortcut_in_tooltip && shortcut.is_valid() && shortcut->has_valid_event()) {
|
||||
String text = shortcut->get_name() + " (" + shortcut->get_as_text() + ")";
|
||||
if (!tooltip.is_empty() && shortcut->get_name().nocasecmp_to(tooltip) != 0) {
|
||||
text += "\n" + atr(tooltip);
|
||||
}
|
||||
tooltip = text;
|
||||
Control *BaseButton::make_custom_tooltip(const String &p_text) const {
|
||||
Control *control = Control::make_custom_tooltip(p_text);
|
||||
if (control) {
|
||||
return control;
|
||||
}
|
||||
return tooltip;
|
||||
if (!shortcut_in_tooltip || shortcut.is_null() || !shortcut->has_valid_event()) {
|
||||
return nullptr; // Use the default tooltip label.
|
||||
}
|
||||
|
||||
String text = atr(shortcut->get_name()) + " (" + shortcut->get_as_text() + ")";
|
||||
if (!p_text.is_empty() && shortcut->get_name().nocasecmp_to(p_text) != 0) {
|
||||
text += "\n" + atr(p_text);
|
||||
}
|
||||
|
||||
// Make a label similar to the default tooltip label.
|
||||
// Auto translation is disabled because we already did that manually above.
|
||||
//
|
||||
// We can't customize the tooltip text by overriding `get_tooltip()`
|
||||
// because otherwise user-defined `_make_custom_tooltip()` would receive
|
||||
// the translated and annotated text.
|
||||
Label *label = memnew(Label(text));
|
||||
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
label->set_theme_type_variation(SNAME("TooltipLabel"));
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
void BaseButton::set_button_group(const Ref<ButtonGroup> &p_group) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue