mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:57:44 +00:00
Userspace: Use Core::Object::add() when building interfaces
This commit is contained in:
parent
7ec758773c
commit
3d20da9ee4
87 changed files with 403 additions and 438 deletions
|
@ -122,19 +122,19 @@ void DisplayPropertiesWidget::create_wallpaper_list()
|
|||
|
||||
void DisplayPropertiesWidget::create_frame()
|
||||
{
|
||||
auto tab_widget = GUI::TabWidget::construct(m_root_widget);
|
||||
auto tab_widget = m_root_widget->add<GUI::TabWidget>();
|
||||
|
||||
// First, let's create the "Background" tab
|
||||
auto background_splitter = GUI::VerticalSplitter::construct(nullptr);
|
||||
auto background_splitter = GUI::VerticalSplitter::construct();
|
||||
tab_widget->add_widget("Wallpaper", background_splitter);
|
||||
|
||||
auto background_content = GUI::Widget::construct(background_splitter.ptr());
|
||||
auto background_content = background_splitter->add<GUI::Widget>();
|
||||
background_content->set_layout(make<GUI::VerticalBoxLayout>());
|
||||
background_content->layout()->set_margins({ 4, 4, 4, 4 });
|
||||
|
||||
m_wallpaper_preview = GUI::Label::construct(background_splitter);
|
||||
m_wallpaper_preview = background_splitter->add<GUI::Label>();
|
||||
|
||||
auto wallpaper_list = GUI::ListView::construct(background_content);
|
||||
auto wallpaper_list = background_content->add<GUI::ListView>();
|
||||
wallpaper_list->set_background_color(Color::White);
|
||||
wallpaper_list->set_model(*ItemListModel<AK::String>::create(m_wallpapers));
|
||||
|
||||
|
@ -155,14 +155,14 @@ void DisplayPropertiesWidget::create_frame()
|
|||
};
|
||||
|
||||
// Let's add the settings tab
|
||||
auto settings_splitter = GUI::VerticalSplitter::construct(nullptr);
|
||||
auto settings_splitter = GUI::VerticalSplitter::construct();
|
||||
tab_widget->add_widget("Settings", settings_splitter);
|
||||
|
||||
auto settings_content = GUI::Widget::construct(settings_splitter.ptr());
|
||||
auto settings_content = settings_splitter->add<GUI::Widget>();
|
||||
settings_content->set_layout(make<GUI::VerticalBoxLayout>());
|
||||
settings_content->layout()->set_margins({ 4, 4, 4, 4 });
|
||||
|
||||
auto resolution_list = GUI::ListView::construct(settings_content);
|
||||
auto resolution_list = settings_content->add<GUI::ListView>();
|
||||
resolution_list->set_background_color(Color::White);
|
||||
resolution_list->set_model(*ItemListModel<Gfx::Size>::create(m_resolutions));
|
||||
|
||||
|
@ -180,13 +180,13 @@ void DisplayPropertiesWidget::create_frame()
|
|||
settings_content->layout()->add_spacer();
|
||||
|
||||
// Add the apply and cancel buttons
|
||||
auto bottom_widget = GUI::Widget::construct(m_root_widget.ptr());
|
||||
auto bottom_widget = m_root_widget->add<GUI::Widget>();
|
||||
bottom_widget->set_layout(make<GUI::HorizontalBoxLayout>());
|
||||
bottom_widget->layout()->add_spacer();
|
||||
bottom_widget->set_size_policy(Orientation::Vertical, GUI::SizePolicy::Fixed);
|
||||
bottom_widget->set_preferred_size(1, 22);
|
||||
|
||||
auto apply_button = GUI::Button::construct(bottom_widget);
|
||||
auto apply_button = bottom_widget->add<GUI::Button>();
|
||||
apply_button->set_text("Apply");
|
||||
apply_button->set_size_policy(Orientation::Vertical, GUI::SizePolicy::Fixed);
|
||||
apply_button->set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed);
|
||||
|
@ -195,7 +195,7 @@ void DisplayPropertiesWidget::create_frame()
|
|||
send_settings_to_window_server(tab_widget->active_tab_index());
|
||||
};
|
||||
|
||||
auto ok_button = GUI::Button::construct(bottom_widget);
|
||||
auto ok_button = bottom_widget->add<GUI::Button>();
|
||||
ok_button->set_text("OK");
|
||||
ok_button->set_size_policy(Orientation::Vertical, GUI::SizePolicy::Fixed);
|
||||
ok_button->set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed);
|
||||
|
@ -205,7 +205,7 @@ void DisplayPropertiesWidget::create_frame()
|
|||
GUI::Application::the().quit();
|
||||
};
|
||||
|
||||
auto cancel_button = GUI::Button::construct(bottom_widget);
|
||||
auto cancel_button = bottom_widget->add<GUI::Button>();
|
||||
cancel_button->set_text("Cancel");
|
||||
cancel_button->set_size_policy(Orientation::Vertical, GUI::SizePolicy::Fixed);
|
||||
cancel_button->set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue