diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2021-11-07 17:26:15 +0000 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2022-01-19 17:26:22 +0000 |
commit | f43f68f605440795e39a66927b125d9f779d59f9 (patch) | |
tree | a386a81cc720c1bb4fadfaa613ffb565aad253fa /editor/plugins | |
parent | 2d1080e430e98078f7301c8160578f89202d72ee (diff) |
Convert TextEdit callbacks to Callable
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 2 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/text_editor.h | 2 |
6 files changed, 12 insertions, 9 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f1e5e7612b..468f5aeb18 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2347,7 +2347,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra // If we delete a script within the filesystem, the original resource path // is lost, so keep it as metadata to figure out the exact tab to delete. se->set_meta("_edit_res_path", p_resource->get_path()); - se->set_tooltip_request_func("_get_debug_tooltip", this); + se->set_tooltip_request_func(callable_mp(this, &ScriptEditor::_get_debug_tooltip)); if (se->get_edit_menu()) { se->get_edit_menu()->hide(); menu_hb->add_child(se->get_edit_menu()); @@ -3547,7 +3547,6 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_goto_script_line2", &ScriptEditor::_goto_script_line2); ClassDB::bind_method("_copy_script_path", &ScriptEditor::_copy_script_path); - ClassDB::bind_method("_get_debug_tooltip", &ScriptEditor::_get_debug_tooltip); ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections); ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open); ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index ca409e15ca..4093054b2c 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -165,7 +165,7 @@ public: virtual bool show_members_overview() = 0; - virtual void set_tooltip_request_func(String p_method, Object *p_obj) = 0; + virtual void set_tooltip_request_func(const Callable &p_toolip_callback) = 0; virtual Control *get_edit_menu() = 0; virtual void clear_edit_menu() = 0; virtual void set_find_replace_bar(FindReplaceBar *p_bar) = 0; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index ab094f4dc6..b765091d2b 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1375,8 +1375,10 @@ void ScriptTextEditor::clear_breakpoints() { code_editor->get_text_editor()->clear_breakpointed_lines(); } -void ScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj) { - code_editor->get_text_editor()->set_tooltip_request_func(p_obj, p_method, this); +void ScriptTextEditor::set_tooltip_request_func(const Callable &p_toolip_callback) { + Variant args[1] = { this }; + const Variant *argp[] = { &args[0] }; + code_editor->get_text_editor()->set_tooltip_request_func(p_toolip_callback.bind(argp, 1)); } void ScriptTextEditor::set_debugger_active(bool p_active) { diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 6e67444489..bc674ce964 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -233,7 +233,7 @@ public: virtual bool show_members_overview() override; - virtual void set_tooltip_request_func(String p_method, Object *p_obj) override; + virtual void set_tooltip_request_func(const Callable &p_toolip_callback) override; virtual void set_debugger_active(bool p_active) override; diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 12d13571f8..940f269803 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -272,8 +272,10 @@ void TextEditor::update_settings() { code_editor->update_editor_settings(); } -void TextEditor::set_tooltip_request_func(String p_method, Object *p_obj) { - code_editor->get_text_editor()->set_tooltip_request_func(p_obj, p_method, this); +void TextEditor::set_tooltip_request_func(const Callable &p_toolip_callback) { + Variant args[1] = { this }; + const Variant *argp[] = { &args[0] }; + code_editor->get_text_editor()->set_tooltip_request_func(p_toolip_callback.bind(argp, 1)); } Control *TextEditor::get_edit_menu() { diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index d3fb0c0a16..d03385d79e 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -135,7 +135,7 @@ public: virtual bool show_members_overview() override; virtual bool can_lose_focus_on_node_selection() override { return true; } virtual void set_debugger_active(bool p_active) override; - virtual void set_tooltip_request_func(String p_method, Object *p_obj) override; + virtual void set_tooltip_request_func(const Callable &p_toolip_callback) override; virtual void add_callback(const String &p_function, PackedStringArray p_args) override; void update_toggle_scripts_button() override; |