summaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2021-09-14 12:17:47 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2021-09-15 11:35:03 +0300
commit1dda47c28027dfd0818553f2c79d0db12dfc6f31 (patch)
treef7fe95e1ac0f2495c20322c29495f57f1e8c0ae3 /editor/editor_help.cpp
parent3705ad7d8fa00e3992f09359c7f008cdeaa5f56c (diff)
Added status bar and toggle scripts panel button to EditorHelp/VScripts
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 490c8f287f..976e64590c 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;