diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-04-08 23:47:12 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-04-08 23:47:12 -0400 |
commit | 5b806a25894bf183515c64ac8099911da8f4a0c7 (patch) | |
tree | 405f58152c12e1c3d25ebe5644cac6c45d0622cc /src/components/channeltabswitcherhandy.hpp | |
parent | 5a13c7fef71662ca5c829a80ef57d42741e23f3a (diff) | |
download | abaddon-portaudio-5b806a25894bf183515c64ac8099911da8f4a0c7.tar.gz abaddon-portaudio-5b806a25894bf183515c64ac8099911da8f4a0c7.zip |
basic tabs system
Diffstat (limited to 'src/components/channeltabswitcherhandy.hpp')
-rw-r--r-- | src/components/channeltabswitcherhandy.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
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 <gtkmm/box.h> + #include <unordered_map> + #include <handy.h> + #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<Snowflake, HdyTabPage *> m_pages; + std::unordered_map<HdyTabPage *, Snowflake> m_pages_rev; + + friend void selected_page_notify_cb(HdyTabView *, GParamSpec *, ChannelTabSwitcherHandy *); + +public: + using type_signal_channel_switched_to = sigc::signal<void, Snowflake>; + + type_signal_channel_switched_to signal_channel_switched_to(); + +private: + type_signal_channel_switched_to m_signal_channel_switched_to; +}; +#endif |