mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
Browser: Add "New tab" action (Ctrl+T) :^)
This also introduces a WindowActions collection of actions that are not specific to the currently open tab, but nevertheless part of its menus.
This commit is contained in:
parent
4e8b6e48fd
commit
476a4475e5
5 changed files with 62 additions and 1 deletions
26
Applications/Browser/WindowActions.cpp
Normal file
26
Applications/Browser/WindowActions.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "WindowActions.h"
|
||||
#include <LibGUI/Window.h>
|
||||
|
||||
namespace Browser {
|
||||
|
||||
static WindowActions* s_the;
|
||||
|
||||
WindowActions& WindowActions::the()
|
||||
{
|
||||
ASSERT(s_the);
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
WindowActions::WindowActions(GUI::Window& window)
|
||||
{
|
||||
ASSERT(!s_the);
|
||||
s_the = this;
|
||||
m_create_new_tab_action = GUI::Action::create(
|
||||
"New tab", { Mod_Ctrl, Key_T }, [this](auto&) {
|
||||
if (on_create_new_tab)
|
||||
on_create_new_tab();
|
||||
},
|
||||
&window);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue