1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

HackStudio: Move editors inside tab widgets

This will move the editors inside a tab widget and the user
will be able to add new editors as tabs as well as add new
tab widgets. The user will be able to easily switch between
editors as well as the tab widgets.
This commit is contained in:
ry-sev 2022-03-07 19:30:21 -05:00 committed by Andreas Kling
parent da714f771d
commit 23643cf21b
5 changed files with 182 additions and 78 deletions

View file

@ -21,15 +21,7 @@ EditorWrapper::EditorWrapper()
{
set_layout<GUI::VerticalBoxLayout>();
auto& label_wrapper = add<GUI::Widget>();
label_wrapper.set_fixed_height(14);
label_wrapper.set_fill_with_background_color(true);
label_wrapper.set_layout<GUI::HorizontalBoxLayout>();
label_wrapper.layout()->set_margins({ 0, 2 });
m_filename_label = label_wrapper.add<GUI::Label>(untitled_label);
m_filename_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_filename_label->set_fixed_height(14);
m_filename_title = untitled_label;
// FIXME: Propagate errors instead of giving up
m_editor = MUST(try_add<Editor>());
@ -49,12 +41,6 @@ EditorWrapper::EditorWrapper()
};
}
void EditorWrapper::set_editor_has_focus(Badge<Editor>, bool focus)
{
auto& font = Gfx::FontDatabase::default_font();
m_filename_label->set_font(focus ? font.bold_variant() : font);
}
LanguageClient& EditorWrapper::language_client() { return m_editor->language_client(); }
void EditorWrapper::set_mode_displayable()
@ -121,7 +107,7 @@ void EditorWrapper::update_title()
if (editor().document().is_modified())
title.append(" (*)");
m_filename_label->set_text(title.to_string());
m_filename_title = title.to_string();
}
void EditorWrapper::set_debug_mode(bool enabled)