1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

Userland: Add GUI::Window::add_menu() and use it everywhere

Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
This commit is contained in:
Andreas Kling 2021-07-21 21:21:03 +02:00
parent a4fdb7f029
commit 687a12d7fb
58 changed files with 187 additions and 311 deletions

View file

@ -66,9 +66,7 @@ int main(int argc, char** argv)
s_window->set_title(String::formatted("{} - Hack Studio", s_hack_studio_widget->project().name()));
auto menubar = GUI::Menubar::construct();
s_hack_studio_widget->initialize_menubar(menubar);
s_window->set_menubar(menubar);
s_hack_studio_widget->initialize_menubar(*s_window);
s_window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
s_hack_studio_widget->locator().close();