mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +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:
parent
a4fdb7f029
commit
687a12d7fb
58 changed files with 187 additions and 311 deletions
|
@ -1130,6 +1130,13 @@ Gfx::Bitmap* Window::back_bitmap()
|
|||
return m_back_store ? &m_back_store->bitmap() : nullptr;
|
||||
}
|
||||
|
||||
Menu& Window::add_menu(String name)
|
||||
{
|
||||
if (!m_menubar)
|
||||
set_menubar(GUI::Menubar::construct());
|
||||
return m_menubar->add_menu(move(name));
|
||||
}
|
||||
|
||||
void Window::set_menubar(RefPtr<Menubar> menubar)
|
||||
{
|
||||
if (m_menubar == menubar)
|
||||
|
|
|
@ -200,6 +200,7 @@ public:
|
|||
|
||||
void did_disable_focused_widget(Badge<Widget>);
|
||||
|
||||
Menu& add_menu(String name);
|
||||
void set_menubar(RefPtr<Menubar>);
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue