diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/color_picker.cpp | 67 | ||||
-rw-r--r-- | scene/gui/container.cpp | 13 | ||||
-rw-r--r-- | scene/gui/control.cpp | 41 | ||||
-rw-r--r-- | scene/gui/dialogs.cpp | 23 | ||||
-rw-r--r-- | scene/gui/dialogs.h | 11 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 53 | ||||
-rw-r--r-- | scene/gui/gradient_edit.cpp | 5 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 43 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 3 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 11 | ||||
-rw-r--r-- | scene/gui/menu_button.cpp | 5 | ||||
-rw-r--r-- | scene/gui/option_button.cpp | 10 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 9 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 3 | ||||
-rw-r--r-- | scene/gui/scroll_bar.cpp | 20 | ||||
-rw-r--r-- | scene/gui/scroll_container.cpp | 8 | ||||
-rw-r--r-- | scene/gui/spin_box.cpp | 12 | ||||
-rw-r--r-- | scene/gui/tab_container.cpp | 8 | ||||
-rw-r--r-- | scene/gui/tabs.cpp | 3 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 19 | ||||
-rw-r--r-- | scene/gui/texture_rect.cpp | 5 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 20 |
22 files changed, 159 insertions, 233 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index cb71128424..cbbad79811 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -615,7 +615,7 @@ void ColorPicker::_screen_pick_pressed() { screen->set_as_toplevel(true); screen->set_anchors_and_margins_preset(Control::PRESET_WIDE); screen->set_default_cursor_shape(CURSOR_POINTING_HAND); - screen->connect_compat("gui_input", this, "_screen_input"); + screen->connect("gui_input", callable_mp(this, &ColorPicker::_screen_input)); // It immediately toggles off in the first press otherwise. screen->call_deferred("connect", "hide", Callable(btn_pick, "set_pressed"), varray(false)); } @@ -678,9 +678,9 @@ void ColorPicker::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPicker::set_pick_color); ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPicker::get_pick_color); - ClassDB::bind_method(D_METHOD("set_hsv_mode", "mode"), &ColorPicker::set_hsv_mode); + ClassDB::bind_method(D_METHOD("set_hsv_mode"), &ColorPicker::set_hsv_mode); ClassDB::bind_method(D_METHOD("is_hsv_mode"), &ColorPicker::is_hsv_mode); - ClassDB::bind_method(D_METHOD("set_raw_mode", "mode"), &ColorPicker::set_raw_mode); + ClassDB::bind_method(D_METHOD("set_raw_mode"), &ColorPicker::set_raw_mode); ClassDB::bind_method(D_METHOD("is_raw_mode"), &ColorPicker::is_raw_mode); ClassDB::bind_method(D_METHOD("set_deferred_mode", "mode"), &ColorPicker::set_deferred_mode); ClassDB::bind_method(D_METHOD("is_deferred_mode"), &ColorPicker::is_deferred_mode); @@ -693,21 +693,6 @@ void ColorPicker::_bind_methods() { ClassDB::bind_method(D_METHOD("add_preset", "color"), &ColorPicker::add_preset); ClassDB::bind_method(D_METHOD("erase_preset", "color"), &ColorPicker::erase_preset); ClassDB::bind_method(D_METHOD("get_presets"), &ColorPicker::get_presets); - ClassDB::bind_method(D_METHOD("_value_changed"), &ColorPicker::_value_changed); - ClassDB::bind_method(D_METHOD("_html_entered"), &ColorPicker::_html_entered); - ClassDB::bind_method(D_METHOD("_text_type_toggled"), &ColorPicker::_text_type_toggled); - ClassDB::bind_method(D_METHOD("_add_preset_pressed"), &ColorPicker::_add_preset_pressed); - ClassDB::bind_method(D_METHOD("_screen_pick_pressed"), &ColorPicker::_screen_pick_pressed); - ClassDB::bind_method(D_METHOD("_sample_draw"), &ColorPicker::_sample_draw); - ClassDB::bind_method(D_METHOD("_update_presets"), &ColorPicker::_update_presets); - ClassDB::bind_method(D_METHOD("_hsv_draw"), &ColorPicker::_hsv_draw); - ClassDB::bind_method(D_METHOD("_uv_input"), &ColorPicker::_uv_input); - ClassDB::bind_method(D_METHOD("_w_input"), &ColorPicker::_w_input); - ClassDB::bind_method(D_METHOD("_preset_input"), &ColorPicker::_preset_input); - ClassDB::bind_method(D_METHOD("_screen_input"), &ColorPicker::_screen_input); - ClassDB::bind_method(D_METHOD("_focus_enter"), &ColorPicker::_focus_enter); - ClassDB::bind_method(D_METHOD("_focus_exit"), &ColorPicker::_focus_exit); - ClassDB::bind_method(D_METHOD("_html_focus_exit"), &ColorPicker::_html_focus_exit); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_pick_color", "get_pick_color"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha"); @@ -742,20 +727,20 @@ ColorPicker::ColorPicker() : uv_edit = memnew(Control); hb_edit->add_child(uv_edit); - uv_edit->connect_compat("gui_input", this, "_uv_input"); + uv_edit->connect("gui_input", callable_mp(this, &ColorPicker::_uv_input)); uv_edit->set_mouse_filter(MOUSE_FILTER_PASS); uv_edit->set_h_size_flags(SIZE_EXPAND_FILL); uv_edit->set_v_size_flags(SIZE_EXPAND_FILL); uv_edit->set_custom_minimum_size(Size2(get_constant("sv_width"), get_constant("sv_height"))); - uv_edit->connect_compat("draw", this, "_hsv_draw", make_binds(0, uv_edit)); + uv_edit->connect("draw", callable_mp(this, &ColorPicker::_hsv_draw), make_binds(0, uv_edit)); w_edit = memnew(Control); hb_edit->add_child(w_edit); w_edit->set_custom_minimum_size(Size2(get_constant("h_width"), 0)); w_edit->set_h_size_flags(SIZE_FILL); w_edit->set_v_size_flags(SIZE_EXPAND_FILL); - w_edit->connect_compat("gui_input", this, "_w_input"); - w_edit->connect_compat("draw", this, "_hsv_draw", make_binds(1, w_edit)); + w_edit->connect("gui_input", callable_mp(this, &ColorPicker::_w_input)); + w_edit->connect("draw", callable_mp(this, &ColorPicker::_hsv_draw), make_binds(1, w_edit)); HBoxContainer *hb_smpl = memnew(HBoxContainer); add_child(hb_smpl); @@ -763,13 +748,13 @@ ColorPicker::ColorPicker() : sample = memnew(TextureRect); hb_smpl->add_child(sample); sample->set_h_size_flags(SIZE_EXPAND_FILL); - sample->connect_compat("draw", this, "_sample_draw"); + sample->connect("draw", callable_mp(this, &ColorPicker::_sample_draw)); btn_pick = memnew(ToolButton); hb_smpl->add_child(btn_pick); btn_pick->set_toggle_mode(true); btn_pick->set_tooltip(TTR("Pick a color from the editor window.")); - btn_pick->connect_compat("pressed", this, "_screen_pick_pressed"); + btn_pick->connect("pressed", callable_mp(this, &ColorPicker::_screen_pick_pressed)); VBoxContainer *vbl = memnew(VBoxContainer); add_child(vbl); @@ -797,14 +782,14 @@ ColorPicker::ColorPicker() : values[i] = memnew(SpinBox); scroll[i]->share(values[i]); hbc->add_child(values[i]); - values[i]->get_line_edit()->connect_compat("focus_entered", this, "_focus_enter"); - values[i]->get_line_edit()->connect_compat("focus_exited", this, "_focus_exit"); + values[i]->get_line_edit()->connect("focus_entered", callable_mp(this, &ColorPicker::_focus_enter)); + values[i]->get_line_edit()->connect("focus_exited", callable_mp(this, &ColorPicker::_focus_exit)); scroll[i]->set_min(0); scroll[i]->set_page(0); scroll[i]->set_h_size_flags(SIZE_EXPAND_FILL); - scroll[i]->connect_compat("value_changed", this, "_value_changed"); + scroll[i]->connect("value_changed", callable_mp(this, &ColorPicker::_value_changed)); vbr->add_child(hbc); } @@ -816,12 +801,12 @@ ColorPicker::ColorPicker() : btn_hsv = memnew(CheckButton); hhb->add_child(btn_hsv); btn_hsv->set_text(TTR("HSV")); - btn_hsv->connect_compat("toggled", this, "set_hsv_mode"); + btn_hsv->connect("toggled", callable_mp(this, &ColorPicker::set_hsv_mode)); btn_raw = memnew(CheckButton); hhb->add_child(btn_raw); btn_raw->set_text(TTR("Raw")); - btn_raw->connect_compat("toggled", this, "set_raw_mode"); + btn_raw->connect("toggled", callable_mp(this, &ColorPicker::set_raw_mode)); text_type = memnew(Button); hhb->add_child(text_type); @@ -832,7 +817,7 @@ ColorPicker::ColorPicker() : #ifdef TOOLS_ENABLED text_type->set_custom_minimum_size(Size2(28 * EDSCALE, 0)); // Adjust for the width of the "Script" icon. #endif - text_type->connect_compat("pressed", this, "_text_type_toggled"); + text_type->connect("pressed", callable_mp(this, &ColorPicker::_text_type_toggled)); } else { text_type->set_flat(true); @@ -842,9 +827,9 @@ ColorPicker::ColorPicker() : c_text = memnew(LineEdit); hhb->add_child(c_text); c_text->set_h_size_flags(SIZE_EXPAND_FILL); - c_text->connect_compat("text_entered", this, "_html_entered"); - c_text->connect_compat("focus_entered", this, "_focus_enter"); - c_text->connect_compat("focus_exited", this, "_html_focus_exit"); + c_text->connect("text_entered", callable_mp(this, &ColorPicker::_html_entered)); + c_text->connect("focus_entered", callable_mp(this, &ColorPicker::_focus_enter)); + c_text->connect("focus_exited", callable_mp(this, &ColorPicker::_html_focus_exit)); _update_controls(); updating = false; @@ -860,8 +845,8 @@ ColorPicker::ColorPicker() : preset = memnew(TextureRect); preset_container->add_child(preset); - preset->connect_compat("gui_input", this, "_preset_input"); - preset->connect_compat("draw", this, "_update_presets"); + preset->connect("gui_input", callable_mp(this, &ColorPicker::_preset_input)); + preset->connect("draw", callable_mp(this, &ColorPicker::_update_presets)); preset_container2 = memnew(HBoxContainer); preset_container2->set_h_size_flags(SIZE_EXPAND_FILL); @@ -869,7 +854,7 @@ ColorPicker::ColorPicker() : bt_add_preset = memnew(Button); preset_container2->add_child(bt_add_preset); bt_add_preset->set_tooltip(TTR("Add current color as a preset.")); - bt_add_preset->connect_compat("pressed", this, "_add_preset_pressed"); + bt_add_preset->connect("pressed", callable_mp(this, &ColorPicker::_add_preset_pressed)); } ///////////////// @@ -969,10 +954,10 @@ void ColorPickerButton::_update_picker() { picker = memnew(ColorPicker); popup->add_child(picker); add_child(popup); - picker->connect_compat("color_changed", this, "_color_changed"); - popup->connect_compat("modal_closed", this, "_modal_closed"); - popup->connect_compat("about_to_show", this, "set_pressed", varray(true)); - popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); + picker->connect("color_changed", callable_mp(this, &ColorPickerButton::_color_changed)); + popup->connect("modal_closed", callable_mp(this, &ColorPickerButton::_modal_closed)); + popup->connect("about_to_show", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true)); + popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false)); picker->set_pick_color(color); picker->set_edit_alpha(edit_alpha); emit_signal("picker_created"); @@ -987,8 +972,6 @@ void ColorPickerButton::_bind_methods() { ClassDB::bind_method(D_METHOD("get_popup"), &ColorPickerButton::get_popup); ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPickerButton::set_edit_alpha); ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPickerButton::is_editing_alpha); - ClassDB::bind_method(D_METHOD("_color_changed"), &ColorPickerButton::_color_changed); - ClassDB::bind_method(D_METHOD("_modal_closed"), &ColorPickerButton::_modal_closed); ADD_SIGNAL(MethodInfo("color_changed", PropertyInfo(Variant::COLOR, "color"))); ADD_SIGNAL(MethodInfo("popup_closed")); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index f6ce0c9a60..41f33bb719 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -48,9 +48,9 @@ void Container::add_child_notify(Node *p_child) { if (!control) return; - control->connect_compat("size_flags_changed", this, "queue_sort"); - control->connect_compat("minimum_size_changed", this, "_child_minsize_changed"); - control->connect_compat("visibility_changed", this, "_child_minsize_changed"); + control->connect("size_flags_changed", callable_mp(this, &Container::queue_sort)); + control->connect("minimum_size_changed", callable_mp(this, &Container::_child_minsize_changed)); + control->connect("visibility_changed", callable_mp(this, &Container::_child_minsize_changed)); minimum_size_changed(); queue_sort(); @@ -75,9 +75,9 @@ void Container::remove_child_notify(Node *p_child) { if (!control) return; - control->disconnect_compat("size_flags_changed", this, "queue_sort"); - control->disconnect_compat("minimum_size_changed", this, "_child_minsize_changed"); - control->disconnect_compat("visibility_changed", this, "_child_minsize_changed"); + control->disconnect("size_flags_changed", callable_mp(this, &Container::queue_sort)); + control->disconnect("minimum_size_changed", callable_mp(this, &Container::_child_minsize_changed)); + control->disconnect("visibility_changed", callable_mp(this, &Container::_child_minsize_changed)); minimum_size_changed(); queue_sort(); @@ -185,7 +185,6 @@ String Container::get_configuration_warning() const { void Container::_bind_methods() { ClassDB::bind_method(D_METHOD("_sort_children"), &Container::_sort_children); - ClassDB::bind_method(D_METHOD("_child_minsize_changed"), &Container::_child_minsize_changed); ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort); ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child", "rect"), &Container::fit_child_in_rect); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index d3027b606d..1a231e368b 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -221,28 +221,28 @@ bool Control::_set(const StringName &p_name, const Variant &p_value) { if (name.begins_with("custom_icons/")) { String dname = name.get_slicec('/', 1); if (data.icon_override.has(dname)) { - data.icon_override[dname]->disconnect_compat("changed", this, "_override_changed"); + data.icon_override[dname]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } data.icon_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_shaders/")) { String dname = name.get_slicec('/', 1); if (data.shader_override.has(dname)) { - data.shader_override[dname]->disconnect_compat("changed", this, "_override_changed"); + data.shader_override[dname]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } data.shader_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_styles/")) { String dname = name.get_slicec('/', 1); if (data.style_override.has(dname)) { - data.style_override[dname]->disconnect_compat("changed", this, "_override_changed"); + data.style_override[dname]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } data.style_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_fonts/")) { String dname = name.get_slicec('/', 1); if (data.font_override.has(dname)) { - data.font_override[dname]->disconnect_compat("changed", this, "_override_changed"); + data.font_override[dname]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } data.font_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); @@ -542,10 +542,10 @@ void Control::_notification(int p_notification) { if (data.parent_canvas_item) { - data.parent_canvas_item->connect_compat("item_rect_changed", this, "_size_changed"); + data.parent_canvas_item->connect("item_rect_changed", callable_mp(this, &Control::_size_changed)); } else { //connect viewport - get_viewport()->connect_compat("size_changed", this, "_size_changed"); + get_viewport()->connect("size_changed", callable_mp(this, &Control::_size_changed)); } } @@ -561,11 +561,11 @@ void Control::_notification(int p_notification) { if (data.parent_canvas_item) { - data.parent_canvas_item->disconnect_compat("item_rect_changed", this, "_size_changed"); + data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed)); data.parent_canvas_item = NULL; } else if (!is_set_as_toplevel()) { //disconnect viewport - get_viewport()->disconnect_compat("size_changed", this, "_size_changed"); + get_viewport()->disconnect("size_changed", callable_mp(this, &Control::_size_changed)); } if (data.MI) { @@ -1883,7 +1883,7 @@ Rect2 Control::get_anchorable_rect() const { void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> &p_icon) { if (data.icon_override.has(p_name)) { - data.icon_override[p_name]->disconnect_compat("changed", this, "_override_changed"); + data.icon_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } // clear if "null" is passed instead of a icon @@ -1892,7 +1892,7 @@ void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> & } else { data.icon_override[p_name] = p_icon; if (data.icon_override[p_name].is_valid()) { - data.icon_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.icon_override[p_name]->connect("changed", callable_mp(this, &Control::_override_changed), Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -1901,7 +1901,7 @@ void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> & void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p_shader) { if (data.shader_override.has(p_name)) { - data.shader_override[p_name]->disconnect_compat("changed", this, "_override_changed"); + data.shader_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } // clear if "null" is passed instead of a shader @@ -1910,7 +1910,7 @@ void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p } else { data.shader_override[p_name] = p_shader; if (data.shader_override[p_name].is_valid()) { - data.shader_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.shader_override[p_name]->connect("changed", callable_mp(this, &Control::_override_changed), Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -1918,7 +1918,7 @@ void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> &p_style) { if (data.style_override.has(p_name)) { - data.style_override[p_name]->disconnect_compat("changed", this, "_override_changed"); + data.style_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } // clear if "null" is passed instead of a style @@ -1927,7 +1927,7 @@ void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> & } else { data.style_override[p_name] = p_style; if (data.style_override[p_name].is_valid()) { - data.style_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.style_override[p_name]->connect("changed", callable_mp(this, &Control::_override_changed), Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -1936,7 +1936,7 @@ void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> & void Control::add_font_override(const StringName &p_name, const Ref<Font> &p_font) { if (data.font_override.has(p_name)) { - data.font_override[p_name]->disconnect_compat("changed", this, "_override_changed"); + data.font_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed)); } // clear if "null" is passed instead of a font @@ -1945,7 +1945,7 @@ void Control::add_font_override(const StringName &p_name, const Ref<Font> &p_fon } else { data.font_override[p_name] = p_font; if (data.font_override[p_name].is_valid()) { - data.font_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.font_override[p_name]->connect("changed", callable_mp(this, &Control::_override_changed), Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -2262,7 +2262,7 @@ void Control::set_theme(const Ref<Theme> &p_theme) { return; if (data.theme.is_valid()) { - data.theme->disconnect_compat("changed", this, "_theme_changed"); + data.theme->disconnect("changed", callable_mp(this, &Control::_theme_changed)); } data.theme = p_theme; @@ -2282,7 +2282,7 @@ void Control::set_theme(const Ref<Theme> &p_theme) { } if (data.theme.is_valid()) { - data.theme->connect_compat("changed", this, "_theme_changed", varray(), CONNECT_DEFERRED); + data.theme->connect("changed", callable_mp(this, &Control::_theme_changed), varray(), CONNECT_DEFERRED); } } @@ -2813,7 +2813,6 @@ Control::GrowDirection Control::get_v_grow_direction() const { void Control::_bind_methods() { //ClassDB::bind_method(D_METHOD("_window_resize_event"),&Control::_window_resize_event); - ClassDB::bind_method(D_METHOD("_size_changed"), &Control::_size_changed); ClassDB::bind_method(D_METHOD("_update_minimum_size"), &Control::_update_minimum_size); ClassDB::bind_method(D_METHOD("accept_event"), &Control::accept_event); @@ -2942,10 +2941,6 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("minimum_size_changed"), &Control::minimum_size_changed); - ClassDB::bind_method(D_METHOD("_theme_changed"), &Control::_theme_changed); - - ClassDB::bind_method(D_METHOD("_override_changed"), &Control::_override_changed); - BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size")); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 7839b7d66a..6cadd0a63e 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -336,7 +336,6 @@ void WindowDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("get_title"), &WindowDialog::get_title); ClassDB::bind_method(D_METHOD("set_resizable", "resizable"), &WindowDialog::set_resizable); ClassDB::bind_method(D_METHOD("get_resizable"), &WindowDialog::get_resizable); - ClassDB::bind_method(D_METHOD("_closed"), &WindowDialog::_closed); ClassDB::bind_method(D_METHOD("get_close_button"), &WindowDialog::get_close_button); ADD_PROPERTY(PropertyInfo(Variant::STRING, "window_title", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_title", "get_title"); @@ -349,7 +348,7 @@ WindowDialog::WindowDialog() { resizable = false; close_button = memnew(TextureButton); add_child(close_button); - close_button->connect_compat("pressed", this, "_closed"); + close_button->connect("pressed", callable_mp(this, &WindowDialog::_closed)); #ifdef TOOLS_ENABLED was_editor_dimmed = false; @@ -397,7 +396,7 @@ void AcceptDialog::_notification(int p_what) { } } -void AcceptDialog::_builtin_text_entered(const String &p_text) { +void AcceptDialog::_text_entered(const String &p_text) { _ok_pressed(); } @@ -409,11 +408,18 @@ void AcceptDialog::_ok_pressed() { ok_pressed(); emit_signal("confirmed"); } + void AcceptDialog::_close_pressed() { cancel_pressed(); } +// FIXME: This is redundant with _closed_pressed, but there's a slight behavior +// change (WindowDialog's _closed() also calls hide()) which should be assessed. +void AcceptDialog::_on_close_pressed() { + _closed(); // From WindowDialog. +} + String AcceptDialog::get_text() const { return label->get_text(); @@ -448,7 +454,7 @@ void AcceptDialog::register_text_enter(Node *p_line_edit) { ERR_FAIL_NULL(p_line_edit); LineEdit *line_edit = Object::cast_to<LineEdit>(p_line_edit); if (line_edit) - line_edit->connect_compat("text_entered", this, "_builtin_text_entered"); + line_edit->connect("text_entered", callable_mp(this, &AcceptDialog::_text_entered)); } void AcceptDialog::_update_child_rects() { @@ -533,7 +539,7 @@ Button *AcceptDialog::add_button(const String &p_text, bool p_right, const Strin } if (p_action != "") { - button->connect_compat("pressed", this, "_custom_action", varray(p_action)); + button->connect("pressed", callable_mp(this, &AcceptDialog::_custom_action), varray(p_action)); } return button; @@ -545,22 +551,19 @@ Button *AcceptDialog::add_cancel(const String &p_cancel) { if (p_cancel == "") c = RTR("Cancel"); Button *b = swap_ok_cancel ? add_button(c, true) : add_button(c); - b->connect_compat("pressed", this, "_closed"); + b->connect("pressed", callable_mp(this, &AcceptDialog::_on_close_pressed)); return b; } void AcceptDialog::_bind_methods() { - ClassDB::bind_method(D_METHOD("_ok"), &AcceptDialog::_ok_pressed); ClassDB::bind_method(D_METHOD("get_ok"), &AcceptDialog::get_ok); ClassDB::bind_method(D_METHOD("get_label"), &AcceptDialog::get_label); ClassDB::bind_method(D_METHOD("set_hide_on_ok", "enabled"), &AcceptDialog::set_hide_on_ok); ClassDB::bind_method(D_METHOD("get_hide_on_ok"), &AcceptDialog::get_hide_on_ok); ClassDB::bind_method(D_METHOD("add_button", "text", "right", "action"), &AcceptDialog::add_button, DEFVAL(false), DEFVAL("")); ClassDB::bind_method(D_METHOD("add_cancel", "name"), &AcceptDialog::add_cancel); - ClassDB::bind_method(D_METHOD("_builtin_text_entered"), &AcceptDialog::_builtin_text_entered); ClassDB::bind_method(D_METHOD("register_text_enter", "line_edit"), &AcceptDialog::register_text_enter); - ClassDB::bind_method(D_METHOD("_custom_action"), &AcceptDialog::_custom_action); ClassDB::bind_method(D_METHOD("set_text", "text"), &AcceptDialog::set_text); ClassDB::bind_method(D_METHOD("get_text"), &AcceptDialog::get_text); ClassDB::bind_method(D_METHOD("set_autowrap", "autowrap"), &AcceptDialog::set_autowrap); @@ -602,7 +605,7 @@ AcceptDialog::AcceptDialog() { hbc->add_child(ok); hbc->add_spacer(); - ok->connect_compat("pressed", this, "_ok"); + ok->connect("pressed", callable_mp(this, &AcceptDialog::_ok_pressed)); set_as_toplevel(true); hide_on_ok = true; diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index b6381e98b4..c474f7849d 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -64,7 +64,6 @@ class WindowDialog : public Popup { #endif void _gui_input(const Ref<InputEvent> &p_event); - void _closed(); int _drag_hit_test(const Point2 &pos) const; protected: @@ -75,6 +74,9 @@ protected: void _notification(int p_what); static void _bind_methods(); + // Not private since used by derived classes signal. + void _closed(); + public: TextureButton *get_close_button(); @@ -113,9 +115,7 @@ class AcceptDialog : public WindowDialog { bool hide_on_ok; void _custom_action(const String &p_action); - void _ok_pressed(); void _close_pressed(); - void _builtin_text_entered(const String &p_text); void _update_child_rects(); static bool swap_ok_cancel; @@ -128,6 +128,11 @@ protected: virtual void cancel_pressed() {} virtual void custom_action(const String &) {} + // Not private since used by derived classes signal. + void _text_entered(const String &p_text); + void _ok_pressed(); + void _on_close_pressed(); + public: Size2 get_minimum_size() const; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index e27e7d1490..a7205cef66 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -805,15 +805,7 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_unhandled_input"), &FileDialog::_unhandled_input); - ClassDB::bind_method(D_METHOD("_tree_multi_selected"), &FileDialog::_tree_multi_selected); - ClassDB::bind_method(D_METHOD("_tree_selected"), &FileDialog::_tree_selected); - ClassDB::bind_method(D_METHOD("_tree_item_activated"), &FileDialog::_tree_item_activated); - ClassDB::bind_method(D_METHOD("_dir_entered"), &FileDialog::_dir_entered); - ClassDB::bind_method(D_METHOD("_file_entered"), &FileDialog::_file_entered); - ClassDB::bind_method(D_METHOD("_action_pressed"), &FileDialog::_action_pressed); ClassDB::bind_method(D_METHOD("_cancel_pressed"), &FileDialog::_cancel_pressed); - ClassDB::bind_method(D_METHOD("_filter_selected"), &FileDialog::_filter_selected); - ClassDB::bind_method(D_METHOD("_save_confirm_pressed"), &FileDialog::_save_confirm_pressed); ClassDB::bind_method(D_METHOD("clear_filters"), &FileDialog::clear_filters); ClassDB::bind_method(D_METHOD("add_filter", "filter"), &FileDialog::add_filter); @@ -835,13 +827,8 @@ void FileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("get_access"), &FileDialog::get_access); ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &FileDialog::set_show_hidden_files); ClassDB::bind_method(D_METHOD("is_showing_hidden_files"), &FileDialog::is_showing_hidden_files); - ClassDB::bind_method(D_METHOD("_select_drive"), &FileDialog::_select_drive); - ClassDB::bind_method(D_METHOD("_make_dir"), &FileDialog::_make_dir); - ClassDB::bind_method(D_METHOD("_make_dir_confirm"), &FileDialog::_make_dir_confirm); ClassDB::bind_method(D_METHOD("_update_file_name"), &FileDialog::update_file_name); - ClassDB::bind_method(D_METHOD("_update_file_list"), &FileDialog::update_file_list); ClassDB::bind_method(D_METHOD("_update_dir"), &FileDialog::update_dir); - ClassDB::bind_method(D_METHOD("_go_up"), &FileDialog::_go_up); ClassDB::bind_method(D_METHOD("deselect_items"), &FileDialog::deselect_items); ClassDB::bind_method(D_METHOD("invalidate"), &FileDialog::invalidate); @@ -900,11 +887,11 @@ FileDialog::FileDialog() { dir_up = memnew(ToolButton); dir_up->set_tooltip(RTR("Go to parent folder.")); hbc->add_child(dir_up); - dir_up->connect_compat("pressed", this, "_go_up"); + dir_up->connect("pressed", callable_mp(this, &FileDialog::_go_up)); drives = memnew(OptionButton); hbc->add_child(drives); - drives->connect_compat("item_selected", this, "_select_drive"); + drives->connect("item_selected", callable_mp(this, &FileDialog::_select_drive)); hbc->add_child(memnew(Label(RTR("Path:")))); dir = memnew(LineEdit); @@ -913,19 +900,19 @@ FileDialog::FileDialog() { refresh = memnew(ToolButton); refresh->set_tooltip(RTR("Refresh files.")); - refresh->connect_compat("pressed", this, "_update_file_list"); + refresh->connect("pressed", callable_mp(this, &FileDialog::update_file_list)); hbc->add_child(refresh); show_hidden = memnew(ToolButton); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); show_hidden->set_tooltip(RTR("Toggle the visibility of hidden files.")); - show_hidden->connect_compat("toggled", this, "set_show_hidden_files"); + show_hidden->connect("toggled", callable_mp(this, &FileDialog::set_show_hidden_files)); hbc->add_child(show_hidden); makedir = memnew(Button); makedir->set_text(RTR("Create Folder")); - makedir->connect_compat("pressed", this, "_make_dir"); + makedir->connect("pressed", callable_mp(this, &FileDialog::_make_dir)); hbc->add_child(makedir); vbc->add_child(hbc); @@ -950,20 +937,20 @@ FileDialog::FileDialog() { access = ACCESS_RESOURCES; _update_drives(); - connect_compat("confirmed", this, "_action_pressed"); - tree->connect_compat("multi_selected", this, "_tree_multi_selected", varray(), CONNECT_DEFERRED); - tree->connect_compat("cell_selected", this, "_tree_selected", varray(), CONNECT_DEFERRED); - tree->connect_compat("item_activated", this, "_tree_item_activated", varray()); - tree->connect_compat("nothing_selected", this, "deselect_items"); - dir->connect_compat("text_entered", this, "_dir_entered"); - file->connect_compat("text_entered", this, "_file_entered"); - filter->connect_compat("item_selected", this, "_filter_selected"); + connect("confirmed", callable_mp(this, &FileDialog::_action_pressed)); + tree->connect("multi_selected", callable_mp(this, &FileDialog::_tree_multi_selected), varray(), CONNECT_DEFERRED); + tree->connect("cell_selected", callable_mp(this, &FileDialog::_tree_selected), varray(), CONNECT_DEFERRED); + tree->connect("item_activated", callable_mp(this, &FileDialog::_tree_item_activated), varray()); + tree->connect("nothing_selected", callable_mp(this, &FileDialog::deselect_items)); + dir->connect("text_entered", callable_mp(this, &FileDialog::_dir_entered)); + file->connect("text_entered", callable_mp(this, &FileDialog::_file_entered)); + filter->connect("item_selected", callable_mp(this, &FileDialog::_filter_selected)); confirm_save = memnew(ConfirmationDialog); confirm_save->set_as_toplevel(true); add_child(confirm_save); - confirm_save->connect_compat("confirmed", this, "_save_confirm_pressed"); + confirm_save->connect("confirmed", callable_mp(this, &FileDialog::_save_confirm_pressed)); makedialog = memnew(ConfirmationDialog); makedialog->set_title(RTR("Create Folder")); @@ -974,7 +961,7 @@ FileDialog::FileDialog() { makevb->add_margin_child(RTR("Name:"), makedirname); add_child(makedialog); makedialog->register_text_enter(makedirname); - makedialog->connect_compat("confirmed", this, "_make_dir_confirm"); + makedialog->connect("confirmed", callable_mp(this, &FileDialog::_make_dir_confirm)); mkdirerr = memnew(AcceptDialog); mkdirerr->set_text(RTR("Could not create folder.")); add_child(mkdirerr); @@ -1003,8 +990,6 @@ FileDialog::~FileDialog() { void LineEditFileChooser::_bind_methods() { - ClassDB::bind_method(D_METHOD("_browse"), &LineEditFileChooser::_browse); - ClassDB::bind_method(D_METHOD("_chosen"), &LineEditFileChooser::_chosen); ClassDB::bind_method(D_METHOD("get_button"), &LineEditFileChooser::get_button); ClassDB::bind_method(D_METHOD("get_line_edit"), &LineEditFileChooser::get_line_edit); ClassDB::bind_method(D_METHOD("get_file_dialog"), &LineEditFileChooser::get_file_dialog); @@ -1029,10 +1014,10 @@ LineEditFileChooser::LineEditFileChooser() { button = memnew(Button); button->set_text(" .. "); add_child(button); - button->connect_compat("pressed", this, "_browse"); + button->connect("pressed", callable_mp(this, &LineEditFileChooser::_browse)); dialog = memnew(FileDialog); add_child(dialog); - dialog->connect_compat("file_selected", this, "_chosen"); - dialog->connect_compat("dir_selected", this, "_chosen"); - dialog->connect_compat("files_selected", this, "_chosen"); + dialog->connect("file_selected", callable_mp(this, &LineEditFileChooser::_chosen)); + dialog->connect("dir_selected", callable_mp(this, &LineEditFileChooser::_chosen)); + dialog->connect("files_selected", callable_mp(this, &LineEditFileChooser::_chosen)); } diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index 98c2d3a0e9..c49cf0fcea 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -302,8 +302,8 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { void GradientEdit::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (!picker->is_connected_compat("color_changed", this, "_color_changed")) { - picker->connect_compat("color_changed", this, "_color_changed"); + if (!picker->is_connected("color_changed", callable_mp(this, &GradientEdit::_color_changed))) { + picker->connect("color_changed", callable_mp(this, &GradientEdit::_color_changed)); } } if (p_what == NOTIFICATION_DRAW) { @@ -490,6 +490,5 @@ Vector<Gradient::Point> &GradientEdit::get_points() { void GradientEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &GradientEdit::_gui_input); - ClassDB::bind_method(D_METHOD("_color_changed"), &GradientEdit::_color_changed); ADD_SIGNAL(MethodInfo("ramp_changed")); } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index a9bdede852..bd29893bdf 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -257,9 +257,9 @@ void GraphEdit::add_child_notify(Node *p_child) { GraphNode *gn = Object::cast_to<GraphNode>(p_child); if (gn) { gn->set_scale(Vector2(zoom, zoom)); - gn->connect_compat("offset_changed", this, "_graph_node_moved", varray(gn)); - gn->connect_compat("raise_request", this, "_graph_node_raised", varray(gn)); - gn->connect_compat("item_rect_changed", connections_layer, "update"); + gn->connect("offset_changed", callable_mp(this, &GraphEdit::_graph_node_moved), varray(gn)); + gn->connect("raise_request", callable_mp(this, &GraphEdit::_graph_node_raised), varray(gn)); + gn->connect("item_rect_changed", callable_mp((CanvasItem *)connections_layer, &CanvasItem::update)); _graph_node_moved(gn); gn->set_mouse_filter(MOUSE_FILTER_PASS); } @@ -273,8 +273,8 @@ void GraphEdit::remove_child_notify(Node *p_child) { } GraphNode *gn = Object::cast_to<GraphNode>(p_child); if (gn) { - gn->disconnect_compat("offset_changed", this, "_graph_node_moved"); - gn->disconnect_compat("raise_request", this, "_graph_node_raised"); + gn->disconnect("offset_changed", callable_mp(this, &GraphEdit::_graph_node_moved)); + gn->disconnect("raise_request", callable_mp(this, &GraphEdit::_graph_node_raised)); } } @@ -1291,21 +1291,8 @@ void GraphEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("set_right_disconnects", "enable"), &GraphEdit::set_right_disconnects); ClassDB::bind_method(D_METHOD("is_right_disconnects_enabled"), &GraphEdit::is_right_disconnects_enabled); - ClassDB::bind_method(D_METHOD("_graph_node_moved"), &GraphEdit::_graph_node_moved); - ClassDB::bind_method(D_METHOD("_graph_node_raised"), &GraphEdit::_graph_node_raised); - - ClassDB::bind_method(D_METHOD("_top_layer_input"), &GraphEdit::_top_layer_input); - ClassDB::bind_method(D_METHOD("_top_layer_draw"), &GraphEdit::_top_layer_draw); - ClassDB::bind_method(D_METHOD("_scroll_moved"), &GraphEdit::_scroll_moved); - ClassDB::bind_method(D_METHOD("_zoom_minus"), &GraphEdit::_zoom_minus); - ClassDB::bind_method(D_METHOD("_zoom_reset"), &GraphEdit::_zoom_reset); - ClassDB::bind_method(D_METHOD("_zoom_plus"), &GraphEdit::_zoom_plus); - ClassDB::bind_method(D_METHOD("_snap_toggled"), &GraphEdit::_snap_toggled); - ClassDB::bind_method(D_METHOD("_snap_value_changed"), &GraphEdit::_snap_value_changed); - ClassDB::bind_method(D_METHOD("_gui_input"), &GraphEdit::_gui_input); ClassDB::bind_method(D_METHOD("_update_scroll_offset"), &GraphEdit::_update_scroll_offset); - ClassDB::bind_method(D_METHOD("_connections_layer_draw"), &GraphEdit::_connections_layer_draw); ClassDB::bind_method(D_METHOD("get_zoom_hbox"), &GraphEdit::get_zoom_hbox); @@ -1341,12 +1328,12 @@ GraphEdit::GraphEdit() { add_child(top_layer); top_layer->set_mouse_filter(MOUSE_FILTER_PASS); top_layer->set_anchors_and_margins_preset(Control::PRESET_WIDE); - top_layer->connect_compat("draw", this, "_top_layer_draw"); - top_layer->connect_compat("gui_input", this, "_top_layer_input"); + top_layer->connect("draw", callable_mp(this, &GraphEdit::_top_layer_draw)); + top_layer->connect("gui_input", callable_mp(this, &GraphEdit::_top_layer_input)); connections_layer = memnew(Control); add_child(connections_layer); - connections_layer->connect_compat("draw", this, "_connections_layer_draw"); + connections_layer->connect("draw", callable_mp(this, &GraphEdit::_connections_layer_draw)); connections_layer->set_name("CLAYER"); connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offset connections_layer->set_mouse_filter(MOUSE_FILTER_IGNORE); @@ -1373,8 +1360,8 @@ GraphEdit::GraphEdit() { v_scroll->set_min(-10000); v_scroll->set_max(10000); - h_scroll->connect_compat("value_changed", this, "_scroll_moved"); - v_scroll->connect_compat("value_changed", this, "_scroll_moved"); + h_scroll->connect("value_changed", callable_mp(this, &GraphEdit::_scroll_moved)); + v_scroll->connect("value_changed", callable_mp(this, &GraphEdit::_scroll_moved)); zoom = 1; @@ -1385,25 +1372,25 @@ GraphEdit::GraphEdit() { zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); zoom_minus->set_tooltip(RTR("Zoom Out")); - zoom_minus->connect_compat("pressed", this, "_zoom_minus"); + zoom_minus->connect("pressed", callable_mp(this, &GraphEdit::_zoom_minus)); zoom_minus->set_focus_mode(FOCUS_NONE); zoom_reset = memnew(ToolButton); zoom_hb->add_child(zoom_reset); zoom_reset->set_tooltip(RTR("Zoom Reset")); - zoom_reset->connect_compat("pressed", this, "_zoom_reset"); + zoom_reset->connect("pressed", callable_mp(this, &GraphEdit::_zoom_reset)); zoom_reset->set_focus_mode(FOCUS_NONE); zoom_plus = memnew(ToolButton); zoom_hb->add_child(zoom_plus); zoom_plus->set_tooltip(RTR("Zoom In")); - zoom_plus->connect_compat("pressed", this, "_zoom_plus"); + zoom_plus->connect("pressed", callable_mp(this, &GraphEdit::_zoom_plus)); zoom_plus->set_focus_mode(FOCUS_NONE); snap_button = memnew(ToolButton); snap_button->set_toggle_mode(true); snap_button->set_tooltip(RTR("Enable snap and show grid.")); - snap_button->connect_compat("pressed", this, "_snap_toggled"); + snap_button->connect("pressed", callable_mp(this, &GraphEdit::_snap_toggled)); snap_button->set_pressed(true); snap_button->set_focus_mode(FOCUS_NONE); zoom_hb->add_child(snap_button); @@ -1413,7 +1400,7 @@ GraphEdit::GraphEdit() { snap_amount->set_max(100); snap_amount->set_step(1); snap_amount->set_value(20); - snap_amount->connect_compat("value_changed", this, "_snap_value_changed"); + snap_amount->connect("value_changed", callable_mp(this, &GraphEdit::_snap_value_changed)); zoom_hb->add_child(snap_amount); setting_scroll_ofs = false; diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 174dc65e8a..5e662b8df0 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1542,7 +1542,6 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("get_v_scroll"), &ItemList::get_v_scroll); - ClassDB::bind_method(D_METHOD("_scroll_changed"), &ItemList::_scroll_changed); ClassDB::bind_method(D_METHOD("_gui_input"), &ItemList::_gui_input); ClassDB::bind_method(D_METHOD("_set_items"), &ItemList::_set_items); @@ -1599,7 +1598,7 @@ ItemList::ItemList() { add_child(scroll_bar); shape_changed = true; - scroll_bar->connect_compat("value_changed", this, "_scroll_changed"); + scroll_bar->connect("value_changed", callable_mp(this, &ItemList::_scroll_changed)); set_focus_mode(FOCUS_ALL); current_columns = 1; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fb8396e4ff..20b739d60f 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -669,8 +669,8 @@ void LineEdit::_notification(int p_what) { cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false)); cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65)); - if (!EditorSettings::get_singleton()->is_connected_compat("settings_changed", this, "_editor_settings_changed")) { - EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_editor_settings_changed"); + if (!EditorSettings::get_singleton()->is_connected("settings_changed", callable_mp(this, &LineEdit::_editor_settings_changed))) { + EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &LineEdit::_editor_settings_changed)); } } } break; @@ -1773,9 +1773,6 @@ void LineEdit::_generate_context_menu() { void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed); - ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &LineEdit::_toggle_draw_caret); - - ClassDB::bind_method("_editor_settings_changed", &LineEdit::_editor_settings_changed); ClassDB::bind_method(D_METHOD("set_align", "align"), &LineEdit::set_align); ClassDB::bind_method(D_METHOD("get_align"), &LineEdit::get_align); @@ -1891,7 +1888,7 @@ LineEdit::LineEdit() { caret_blink_timer = memnew(Timer); add_child(caret_blink_timer); caret_blink_timer->set_wait_time(0.65); - caret_blink_timer->connect_compat("timeout", this, "_toggle_draw_caret"); + caret_blink_timer->connect("timeout", callable_mp(this, &LineEdit::_toggle_draw_caret)); cursor_set_blink_enabled(false); context_menu_enabled = true; @@ -1899,7 +1896,7 @@ LineEdit::LineEdit() { add_child(menu); editable = false; // Initialise to opposite first, so we get past the early-out in set_editable. set_editable(true); - menu->connect_compat("id_pressed", this, "menu_option"); + menu->connect("id_pressed", callable_mp(this, &LineEdit::menu_option)); expand_to_text_length = false; } diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index a211ee02ed..2b163187c5 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "menu_button.h" + #include "core/os/keyboard.h" #include "scene/main/viewport.h" @@ -137,8 +138,8 @@ MenuButton::MenuButton() { popup->hide(); add_child(popup); popup->set_pass_on_modal_close_click(false); - popup->connect_compat("about_to_show", this, "set_pressed", varray(true)); // For when switching from another MenuButton. - popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); + popup->connect("about_to_show", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true)); // For when switching from another MenuButton. + popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false)); } MenuButton::~MenuButton() { diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 6488d6ce0a..c185761beb 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "option_button.h" + #include "core/print_string.h" Size2 OptionButton::get_minimum_size() const { @@ -309,9 +310,6 @@ void OptionButton::get_translatable_strings(List<String> *p_strings) const { void OptionButton::_bind_methods() { - ClassDB::bind_method(D_METHOD("_selected"), &OptionButton::_selected); - ClassDB::bind_method(D_METHOD("_focused"), &OptionButton::_focused); - ClassDB::bind_method(D_METHOD("add_item", "label", "id"), &OptionButton::add_item, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &OptionButton::set_item_text); @@ -363,9 +361,9 @@ OptionButton::OptionButton() { popup->set_pass_on_modal_close_click(false); popup->set_notify_transform(true); popup->set_allow_search(true); - popup->connect_compat("index_pressed", this, "_selected"); - popup->connect_compat("id_focused", this, "_focused"); - popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); + popup->connect("index_pressed", callable_mp(this, &OptionButton::_selected)); + popup->connect("id_focused", callable_mp(this, &OptionButton::_focused)); + popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false)); } OptionButton::~OptionButton() { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 659d8041a2..c80a8b5f03 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "popup_menu.h" + #include "core/os/input.h" #include "core/os/keyboard.h" #include "core/os/os.h" @@ -1233,7 +1234,7 @@ void PopupMenu::_ref_shortcut(Ref<ShortCut> p_sc) { if (!shortcut_refcount.has(p_sc)) { shortcut_refcount[p_sc] = 1; - p_sc->connect_compat("changed", this, "update"); + p_sc->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update)); } else { shortcut_refcount[p_sc] += 1; } @@ -1244,7 +1245,7 @@ void PopupMenu::_unref_shortcut(Ref<ShortCut> p_sc) { ERR_FAIL_COND(!shortcut_refcount.has(p_sc)); shortcut_refcount[p_sc]--; if (shortcut_refcount[p_sc] == 0) { - p_sc->disconnect_compat("changed", this, "update"); + p_sc->disconnect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update)); shortcut_refcount.erase(p_sc); } } @@ -1471,8 +1472,6 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("set_allow_search", "allow"), &PopupMenu::set_allow_search); ClassDB::bind_method(D_METHOD("get_allow_search"), &PopupMenu::get_allow_search); - ClassDB::bind_method(D_METHOD("_submenu_timeout"), &PopupMenu::_submenu_timeout); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hide_on_item_selection"), "set_hide_on_item_selection", "is_hide_on_item_selection"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hide_on_checkable_item_selection"), "set_hide_on_checkable_item_selection", "is_hide_on_checkable_item_selection"); @@ -1514,7 +1513,7 @@ PopupMenu::PopupMenu() { submenu_timer = memnew(Timer); submenu_timer->set_wait_time(0.3); submenu_timer->set_one_shot(true); - submenu_timer->connect_compat("timeout", this, "_submenu_timeout"); + submenu_timer->connect("timeout", callable_mp(this, &PopupMenu::_submenu_timeout)); add_child(submenu_timer); } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 6282b26a5a..7a906fe91d 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2699,7 +2699,6 @@ int RichTextLabel::get_content_height() { void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &RichTextLabel::_gui_input); - ClassDB::bind_method(D_METHOD("_scroll_changed"), &RichTextLabel::_scroll_changed); ClassDB::bind_method(D_METHOD("get_text"), &RichTextLabel::get_text); ClassDB::bind_method(D_METHOD("add_text", "text"), &RichTextLabel::add_text); ClassDB::bind_method(D_METHOD("set_text", "text"), &RichTextLabel::set_text); @@ -2963,7 +2962,7 @@ RichTextLabel::RichTextLabel() { vscroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); vscroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); - vscroll->connect_compat("value_changed", this, "_scroll_changed"); + vscroll->connect("value_changed", callable_mp(this, &RichTextLabel::_scroll_changed)); vscroll->set_step(1); vscroll->hide(); current_idx = 1; diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 3d7b6b05ae..fef5e00984 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -296,15 +296,15 @@ void ScrollBar::_notification(int p_what) { } if (drag_node) { - drag_node->connect_compat("gui_input", this, "_drag_node_input"); - drag_node->connect_compat("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT); + drag_node->connect("gui_input", callable_mp(this, &ScrollBar::_drag_node_input)); + drag_node->connect("tree_exiting", callable_mp(this, &ScrollBar::_drag_node_exit), varray(), CONNECT_ONESHOT); } } if (p_what == NOTIFICATION_EXIT_TREE) { if (drag_node) { - drag_node->disconnect_compat("gui_input", this, "_drag_node_input"); - drag_node->disconnect_compat("tree_exiting", this, "_drag_node_exit"); + drag_node->disconnect("gui_input", callable_mp(this, &ScrollBar::_drag_node_input)); + drag_node->disconnect("tree_exiting", callable_mp(this, &ScrollBar::_drag_node_exit)); } drag_node = NULL; @@ -539,7 +539,7 @@ float ScrollBar::get_custom_step() const { void ScrollBar::_drag_node_exit() { if (drag_node) { - drag_node->disconnect_compat("gui_input", this, "_drag_node_input"); + drag_node->disconnect("gui_input", callable_mp(this, &ScrollBar::_drag_node_input)); } drag_node = NULL; } @@ -611,8 +611,8 @@ void ScrollBar::set_drag_node(const NodePath &p_path) { if (is_inside_tree()) { if (drag_node) { - drag_node->disconnect_compat("gui_input", this, "_drag_node_input"); - drag_node->disconnect_compat("tree_exiting", this, "_drag_node_exit"); + drag_node->disconnect("gui_input", callable_mp(this, &ScrollBar::_drag_node_input)); + drag_node->disconnect("tree_exiting", callable_mp(this, &ScrollBar::_drag_node_exit)); } } @@ -627,8 +627,8 @@ void ScrollBar::set_drag_node(const NodePath &p_path) { } if (drag_node) { - drag_node->connect_compat("gui_input", this, "_drag_node_input"); - drag_node->connect_compat("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT); + drag_node->connect("gui_input", callable_mp(this, &ScrollBar::_drag_node_input)); + drag_node->connect("tree_exiting", callable_mp(this, &ScrollBar::_drag_node_exit), varray(), CONNECT_ONESHOT); } } } @@ -651,8 +651,6 @@ void ScrollBar::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &ScrollBar::_gui_input); ClassDB::bind_method(D_METHOD("set_custom_step", "step"), &ScrollBar::set_custom_step); ClassDB::bind_method(D_METHOD("get_custom_step"), &ScrollBar::get_custom_step); - ClassDB::bind_method(D_METHOD("_drag_node_input"), &ScrollBar::_drag_node_input); - ClassDB::bind_method(D_METHOD("_drag_node_exit"), &ScrollBar::_drag_node_exit); ADD_SIGNAL(MethodInfo("scrolling")); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 5829a86a42..c25a6d5a0c 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -267,7 +267,7 @@ void ScrollContainer::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - get_viewport()->connect_compat("gui_focus_changed", this, "_ensure_focused_visible"); + get_viewport()->connect("gui_focus_changed", callable_mp(this, &ScrollContainer::_ensure_focused_visible)); } if (p_what == NOTIFICATION_SORT_CHILDREN) { @@ -570,14 +570,12 @@ VScrollBar *ScrollContainer::get_v_scrollbar() { void ScrollContainer::_bind_methods() { - ClassDB::bind_method(D_METHOD("_scroll_moved"), &ScrollContainer::_scroll_moved); ClassDB::bind_method(D_METHOD("_gui_input"), &ScrollContainer::_gui_input); ClassDB::bind_method(D_METHOD("set_enable_h_scroll", "enable"), &ScrollContainer::set_enable_h_scroll); ClassDB::bind_method(D_METHOD("is_h_scroll_enabled"), &ScrollContainer::is_h_scroll_enabled); ClassDB::bind_method(D_METHOD("set_enable_v_scroll", "enable"), &ScrollContainer::set_enable_v_scroll); ClassDB::bind_method(D_METHOD("is_v_scroll_enabled"), &ScrollContainer::is_v_scroll_enabled); ClassDB::bind_method(D_METHOD("_update_scrollbar_position"), &ScrollContainer::_update_scrollbar_position); - ClassDB::bind_method(D_METHOD("_ensure_focused_visible"), &ScrollContainer::_ensure_focused_visible); ClassDB::bind_method(D_METHOD("set_h_scroll", "value"), &ScrollContainer::set_h_scroll); ClassDB::bind_method(D_METHOD("get_h_scroll"), &ScrollContainer::get_h_scroll); ClassDB::bind_method(D_METHOD("set_v_scroll", "value"), &ScrollContainer::set_v_scroll); @@ -610,12 +608,12 @@ ScrollContainer::ScrollContainer() { h_scroll = memnew(HScrollBar); h_scroll->set_name("_h_scroll"); add_child(h_scroll); - h_scroll->connect_compat("value_changed", this, "_scroll_moved"); + h_scroll->connect("value_changed", callable_mp(this, &ScrollContainer::_scroll_moved)); v_scroll = memnew(VScrollBar); v_scroll->set_name("_v_scroll"); add_child(v_scroll); - v_scroll->connect_compat("value_changed", this, "_scroll_moved"); + v_scroll->connect("value_changed", callable_mp(this, &ScrollContainer::_scroll_moved)); drag_speed = Vector2(); drag_touching = false; diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 1200877127..576de98a4f 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -267,7 +267,6 @@ void SpinBox::_bind_methods() { //ClassDB::bind_method(D_METHOD("_value_changed"),&SpinBox::_value_changed); ClassDB::bind_method(D_METHOD("_gui_input"), &SpinBox::_gui_input); - ClassDB::bind_method(D_METHOD("_text_entered"), &SpinBox::_text_entered); ClassDB::bind_method(D_METHOD("set_align", "align"), &SpinBox::set_align); ClassDB::bind_method(D_METHOD("get_align"), &SpinBox::get_align); ClassDB::bind_method(D_METHOD("set_suffix", "suffix"), &SpinBox::set_suffix); @@ -277,10 +276,7 @@ void SpinBox::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editable", "editable"), &SpinBox::set_editable); ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable); ClassDB::bind_method(D_METHOD("apply"), &SpinBox::apply); - ClassDB::bind_method(D_METHOD("_line_edit_focus_exit"), &SpinBox::_line_edit_focus_exit); ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit); - ClassDB::bind_method(D_METHOD("_line_edit_input"), &SpinBox::_line_edit_input); - ClassDB::bind_method(D_METHOD("_range_click_timeout"), &SpinBox::_range_click_timeout); ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable"); @@ -297,12 +293,12 @@ SpinBox::SpinBox() { line_edit->set_anchors_and_margins_preset(Control::PRESET_WIDE); line_edit->set_mouse_filter(MOUSE_FILTER_PASS); //connect("value_changed",this,"_value_changed"); - line_edit->connect_compat("text_entered", this, "_text_entered", Vector<Variant>(), CONNECT_DEFERRED); - line_edit->connect_compat("focus_exited", this, "_line_edit_focus_exit", Vector<Variant>(), CONNECT_DEFERRED); - line_edit->connect_compat("gui_input", this, "_line_edit_input"); + line_edit->connect("text_entered", callable_mp(this, &SpinBox::_text_entered), Vector<Variant>(), CONNECT_DEFERRED); + line_edit->connect("focus_exited", callable_mp(this, &SpinBox::_line_edit_focus_exit), Vector<Variant>(), CONNECT_DEFERRED); + line_edit->connect("gui_input", callable_mp(this, &SpinBox::_line_edit_input)); drag.enabled = false; range_click_timer = memnew(Timer); - range_click_timer->connect_compat("timeout", this, "_range_click_timeout"); + range_click_timer->connect("timeout", callable_mp(this, &SpinBox::_range_click_timeout)); add_child(range_click_timer); } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index b3c4e3fa3c..6290d364fc 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -537,7 +537,7 @@ void TabContainer::add_child_notify(Node *p_child) { c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); update(); - p_child->connect_compat("renamed", this, "_child_renamed_callback"); + p_child->connect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback)); if (first && is_inside_tree()) emit_signal("tab_changed", current); } @@ -620,7 +620,7 @@ void TabContainer::remove_child_notify(Node *p_child) { call_deferred("_update_current_tab"); - p_child->disconnect_compat("renamed", this, "_child_renamed_callback"); + p_child->disconnect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback)); update(); } @@ -1011,9 +1011,7 @@ void TabContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_hidden_tabs_for_min_size", "enabled"), &TabContainer::set_use_hidden_tabs_for_min_size); ClassDB::bind_method(D_METHOD("get_use_hidden_tabs_for_min_size"), &TabContainer::get_use_hidden_tabs_for_min_size); - ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback); ClassDB::bind_method(D_METHOD("_on_theme_changed"), &TabContainer::_on_theme_changed); - ClassDB::bind_method(D_METHOD("_on_mouse_exited"), &TabContainer::_on_mouse_exited); ClassDB::bind_method(D_METHOD("_update_current_tab"), &TabContainer::_update_current_tab); ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab"))); @@ -1048,5 +1046,5 @@ TabContainer::TabContainer() { tabs_rearrange_group = -1; use_hidden_tabs_for_min_size = false; - connect_compat("mouse_exited", this, "_on_mouse_exited"); + connect("mouse_exited", callable_mp(this, &TabContainer::_on_mouse_exited)); } diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index ea1e6546e9..901408919a 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -956,7 +956,6 @@ void Tabs::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &Tabs::_gui_input); ClassDB::bind_method(D_METHOD("_update_hover"), &Tabs::_update_hover); - ClassDB::bind_method(D_METHOD("_on_mouse_exited"), &Tabs::_on_mouse_exited); ClassDB::bind_method(D_METHOD("get_tab_count"), &Tabs::get_tab_count); ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &Tabs::set_current_tab); ClassDB::bind_method(D_METHOD("get_current_tab"), &Tabs::get_current_tab); @@ -1034,5 +1033,5 @@ Tabs::Tabs() { drag_to_rearrange_enabled = false; tabs_rearrange_group = -1; - connect_compat("mouse_exited", this, "_on_mouse_exited"); + connect("mouse_exited", callable_mp(this, &Tabs::_on_mouse_exited)); } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 379e70b951..86002ed2c4 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7044,13 +7044,8 @@ PopupMenu *TextEdit::get_menu() const { void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &TextEdit::_gui_input); - ClassDB::bind_method(D_METHOD("_scroll_moved"), &TextEdit::_scroll_moved); ClassDB::bind_method(D_METHOD("_cursor_changed_emit"), &TextEdit::_cursor_changed_emit); ClassDB::bind_method(D_METHOD("_text_changed_emit"), &TextEdit::_text_changed_emit); - ClassDB::bind_method(D_METHOD("_push_current_op"), &TextEdit::_push_current_op); - ClassDB::bind_method(D_METHOD("_click_selection_held"), &TextEdit::_click_selection_held); - ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &TextEdit::_toggle_draw_caret); - ClassDB::bind_method(D_METHOD("_v_scroll_input"), &TextEdit::_v_scroll_input); ClassDB::bind_method(D_METHOD("_update_wrap_at"), &TextEdit::_update_wrap_at); BIND_ENUM_CONSTANT(SEARCH_MATCH_CASE); @@ -7272,10 +7267,10 @@ TextEdit::TextEdit() { updating_scrolls = false; selection.active = false; - h_scroll->connect_compat("value_changed", this, "_scroll_moved"); - v_scroll->connect_compat("value_changed", this, "_scroll_moved"); + h_scroll->connect("value_changed", callable_mp(this, &TextEdit::_scroll_moved)); + v_scroll->connect("value_changed", callable_mp(this, &TextEdit::_scroll_moved)); - v_scroll->connect_compat("scrolling", this, "_v_scroll_input"); + v_scroll->connect("scrolling", callable_mp(this, &TextEdit::_v_scroll_input)); cursor_changed_dirty = false; text_changed_dirty = false; @@ -7292,7 +7287,7 @@ TextEdit::TextEdit() { caret_blink_timer = memnew(Timer); add_child(caret_blink_timer); caret_blink_timer->set_wait_time(0.65); - caret_blink_timer->connect_compat("timeout", this, "_toggle_draw_caret"); + caret_blink_timer->connect("timeout", callable_mp(this, &TextEdit::_toggle_draw_caret)); cursor_set_blink_enabled(false); right_click_moves_caret = true; @@ -7300,12 +7295,12 @@ TextEdit::TextEdit() { add_child(idle_detect); idle_detect->set_one_shot(true); idle_detect->set_wait_time(GLOBAL_GET("gui/timers/text_edit_idle_detect_sec")); - idle_detect->connect_compat("timeout", this, "_push_current_op"); + idle_detect->connect("timeout", callable_mp(this, &TextEdit::_push_current_op)); click_select_held = memnew(Timer); add_child(click_select_held); click_select_held->set_wait_time(0.05); - click_select_held->connect_compat("timeout", this, "_click_selection_held"); + click_select_held->connect("timeout", callable_mp(this, &TextEdit::_click_selection_held)); current_op.type = TextOperation::TYPE_NONE; undo_enabled = true; @@ -7364,7 +7359,7 @@ TextEdit::TextEdit() { add_child(menu); readonly = true; // Initialise to opposite first, so we get past the early-out in set_readonly. set_readonly(false); - menu->connect_compat("id_pressed", this, "menu_option"); + menu->connect("id_pressed", callable_mp(this, &TextEdit::menu_option)); first_draw = true; executing_line = -1; diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 87442f32e8..6dafd3bf4f 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -127,7 +127,6 @@ void TextureRect::_bind_methods() { ClassDB::bind_method(D_METHOD("is_flipped_v"), &TextureRect::is_flipped_v); ClassDB::bind_method(D_METHOD("set_stretch_mode", "stretch_mode"), &TextureRect::set_stretch_mode); ClassDB::bind_method(D_METHOD("get_stretch_mode"), &TextureRect::get_stretch_mode); - ClassDB::bind_method(D_METHOD("_texture_changed"), &TextureRect::_texture_changed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand"), "set_expand", "has_expand"); @@ -160,13 +159,13 @@ void TextureRect::set_texture(const Ref<Texture2D> &p_tex) { } if (texture.is_valid()) { - texture->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &TextureRect::_texture_changed)); } texture = p_tex; if (texture.is_valid()) { - texture->connect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &TextureRect::_texture_changed)); } update(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 940692ebd7..3461eef327 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3914,13 +3914,7 @@ bool Tree::get_allow_reselect() const { void Tree::_bind_methods() { - ClassDB::bind_method(D_METHOD("_range_click_timeout"), &Tree::_range_click_timeout); ClassDB::bind_method(D_METHOD("_gui_input"), &Tree::_gui_input); - ClassDB::bind_method(D_METHOD("_popup_select"), &Tree::popup_select); - ClassDB::bind_method(D_METHOD("_text_editor_enter"), &Tree::text_editor_enter); - ClassDB::bind_method(D_METHOD("_text_editor_modal_close"), &Tree::_text_editor_modal_close); - ClassDB::bind_method(D_METHOD("_value_editor_changed"), &Tree::value_editor_changed); - ClassDB::bind_method(D_METHOD("_scroll_moved"), &Tree::_scroll_moved); ClassDB::bind_method(D_METHOD("clear"), &Tree::clear); ClassDB::bind_method(D_METHOD("create_item", "parent", "idx"), &Tree::_create_item, DEFVAL(Variant()), DEFVAL(-1)); @@ -4043,15 +4037,15 @@ Tree::Tree() { add_child(v_scroll); range_click_timer = memnew(Timer); - range_click_timer->connect_compat("timeout", this, "_range_click_timeout"); + range_click_timer->connect("timeout", callable_mp(this, &Tree::_range_click_timeout)); add_child(range_click_timer); - h_scroll->connect_compat("value_changed", this, "_scroll_moved"); - v_scroll->connect_compat("value_changed", this, "_scroll_moved"); - text_editor->connect_compat("text_entered", this, "_text_editor_enter"); - text_editor->connect_compat("modal_closed", this, "_text_editor_modal_close"); - popup_menu->connect_compat("id_pressed", this, "_popup_select"); - value_editor->connect_compat("value_changed", this, "_value_editor_changed"); + h_scroll->connect("value_changed", callable_mp(this, &Tree::_scroll_moved)); + v_scroll->connect("value_changed", callable_mp(this, &Tree::_scroll_moved)); + text_editor->connect("text_entered", callable_mp(this, &Tree::text_editor_enter)); + text_editor->connect("modal_closed", callable_mp(this, &Tree::_text_editor_modal_close)); + popup_menu->connect("id_pressed", callable_mp(this, &Tree::popup_select)); + value_editor->connect("value_changed", callable_mp(this, &Tree::value_editor_changed)); value_editor->set_as_toplevel(true); text_editor->set_as_toplevel(true); |