From bbf32730cd322ab8d826b9fb73d83fbde73c5419 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 9 May 2022 01:33:09 -0400 Subject: add ctrl(+shift)+tab keybinds --- src/components/channeltabswitcherhandy.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/components/channeltabswitcherhandy.cpp') diff --git a/src/components/channeltabswitcherhandy.cpp b/src/components/channeltabswitcherhandy.cpp index 67dbff0..2faa2e2 100644 --- a/src/components/channeltabswitcherhandy.cpp +++ b/src/components/channeltabswitcherhandy.cpp @@ -115,6 +115,22 @@ void ChannelTabSwitcherHandy::GoForwardOnCurrent() { AdvanceOnCurrent(1); } +void ChannelTabSwitcherHandy::GoToPreviousTab() { + if (!hdy_tab_view_select_previous_page(m_tab_view)) { + if (const auto num_pages = hdy_tab_view_get_n_pages(m_tab_view); num_pages > 1) { + hdy_tab_view_set_selected_page(m_tab_view, hdy_tab_view_get_nth_page(m_tab_view, num_pages - 1)); + } + } +} + +void ChannelTabSwitcherHandy::GoToNextTab() { + if (!hdy_tab_view_select_next_page(m_tab_view)) { + if (hdy_tab_view_get_n_pages(m_tab_view) > 1) { + hdy_tab_view_set_selected_page(m_tab_view, hdy_tab_view_get_nth_page(m_tab_view, 0)); + } + } +} + int ChannelTabSwitcherHandy::GetNumberOfTabs() const { return hdy_tab_view_get_n_pages(m_tab_view); } -- cgit v1.2.3