summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/channeltabswitcherhandy.cpp5
-rw-r--r--src/components/channeltabswitcherhandy.hpp1
-rw-r--r--src/components/chatwindow.cpp4
-rw-r--r--src/components/chatwindow.hpp1
4 files changed, 11 insertions, 0 deletions
diff --git a/src/components/channeltabswitcherhandy.cpp b/src/components/channeltabswitcherhandy.cpp
index 2faa2e2..7488d6f 100644
--- a/src/components/channeltabswitcherhandy.cpp
+++ b/src/components/channeltabswitcherhandy.cpp
@@ -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);
}
diff --git a/src/components/channeltabswitcherhandy.hpp b/src/components/channeltabswitcherhandy.hpp
index a0149be..272cad0 100644
--- a/src/components/channeltabswitcherhandy.hpp
+++ b/src/components/channeltabswitcherhandy.hpp
@@ -26,6 +26,7 @@ public:
void GoForwardOnCurrent();
void GoToPreviousTab();
void GoToNextTab();
+ void GoToTab(int idx);
[[nodiscard]] int GetNumberOfTabs() const;
diff --git a/src/components/chatwindow.cpp b/src/components/chatwindow.cpp
index 3cfde1b..5aab4e6 100644
--- a/src/components/chatwindow.cpp
+++ b/src/components/chatwindow.cpp
@@ -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 {
diff --git a/src/components/chatwindow.hpp b/src/components/chatwindow.hpp
index 36bce6a..9b27ff1 100644
--- a/src/components/chatwindow.hpp
+++ b/src/components/chatwindow.hpp
@@ -43,6 +43,7 @@ public:
void GoForward();
void GoToPreviousTab();
void GoToNextTab();
+ void GoToTab(int idx);
#endif
protected: