From 5b806a25894bf183515c64ac8099911da8f4a0c7 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 8 Apr 2022 23:47:12 -0400 Subject: basic tabs system --- src/components/channeltabswitcherhandy.hpp | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/components/channeltabswitcherhandy.hpp (limited to 'src/components/channeltabswitcherhandy.hpp') diff --git a/src/components/channeltabswitcherhandy.hpp b/src/components/channeltabswitcherhandy.hpp new file mode 100644 index 0000000..53e1624 --- /dev/null +++ b/src/components/channeltabswitcherhandy.hpp @@ -0,0 +1,37 @@ +#pragma once +// perhaps this should be conditionally included within cmakelists? +#ifdef WITH_LIBHANDY + #include + #include + #include + #include "discord/snowflake.hpp" + +// thin wrapper over c api +// HdyTabBar + invisible HdyTabView since it needs one +class ChannelTabSwitcherHandy : public Gtk::Box { +public: + ChannelTabSwitcherHandy(); + + void AddChannelTab(Snowflake id); + void ReplaceActiveTab(Snowflake id); + +private: + HdyTabBar *m_tab_bar; + Gtk::Widget *m_tab_bar_wrapped; + HdyTabView *m_tab_view; + Gtk::Widget *m_tab_view_wrapped; + + std::unordered_map m_pages; + std::unordered_map m_pages_rev; + + friend void selected_page_notify_cb(HdyTabView *, GParamSpec *, ChannelTabSwitcherHandy *); + +public: + using type_signal_channel_switched_to = sigc::signal; + + type_signal_channel_switched_to signal_channel_switched_to(); + +private: + type_signal_channel_switched_to m_signal_channel_switched_to; +}; +#endif -- cgit v1.2.3