diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
commit | e1703aea3fd597b23bde90e6c505278c517be611 (patch) | |
tree | 37d98fc90c9cd0844388bfb79beda2204f44af92 /src/components/friendslist.hpp | |
parent | fd53a76bf6f53a095a639765923a30f2206b2cd6 (diff) | |
parent | e02107feea8214a045e6faa969f00dcbc0d2b072 (diff) | |
download | abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.tar.gz abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.zip |
merge master
Diffstat (limited to 'src/components/friendslist.hpp')
-rw-r--r-- | src/components/friendslist.hpp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/components/friendslist.hpp b/src/components/friendslist.hpp new file mode 100644 index 0000000..460ad32 --- /dev/null +++ b/src/components/friendslist.hpp @@ -0,0 +1,92 @@ +#pragma once +#include <gtkmm.h> +#include "discord/objects.hpp" + +class FriendsListAddComponent : public Gtk::Box { +public: + FriendsListAddComponent(); + +private: + void Submit(); + bool OnKeyPress(GdkEventKey *e); + + Gtk::Label m_label; + Gtk::Label m_status; + Gtk::Entry m_entry; + Gtk::Button m_add; + Gtk::Box m_box; + + bool m_requesting = false; +}; + +class FriendsListFriendRow; +class FriendsList : public Gtk::Box { +public: + FriendsList(); + +private: + FriendsListFriendRow *MakeRow(const UserData &user, RelationshipType type); + + void OnRelationshipAdd(const RelationshipAddData &data); + void OnRelationshipRemove(Snowflake id, RelationshipType type); + + void OnActionAccept(Snowflake id); + void OnActionRemove(Snowflake id); + + void PopulateRelationships(); + + enum FilterMode { + FILTER_FRIENDS, + FILTER_ONLINE, + FILTER_PENDING, + FILTER_BLOCKED, + }; + + FilterMode m_filter_mode; + + int ListSortFunc(Gtk::ListBoxRow *a, Gtk::ListBoxRow *b); + bool ListFilterFunc(Gtk::ListBoxRow *row); + + FriendsListAddComponent m_add; + Gtk::RadioButtonGroup m_group; + Gtk::ButtonBox m_buttons; + Gtk::ScrolledWindow m_scroll; + Gtk::ListBox m_list; +}; + +class FriendsListFriendRow : public Gtk::ListBoxRow { +public: + FriendsListFriendRow(RelationshipType type, const UserData &str); + + Snowflake ID; + RelationshipType Type; + Glib::ustring Name; + PresenceStatus Status; + +private: + void UpdatePresenceLabel(); + void OnPresenceUpdate(const UserData &user, PresenceStatus status); + + Gtk::Label *m_status_lbl; + + Gtk::Menu m_menu; + Gtk::MenuItem m_remove; // or cancel or ignore + Gtk::MenuItem m_accept; // incoming + + using type_signal_remove = sigc::signal<void>; + using type_signal_accept = sigc::signal<void>; + type_signal_remove m_signal_remove; + type_signal_accept m_signal_accept; + +public: + type_signal_remove signal_action_remove(); + type_signal_accept signal_action_accept(); +}; + +class FriendsListWindow : public Gtk::Window { +public: + FriendsListWindow(); + +private: + FriendsList m_friends; +}; |