add ctrl+number key shortcuts for tabs

This commit is contained in:
ouwou
2022-05-10 01:09:42 -04:00
parent bbf32730cd
commit 1d8ef79da6
7 changed files with 30 additions and 0 deletions

View File

@@ -131,6 +131,11 @@ void ChannelTabSwitcherHandy::GoToNextTab() {
}
}
void ChannelTabSwitcherHandy::GoToTab(int idx) {
if (hdy_tab_view_get_n_pages(m_tab_view) >= idx + 1)
hdy_tab_view_set_selected_page(m_tab_view, hdy_tab_view_get_nth_page(m_tab_view, idx));
}
int ChannelTabSwitcherHandy::GetNumberOfTabs() const {
return hdy_tab_view_get_n_pages(m_tab_view);
}

View File

@@ -26,6 +26,7 @@ public:
void GoForwardOnCurrent();
void GoToPreviousTab();
void GoToNextTab();
void GoToTab(int idx);
[[nodiscard]] int GetNumberOfTabs() const;

View File

@@ -200,6 +200,10 @@ void ChatWindow::GoToPreviousTab() {
void ChatWindow::GoToNextTab() {
m_tab_switcher->GoToNextTab();
}
void ChatWindow::GoToTab(int idx) {
m_tab_switcher->GoToTab(idx);
}
#endif
Snowflake ChatWindow::GetActiveChannel() const {

View File

@@ -43,6 +43,7 @@ public:
void GoForward();
void GoToPreviousTab();
void GoToNextTab();
void GoToTab(int idx);
#endif
protected: