diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-11-20 21:39:26 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-11-20 21:47:12 +0100 |
commit | dabdd484f796054566c6369c936060ce8602436b (patch) | |
tree | 986c733d970795b9b738602d24a89e02bb893808 /Libraries/LibVT/TerminalWidget.cpp | |
parent | dbf8d6bc1eab19a57e9e6e7f81aa255505e971d4 (diff) | |
download | serenity-dabdd484f796054566c6369c936060ce8602436b.zip |
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. :^)
Diffstat (limited to 'Libraries/LibVT/TerminalWidget.cpp')
-rw-r--r-- | Libraries/LibVT/TerminalWidget.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp index e00142faff..e1f07f7459 100644 --- a/Libraries/LibVT/TerminalWidget.cpp +++ b/Libraries/LibVT/TerminalWidget.cpp @@ -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()); +} |