mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
Browser: Pop up a context menu when one is requested on a tab
Currently, the tab's context menu only has options to reload and close, but this patch allows for those options to be quickly expanded!
This commit is contained in:
parent
bf2e6325a4
commit
9241c3a957
3 changed files with 21 additions and 0 deletions
|
@ -310,6 +310,14 @@ Tab::Tab()
|
|||
|
||||
auto& help_menu = m_menubar->add_menu("Help");
|
||||
help_menu.add_action(WindowActions::the().about_action());
|
||||
|
||||
m_tab_context_menu = GUI::Menu::construct();
|
||||
m_tab_context_menu->add_action(GUI::Action::create("Reload Tab", [this](auto&) {
|
||||
m_reload_action->activate();
|
||||
}));
|
||||
m_tab_context_menu->add_action(GUI::Action::create("Close Tab", [this](auto&) {
|
||||
on_tab_close_request(*this);
|
||||
}));
|
||||
}
|
||||
|
||||
Tab::~Tab()
|
||||
|
@ -369,4 +377,9 @@ void Tab::did_become_active()
|
|||
GUI::Application::the().set_menubar(m_menubar);
|
||||
}
|
||||
|
||||
void Tab::context_menu_requested(const Gfx::Point& screen_position)
|
||||
{
|
||||
m_tab_context_menu->popup(screen_position);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue