1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:17:35 +00:00

Userspace: Use Core::Object::add() when building interfaces

This commit is contained in:
Andreas Kling 2020-02-23 10:57:42 +01:00
parent 7ec758773c
commit 3d20da9ee4
87 changed files with 403 additions and 438 deletions

View file

@ -39,8 +39,8 @@ InspectorWidget::InspectorWidget(GUI::Widget* parent)
: GUI::Widget(parent)
{
set_layout(make<GUI::VerticalBoxLayout>());
auto splitter = GUI::VerticalSplitter::construct(this);
m_dom_tree_view = GUI::TreeView::construct(splitter);
auto splitter = add<GUI::VerticalSplitter>();
m_dom_tree_view = splitter->add<GUI::TreeView>();
m_dom_tree_view->on_selection = [this](auto& index) {
auto* node = static_cast<Node*>(index.internal_data());
node->document().set_inspected_node(node);
@ -55,13 +55,13 @@ InspectorWidget::InspectorWidget(GUI::Widget* parent)
m_computed_style_table_view->set_model(nullptr);
}
};
m_style_table_view = GUI::TableView::construct(nullptr);
m_style_table_view = GUI::TableView::construct();
m_style_table_view->set_size_columns_to_fit_content(true);
m_computed_style_table_view = GUI::TableView::construct(nullptr);
m_computed_style_table_view = GUI::TableView::construct();
m_computed_style_table_view->set_size_columns_to_fit_content(true);
auto tabwidget = GUI::TabWidget::construct(splitter);
auto tabwidget = splitter->add<GUI::TabWidget>();
tabwidget->add_widget("Styles", m_style_table_view);
tabwidget->add_widget("Computed", m_computed_style_table_view);
}

View file

@ -80,8 +80,8 @@ int main(int argc, char** argv)
widget->set_layout(make<GUI::VerticalBoxLayout>());
widget->layout()->set_spacing(0);
auto toolbar = GUI::ToolBar::construct(widget);
auto html_widget = HtmlView::construct(widget);
auto toolbar = widget->add<GUI::ToolBar>();
auto html_widget = widget->add<HtmlView>();
History<URL> history;
@ -121,7 +121,7 @@ int main(int argc, char** argv)
html_widget->reload();
}));
auto location_box = GUI::TextBox::construct(toolbar);
auto location_box = toolbar->add<GUI::TextBox>();
location_box->on_return_pressed = [&] {
html_widget->load(location_box->text());
@ -151,7 +151,7 @@ int main(int argc, char** argv)
location_box->set_focus(true);
});
auto statusbar = GUI::StatusBar::construct(widget);
auto statusbar = widget->add<GUI::StatusBar>();
html_widget->on_link_hover = [&](auto& href) {
statusbar->set_text(href);