rudimentary chat

This commit is contained in:
ouwou
2020-08-20 03:19:16 -04:00
parent 4b903bbd3e
commit a201d5905a
14 changed files with 426 additions and 7 deletions

33
components/chatwindow.hpp Normal file
View File

@@ -0,0 +1,33 @@
#pragma once
#include <gtkmm.h>
#include <queue>
#include <mutex>
#include "../discord/discord.hpp"
class ChatWindow {
public:
ChatWindow();
Gtk::Widget *GetRoot() const;
void SetActiveChannel(Snowflake id);
Snowflake GetActiveChannel() const;
void SetMessages(std::unordered_set<const MessageData *> msgs);
protected:
void ScrollToBottom();
void SetMessagesInternal();
Gtk::ListBoxRow *CreateChatEntryComponentText(const MessageData *data);
Gtk::ListBoxRow *CreateChatEntryComponent(const MessageData *data);
Glib::Dispatcher m_update_dispatcher;
std::queue<std::unordered_set<const MessageData *>> m_update_queue;
std::mutex m_update_mutex;
Snowflake m_active_channel;
Gtk::Box *m_main;
Gtk::ListBox *m_listbox;
Gtk::Viewport *m_viewport;
Gtk::ScrolledWindow *m_scroll;
Gtk::ScrolledWindow *m_entry_scroll;
Gtk::TextView *m_input;
};