1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:47:46 +00:00

LibVT: Add a context menu to TerminalWidget

Starting with only the copy and paste actions. But I'm sure we can come
up with some more things to put here. :^)
This commit is contained in:
Andreas Kling 2019-11-20 21:39:26 +01:00
parent dbf8d6bc1e
commit dabdd484f7
2 changed files with 14 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GClipboard.h>
#include <LibGUI/GMenu.h>
#include <LibGUI/GPainter.h>
#include <LibGUI/GScrollBar.h>
#include <LibGUI/GWindow.h>
@ -654,3 +655,13 @@ void TerminalWidget::beep()
};
force_repaint();
}
void TerminalWidget::context_menu_event(GContextMenuEvent& event)
{
if (!m_context_menu) {
m_context_menu = make<GMenu>();
m_context_menu->add_action(copy_action());
m_context_menu->add_action(paste_action());
}
m_context_menu->popup(event.screen_position());
}