summaryrefslogtreecommitdiff
path: root/components/memberlist.hpp
blob: 08629bba911ca871759b502d7de23a001cb13d29 (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
#pragma once
#include <gtkmm.h>
#include <mutex>
#include "../discord/discord.hpp"

class Abaddon;
class MemberList {
public:
    class MemberListUserRow : public Gtk::ListBoxRow {
    public:
        Snowflake ID;
    };

    MemberList();
    Gtk::Widget *GetRoot() const;

    void UpdateMemberList();
    void SetActiveChannel(Snowflake id);

    void SetAbaddon(Abaddon *ptr);

private:
    void on_copy_id_activate();
    void on_insert_mention_activate();

    void UpdateMemberListInternal();
    void AttachUserMenuHandler(Gtk::ListBoxRow *row, Snowflake id);

    Gtk::Menu m_menu;
    Gtk::MenuItem *m_menu_copy_id;
    Gtk::MenuItem *m_menu_insert_mention;
    Gtk::ListBoxRow *m_row_menu_target = nullptr; // maybe hacky

    std::mutex m_mutex;
    Glib::Dispatcher m_update_member_list_dispatcher;

    Gtk::ScrolledWindow *m_main;
    Gtk::ListBox *m_listbox;

    Snowflake m_guild_id;
    Snowflake m_chan_id;
    Abaddon *m_abaddon = nullptr;
};