Make TabContainer use TabBar internally

This commit is contained in:
Michael Alexsander 2022-03-02 11:37:10 -03:00
parent cfd4433bbc
commit a811ebf699
19 changed files with 617 additions and 966 deletions

View file

@ -135,15 +135,15 @@ void ScriptEditorDebugger::debug_continue() {
void ScriptEditorDebugger::update_tabs() {
if (error_count == 0 && warning_count == 0) {
errors_tab->set_name(TTR("Errors"));
tabs->set_tab_icon(errors_tab->get_index(), Ref<Texture2D>());
tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), Ref<Texture2D>());
} else {
errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")");
if (error_count >= 1 && warning_count >= 1) {
tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
} else if (error_count >= 1) {
tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
} else {
tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
}
}
}
@ -1658,7 +1658,7 @@ bool ScriptEditorDebugger::has_capture(const StringName &p_name) {
ScriptEditorDebugger::ScriptEditorDebugger() {
tabs = memnew(TabContainer);
tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed));