mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:57:44 +00:00
LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
parent
2d39da5405
commit
c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions
|
@ -46,27 +46,27 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
GApplication app(argc, argv);
|
||||
GUI::Application app(argc, argv);
|
||||
|
||||
if (pledge("stdio shared_buffer accept rpath wpath cpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto window = GWindow::construct();
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("PaintBrush");
|
||||
window->set_rect(100, 100, 640, 480);
|
||||
window->set_icon(load_png("/res/icons/16x16/app-paintbrush.png"));
|
||||
|
||||
auto horizontal_container = GWidget::construct();
|
||||
auto horizontal_container = GUI::Widget::construct();
|
||||
window->set_main_widget(horizontal_container);
|
||||
horizontal_container->set_layout(make<GHBoxLayout>());
|
||||
horizontal_container->set_layout(make<GUI::HBoxLayout>());
|
||||
horizontal_container->layout()->set_spacing(0);
|
||||
|
||||
new ToolboxWidget(horizontal_container);
|
||||
|
||||
auto vertical_container = GWidget::construct(horizontal_container.ptr());
|
||||
vertical_container->set_layout(make<GVBoxLayout>());
|
||||
auto vertical_container = GUI::Widget::construct(horizontal_container.ptr());
|
||||
vertical_container->set_layout(make<GUI::VBoxLayout>());
|
||||
vertical_container->layout()->set_spacing(0);
|
||||
|
||||
auto paintable_widget = PaintableWidget::construct(vertical_container);
|
||||
|
@ -75,36 +75,36 @@ int main(int argc, char** argv)
|
|||
|
||||
window->show();
|
||||
|
||||
auto menubar = make<GMenuBar>();
|
||||
auto app_menu = GMenu::construct("PaintBrush");
|
||||
auto menubar = make<GUI::MenuBar>();
|
||||
auto app_menu = GUI::Menu::construct("PaintBrush");
|
||||
|
||||
app_menu->add_action(GCommonActions::make_open_action([&](auto&) {
|
||||
Optional<String> open_path = GFilePicker::get_open_filepath();
|
||||
app_menu->add_action(GUI::CommonActions::make_open_action([&](auto&) {
|
||||
Optional<String> open_path = GUI::FilePicker::get_open_filepath();
|
||||
|
||||
if (!open_path.has_value())
|
||||
return;
|
||||
|
||||
auto bitmap = load_png(open_path.value());
|
||||
if (!bitmap) {
|
||||
GMessageBox::show(String::format("Failed to load '%s'", open_path.value().characters()), "Open failed", GMessageBox::Type::Error, GMessageBox::InputType::OK, window);
|
||||
GUI::MessageBox::show(String::format("Failed to load '%s'", open_path.value().characters()), "Open failed", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window);
|
||||
return;
|
||||
}
|
||||
paintable_widget->set_bitmap(*bitmap);
|
||||
}));
|
||||
app_menu->add_separator();
|
||||
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
|
||||
GApplication::the().quit(0);
|
||||
app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||
GUI::Application::the().quit(0);
|
||||
return;
|
||||
}));
|
||||
|
||||
menubar->add_menu(move(app_menu));
|
||||
|
||||
auto edit_menu = GMenu::construct("Edit");
|
||||
auto edit_menu = GUI::Menu::construct("Edit");
|
||||
menubar->add_menu(move(edit_menu));
|
||||
|
||||
auto help_menu = GMenu::construct("Help");
|
||||
help_menu->add_action(GAction::create("About", [&](auto&) {
|
||||
GAboutDialog::show("PaintBrush", load_png("/res/icons/32x32/app-paintbrush.png"), window);
|
||||
auto help_menu = GUI::Menu::construct("Help");
|
||||
help_menu->add_action(GUI::Action::create("About", [&](auto&) {
|
||||
GUI::AboutDialog::show("PaintBrush", load_png("/res/icons/32x32/app-paintbrush.png"), window);
|
||||
}));
|
||||
menubar->add_menu(move(help_menu));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue