summaryrefslogtreecommitdiff
path: root/editor/editor_help_search.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_help_search.cpp')
-rw-r--r--editor/editor_help_search.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index f7ce2dd4fc..01a50cad2c 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -37,13 +37,13 @@
void EditorHelpSearch::_update_icons() {
- search_box->set_right_icon(get_icon("Search", "EditorIcons"));
+ search_box->set_right_icon(results_tree->get_theme_icon("Search", "EditorIcons"));
search_box->set_clear_button_enabled(true);
- search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
- case_sensitive_button->set_icon(get_icon("MatchCase", "EditorIcons"));
- hierarchy_button->set_icon(get_icon("ClassList", "EditorIcons"));
+ search_box->add_theme_icon_override("right_icon", results_tree->get_theme_icon("Search", "EditorIcons"));
+ case_sensitive_button->set_icon(results_tree->get_theme_icon("MatchCase", "EditorIcons"));
+ hierarchy_button->set_icon(results_tree->get_theme_icon("ClassList", "EditorIcons"));
- if (is_visible_in_tree())
+ if (is_visible())
_update_results();
}
@@ -57,7 +57,7 @@ void EditorHelpSearch::_update_results() {
if (hierarchy_button->is_pressed())
search_flags |= SEARCH_SHOW_HIERARCHY;
- search = Ref<Runner>(memnew(Runner(this, results_tree, term, search_flags)));
+ search = Ref<Runner>(memnew(Runner(results_tree, results_tree, term, search_flags)));
set_process(true);
}
@@ -105,6 +105,13 @@ void EditorHelpSearch::_confirmed() {
void EditorHelpSearch::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (!is_visible()) {
+ results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
+ get_ok()->set_disabled(true);
+ EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size()));
+ }
+ } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_icons();
@@ -114,12 +121,7 @@ void EditorHelpSearch::_notification(int p_what) {
connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed));
_update_icons();
} break;
- case NOTIFICATION_POPUP_HIDE: {
- results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
- get_ok()->set_disabled(true);
- EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
- } break;
case NOTIFICATION_PROCESS: {
// Update background search.
@@ -184,7 +186,7 @@ EditorHelpSearch::EditorHelpSearch() {
old_search = false;
set_hide_on_ok(false);
- set_resizable(true);
+
set_title(TTR("Search Help"));
get_ok()->set_disabled(true);
@@ -200,7 +202,7 @@ EditorHelpSearch::EditorHelpSearch() {
search_box = memnew(LineEdit);
search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
- search_box->set_h_size_flags(SIZE_EXPAND_FILL);
+ search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search_box->connect("gui_input", callable_mp(this, &EditorHelpSearch::_search_box_gui_input));
search_box->connect("text_changed", callable_mp(this, &EditorHelpSearch::_search_box_text_changed));
register_text_enter(search_box);
@@ -210,7 +212,7 @@ EditorHelpSearch::EditorHelpSearch() {
case_sensitive_button->set_tooltip(TTR("Case Sensitive"));
case_sensitive_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results));
case_sensitive_button->set_toggle_mode(true);
- case_sensitive_button->set_focus_mode(FOCUS_NONE);
+ case_sensitive_button->set_focus_mode(Control::FOCUS_NONE);
hbox->add_child(case_sensitive_button);
hierarchy_button = memnew(ToolButton);
@@ -218,7 +220,7 @@ EditorHelpSearch::EditorHelpSearch() {
hierarchy_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results));
hierarchy_button->set_toggle_mode(true);
hierarchy_button->set_pressed(true);
- hierarchy_button->set_focus_mode(FOCUS_NONE);
+ hierarchy_button->set_focus_mode(Control::FOCUS_NONE);
hbox->add_child(hierarchy_button);
filter_combo = memnew(OptionButton);
@@ -237,7 +239,7 @@ EditorHelpSearch::EditorHelpSearch() {
// Create the results tree.
results_tree = memnew(Tree);
- results_tree->set_v_size_flags(SIZE_EXPAND_FILL);
+ results_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
results_tree->set_columns(2);
results_tree->set_column_title(0, TTR("Name"));
results_tree->set_column_title(1, TTR("Member Type"));
@@ -315,7 +317,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() {
iterator_doc = EditorHelp::get_doc_data()->class_list.front();
matches.clear();
- matched_item = NULL;
+ matched_item = nullptr;
return true;
}
@@ -479,10 +481,10 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_
TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const DocData::ClassDoc *p_doc, bool p_gray) {
Ref<Texture2D> icon = empty_icon;
- if (ui_service->has_icon(p_doc->name, "EditorIcons"))
- icon = ui_service->get_icon(p_doc->name, "EditorIcons");
+ if (ui_service->has_theme_icon(p_doc->name, "EditorIcons"))
+ icon = ui_service->get_theme_icon(p_doc->name, "EditorIcons");
else if (ClassDB::class_exists(p_doc->name) && ClassDB::is_parent_class(p_doc->name, "Object"))
- icon = ui_service->get_icon("Object", "EditorIcons");
+ icon = ui_service->get_theme_icon("Object", "EditorIcons");
String tooltip = p_doc->brief_description.strip_edges();
TreeItem *item = results_tree->create_item(p_parent);
@@ -557,10 +559,10 @@ TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, cons
Ref<Texture2D> icon;
String text;
if (search_flags & SEARCH_SHOW_HIERARCHY) {
- icon = ui_service->get_icon(p_icon, "EditorIcons");
+ icon = ui_service->get_theme_icon(p_icon, "EditorIcons");
text = p_name;
} else {
- icon = ui_service->get_icon(p_icon, "EditorIcons");
+ icon = ui_service->get_theme_icon(p_icon, "EditorIcons");
/*// In flat mode, show the class icon.
if (ui_service->has_icon(p_class_name, "EditorIcons"))
icon = ui_service->get_icon(p_class_name, "EditorIcons");
@@ -598,6 +600,6 @@ EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree,
results_tree(p_results_tree),
term((p_search_flags & SEARCH_CASE_SENSITIVE) == 0 ? p_term.strip_edges().to_lower() : p_term.strip_edges()),
search_flags(p_search_flags),
- empty_icon(ui_service->get_icon("ArrowRight", "EditorIcons")),
- disabled_color(ui_service->get_color("disabled_font_color", "Editor")) {
+ empty_icon(ui_service->get_theme_icon("ArrowRight", "EditorIcons")),
+ disabled_color(ui_service->get_theme_color("disabled_font_color", "Editor")) {
}