diff options
Diffstat (limited to 'src/components/channeltabswitcherhandy.cpp')
-rw-r--r-- | src/components/channeltabswitcherhandy.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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); } |