summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-30 09:04:03 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-30 09:04:39 +0200
commitf2cdef5c47ee08ebad7b7282b8638ae8e23e1d72 (patch)
treebd3e53ec5cfc1d26ca4fa931d38e54c1f9e50d34 /Libraries
parenta9f6f862e21161cf965c9fe15ae221b239c5d107 (diff)
downloadserenity-f2cdef5c47ee08ebad7b7282b8638ae8e23e1d72.zip
LibGUI: Cycle through TabWidget tabs with Ctrl+Tab / Ctrl+Shift+Tab
Fixes #2022.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/TabWidget.cpp13
-rw-r--r--Libraries/LibGUI/TabWidget.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/Libraries/LibGUI/TabWidget.cpp b/Libraries/LibGUI/TabWidget.cpp
index 721c74af86..db27d21484 100644
--- a/Libraries/LibGUI/TabWidget.cpp
+++ b/Libraries/LibGUI/TabWidget.cpp
@@ -332,4 +332,17 @@ void TabWidget::activate_previous_tab()
set_active_widget(m_tabs.at(index).widget);
}
+void TabWidget::keydown_event(KeyEvent & event)
+{
+ if (event.ctrl() && event.key() == Key_Tab) {
+ if (event.shift())
+ activate_previous_tab();
+ else
+ activate_next_tab();
+ event.accept();
+ return;
+ }
+ Widget::keydown_event(event);
+}
+
}
diff --git a/Libraries/LibGUI/TabWidget.h b/Libraries/LibGUI/TabWidget.h
index 85035a95b7..a5757a2285 100644
--- a/Libraries/LibGUI/TabWidget.h
+++ b/Libraries/LibGUI/TabWidget.h
@@ -90,6 +90,7 @@ protected:
virtual void mousedown_event(MouseEvent&) override;
virtual void mousemove_event(MouseEvent&) override;
virtual void leave_event(Core::Event&) override;
+ virtual void keydown_event(KeyEvent&) override;
private:
Gfx::Rect child_rect_for_size(const Gfx::Size&) const;