add ctrl(+shift)+tab keybinds

This commit is contained in:
ouwou
2022-05-09 01:33:09 -04:00
parent f58ca39e8c
commit bbf32730cd
7 changed files with 73 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -24,6 +24,8 @@ public:
void GoBackOnCurrent();
void GoForwardOnCurrent();
void GoToPreviousTab();
void GoToNextTab();
[[nodiscard]] int GetNumberOfTabs() const;

View File

@@ -192,6 +192,14 @@ void ChatWindow::GoBack() {
void ChatWindow::GoForward() {
m_tab_switcher->GoForwardOnCurrent();
}
void ChatWindow::GoToPreviousTab() {
m_tab_switcher->GoToPreviousTab();
}
void ChatWindow::GoToNextTab() {
m_tab_switcher->GoToNextTab();
}
#endif
Snowflake ChatWindow::GetActiveChannel() const {

View File

@@ -41,6 +41,8 @@ public:
void UseTabsState(const TabsState &state);
void GoBack();
void GoForward();
void GoToPreviousTab();
void GoToNextTab();
#endif
protected: