summaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 30319f61d1..fff9e5e908 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1612,6 +1612,11 @@ void EditorHelp::generate_doc() {
doc->merge_from(compdoc); //ensure all is up to date
}
+void EditorHelp::_toggle_scripts_pressed() {
+ ScriptEditor::get_singleton()->toggle_scripts_panel();
+ update_toggle_scripts_button();
+}
+
void EditorHelp::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY:
@@ -1622,7 +1627,11 @@ void EditorHelp::_notification(int p_what) {
if (is_inside_tree()) {
_class_desc_resized();
}
+ update_toggle_scripts_button();
} break;
+ case NOTIFICATION_VISIBILITY_CHANGED:
+ update_toggle_scripts_button();
+ break;
default:
break;
}
@@ -1676,6 +1685,15 @@ void EditorHelp::set_scroll(int p_scroll) {
class_desc->get_v_scroll()->set_value(p_scroll);
}
+void EditorHelp::update_toggle_scripts_button() {
+ if (is_layout_rtl()) {
+ toggle_scripts_button->set_icon(get_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Forward") : SNAME("Back"), SNAME("EditorIcons")));
+ } else {
+ toggle_scripts_button->set_icon(get_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Back") : SNAME("Forward"), SNAME("EditorIcons")));
+ }
+ toggle_scripts_button->set_tooltip(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text()));
+}
+
void EditorHelp::_bind_methods() {
ClassDB::bind_method("_class_list_select", &EditorHelp::_class_list_select);
ClassDB::bind_method("_request_help", &EditorHelp::_request_help);
@@ -1706,6 +1724,16 @@ EditorHelp::EditorHelp() {
find_bar->hide();
find_bar->set_rich_text_label(class_desc);
+ status_bar = memnew(HBoxContainer);
+ add_child(status_bar);
+ status_bar->set_h_size_flags(SIZE_EXPAND_FILL);
+ status_bar->set_custom_minimum_size(Size2(0, 24 * EDSCALE));
+
+ toggle_scripts_button = memnew(Button);
+ toggle_scripts_button->set_flat(true);
+ toggle_scripts_button->connect("pressed", callable_mp(this, &EditorHelp::_toggle_scripts_pressed));
+ status_bar->add_child(toggle_scripts_button);
+
class_desc->set_selection_enabled(true);
scroll_locked = false;