add intermediate container for channel list

This commit is contained in:
ouwou 2023-10-24 21:55:26 -04:00
parent 201b114183
commit 8b034e48e2
4 changed files with 115 additions and 5 deletions

View File

@ -0,0 +1,50 @@
#include "channellist.hpp"
ChannelList::ChannelList() {
m_tree.show();
add(m_tree);
}
void ChannelList::UpdateListing() {
m_tree.UpdateListing();
}
void ChannelList::SetActiveChannel(Snowflake id, bool expand_to) {
m_tree.SetActiveChannel(id, expand_to);
}
void ChannelList::UseExpansionState(const ExpansionStateRoot &state) {
m_tree.UseExpansionState(state);
}
ExpansionStateRoot ChannelList::GetExpansionState() const {
m_tree.GetExpansionState();
}
void ChannelList::UsePanedHack(Gtk::Paned &paned) {
m_tree.UsePanedHack(paned);
}
ChannelList::type_signal_action_open_new_tab ChannelList::signal_action_open_new_tab() {
return m_signal_action_open_new_tab;
}
ChannelList::type_signal_action_join_voice_channel ChannelList::signal_action_join_voice_channel() {
return m_signal_action_join_voice_channel;
}
ChannelList::type_signal_action_disconnect_voice ChannelList::signal_action_disconnect_voice() {
return m_signal_action_disconnect_voice;
}
ChannelList::type_signal_action_channel_item_select ChannelList::signal_action_channel_item_select() {
return m_signal_action_channel_item_select;
}
ChannelList::type_signal_action_guild_leave ChannelList::signal_action_guild_leave() {
return m_signal_action_guild_leave;
}
ChannelList::type_signal_action_guild_settings ChannelList::signal_action_guild_settings() {
return m_signal_action_guild_settings;
}

View File

@ -0,0 +1,61 @@
#pragma once
#include <gtkmm/box.h>
#include <gtkmm/paned.h>
#include "channellisttree.hpp"
#include "discord/snowflake.hpp"
#include "state.hpp"
// Contains the actual ChannelListTree and the classic listing if enabled
class ChannelList : public Gtk::Box {
// have to proxy public and signals to underlying tree... ew!!!
public:
ChannelList();
void UpdateListing();
void SetActiveChannel(Snowflake id, bool expand_to);
// channel list should be populated when this is called
void UseExpansionState(const ExpansionStateRoot &state);
ExpansionStateRoot GetExpansionState() const;
void UsePanedHack(Gtk::Paned &paned);
private:
ChannelListTree m_tree;
public:
using type_signal_action_channel_item_select = sigc::signal<void, Snowflake>;
using type_signal_action_guild_leave = sigc::signal<void, Snowflake>;
using type_signal_action_guild_settings = sigc::signal<void, Snowflake>;
#ifdef WITH_LIBHANDY
using type_signal_action_open_new_tab = sigc::signal<void, Snowflake>;
type_signal_action_open_new_tab signal_action_open_new_tab();
#endif
#ifdef WITH_VOICE
using type_signal_action_join_voice_channel = sigc::signal<void, Snowflake>;
using type_signal_action_disconnect_voice = sigc::signal<void>;
type_signal_action_join_voice_channel signal_action_join_voice_channel();
type_signal_action_disconnect_voice signal_action_disconnect_voice();
#endif
type_signal_action_channel_item_select signal_action_channel_item_select();
type_signal_action_guild_leave signal_action_guild_leave();
type_signal_action_guild_settings signal_action_guild_settings();
private:
type_signal_action_channel_item_select m_signal_action_channel_item_select;
type_signal_action_guild_leave m_signal_action_guild_leave;
type_signal_action_guild_settings m_signal_action_guild_settings;
#ifdef WITH_LIBHANDY
type_signal_action_open_new_tab m_signal_action_open_new_tab;
#endif
#ifdef WITH_VOICE
type_signal_action_join_voice_channel m_signal_action_join_voice_channel;
type_signal_action_disconnect_voice m_signal_action_disconnect_voice;
#endif
};

View File

@ -1,5 +1,4 @@
#include "mainwindow.hpp"
#include "components/channellist/channellisttree.hpp"
MainWindow::MainWindow()
: m_main_box(Gtk::ORIENTATION_VERTICAL)
@ -235,7 +234,7 @@ void MainWindow::OnViewSubmenuPopup() {
}
}
ChannelListTree *MainWindow::GetChannelList() {
ChannelList *MainWindow::GetChannelList() {
return &m_channel_list;
}

View File

@ -1,5 +1,5 @@
#pragma once
#include "components/channellist/channellisttree.hpp"
#include "components/channellist/channellist.hpp"
#include "components/chatwindow.hpp"
#include "components/memberlist.hpp"
#include "components/friendslist.hpp"
@ -39,7 +39,7 @@ public:
void GoToTab(int idx);
#endif
ChannelListTree *GetChannelList();
ChannelList *GetChannelList();
ChatWindow *GetChatWindow();
MemberList *GetMemberList();
@ -54,7 +54,7 @@ private:
Gtk::Paned m_chan_content_paned;
Gtk::Paned m_content_members_paned;
ChannelListTree m_channel_list;
ChannelList m_channel_list;
ChatWindow m_chat;
MemberList m_members;
FriendsList m_friends;