diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-01-11 18:27:46 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-01-11 18:27:46 -0500 |
commit | e8cbb9d3d1ecca25f1e0a31a75fac70c7a3ea0cb (patch) | |
tree | ecb21c74221f320422ff2390c940b921d02331f2 /components/typingindicator.hpp | |
parent | def598941a74d6960985171ef5f446bdf8858182 (diff) | |
download | abaddon-portaudio-e8cbb9d3d1ecca25f1e0a31a75fac70c7a3ea0cb.tar.gz abaddon-portaudio-e8cbb9d3d1ecca25f1e0a31a75fac70c7a3ea0cb.zip |
add typing indicator with optional res/typing_indicator.gif
Diffstat (limited to 'components/typingindicator.hpp')
-rw-r--r-- | components/typingindicator.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/components/typingindicator.hpp b/components/typingindicator.hpp new file mode 100644 index 0000000..d9633f4 --- /dev/null +++ b/components/typingindicator.hpp @@ -0,0 +1,24 @@ +#pragma once +#include <gtkmm.h> +#include <unordered_map> +#include "../discord/snowflake.hpp" +#include "../discord/user.hpp" + +class TypingIndicator : public Gtk::Box { +public: + TypingIndicator(); + void SetActiveChannel(Snowflake id); + +private: + void AddUser(Snowflake channel_id, const UserData &user, int timeout); + void OnUserTypingStart(Snowflake user_id, Snowflake channel_id); + void OnMessageCreate(Snowflake message_id); + void SetTypingString(const Glib::ustring &str); + void ComputeTypingString(); + + Gtk::Image m_img; + Gtk::Label m_label; + + Snowflake m_active_channel; + std::unordered_map<Snowflake, std::unordered_map<Snowflake, sigc::connection>> m_typers; // channel id -> [user id -> connection] +}; |