1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 16:15:10 +00:00
serenity/Applications/Browser/WindowActions.cpp
Andreas Kling 1b8b492258 Browser: Add "next tab" and "previous tab" actions
Now you can switch between the open tabs with Ctrl+PgUp and Ctrl+PgDn
2020-04-23 21:43:24 +02:00

40 lines
900 B
C++

#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);
m_next_tab_action = GUI::Action::create(
"Next tab", { Mod_Ctrl, Key_PageDown }, [this](auto&) {
if (on_next_tab)
on_next_tab();
},
&window);
m_previous_tab_action = GUI::Action::create(
"Previous tab", { Mod_Ctrl, Key_PageUp }, [this](auto&) {
if (on_previous_tab)
on_previous_tab();
},
&window);
}
}