mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:32:45 +00:00 
			
		
		
		
	LibGUI: Add MenuBar::add_menu(name)
This allows us to construct menus in a more natural way:
    auto& file_menu = menubar->add_menu("File");
    file_menu.add_action(...);
Instead of the old way:
    auto file_menu = GUI::Menu::construct();
    file_menu->add_action(...);
    menubar->add_menu(file_menu);
			
			
This commit is contained in:
		
							parent
							
								
									faac43597a
								
							
						
					
					
						commit
						26eeaef0a8
					
				
					 26 changed files with 261 additions and 331 deletions
				
			
		|  | @ -76,18 +76,16 @@ int main(int argc, char** argv) | |||
| 
 | ||||
|     auto menubar = make<GUI::MenuBar>(); | ||||
| 
 | ||||
|     auto app_menu = GUI::Menu::construct("Font Editor"); | ||||
|     app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) { | ||||
|     auto& app_menu = menubar->add_menu("Font Editor"); | ||||
|     app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) { | ||||
|         GUI::Application::the().quit(0); | ||||
|         return; | ||||
|     })); | ||||
|     menubar->add_menu(move(app_menu)); | ||||
| 
 | ||||
|     auto help_menu = GUI::Menu::construct("Help"); | ||||
|     help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { | ||||
|     auto& help_menu = menubar->add_menu("Help"); | ||||
|     help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) { | ||||
|         GUI::AboutDialog::show("Font Editor", Gfx::Bitmap::load_from_file("/res/icons/FontEditor.png"), window); | ||||
|     })); | ||||
|     menubar->add_menu(move(help_menu)); | ||||
| 
 | ||||
|     app.set_menubar(move(menubar)); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling