aboutsummaryrefslogtreecommitdiff
path: root/include/ChatWindow.hpp
blob: b13046e4f50b9bafa688aa14af583d25506db4fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include <gtkmm/label.h>
#include <gtkmm/button.h>
#include <gtkmm/grid.h>
#include <gtkmm/entry.h>
#include <gtkmm/paned.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/stack.h>
#include <gtkmm/textview.h>
#include <odhtdb/Hash.hpp>

namespace dchat
{
    class ChatWindow : public Gtk::Grid
    {
    public:
        ChatWindow();
        void addChannel(const odhtdb::Hash &nodeHash);
        void addLocalMessage(const odhtdb::Hash &channelId, Glib::ustring msg);
    private:
        void setupTopBar();
        void setupLeftPanel(Gtk::Paned *sidePanels);
        void setupMessageArea(Gtk::Grid *rightPanel);
        void setupChatInput(Gtk::Grid *rightPanel);
    private:
        Gtk::Grid topbar;
        Gtk::Entry topbarSearchBar;
        Gtk::Grid leftPanelChannels;
        Gtk::Label currentChannelTitle;
        Gtk::ScrolledWindow chatArea;
        Gtk::Grid chatAreaLayout;
        Gtk::TextView chatInput;

        struct ChannelData
        {
            Gtk::Button *button;
            int messageCount;
        };

        odhtdb::MapHash<ChannelData> channelDataById;
        int channelCount;
    };
}