summaryrefslogtreecommitdiff
path: root/src/components/channellist/classic/guildlist.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2024-06-22 04:25:56 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2024-06-22 04:25:56 -0400
commite65174f5aab55fe3917dd52f97b1b00a07d30d38 (patch)
treefed590caf0440fd47b72a51e21e692fe703860bd /src/components/channellist/classic/guildlist.cpp
parent3dc8fa8e65bdd1bd45dfa0171a06dfbb448baf0d (diff)
parent7af15b326df5a638b24c5e637d5f37396276f906 (diff)
downloadabaddon-portaudio-e65174f5aab55fe3917dd52f97b1b00a07d30d38.tar.gz
abaddon-portaudio-e65174f5aab55fe3917dd52f97b1b00a07d30d38.zip
Merge branch 'master' into stages
Diffstat (limited to 'src/components/channellist/classic/guildlist.cpp')
-rw-r--r--src/components/channellist/classic/guildlist.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/components/channellist/classic/guildlist.cpp b/src/components/channellist/classic/guildlist.cpp
index 6a6e3d4..11a6775 100644
--- a/src/components/channellist/classic/guildlist.cpp
+++ b/src/components/channellist/classic/guildlist.cpp
@@ -1,8 +1,11 @@
+#include <gtkmm/overlay.h>
+
#include "guildlist.hpp"
#include "abaddon.hpp"
#include "util.hpp"
#include "guildlistfolderitem.hpp"
+#include "mentionoverlay.hpp"
class GuildListDMsButton : public Gtk::EventBox {
public:
@@ -93,10 +96,38 @@ void GuildList::UpdateListing() {
}
}
+static Gtk::Widget *AddMentionOverlay(Gtk::Widget *widget, Snowflake guild_id) {
+ auto *overlay = Gtk::make_managed<Gtk::Overlay>();
+ overlay->add(*widget);
+ auto *mention_overlay = Gtk::make_managed<MentionOverlay>(guild_id);
+ overlay->add_overlay(*mention_overlay);
+ overlay->set_overlay_pass_through(*mention_overlay, true);
+ mention_overlay->signal_realize().connect([mention_overlay]() {
+ mention_overlay->get_window()->set_pass_through(true);
+ });
+ mention_overlay->show();
+ overlay->show();
+ return overlay;
+}
+
+static Gtk::Widget *AddMentionOverlay(Gtk::Widget *widget, const UserSettingsGuildFoldersEntry &folder) {
+ auto *overlay = Gtk::make_managed<Gtk::Overlay>();
+ overlay->add(*widget);
+ auto *mention_overlay = Gtk::make_managed<MentionOverlay>(folder);
+ overlay->add_overlay(*mention_overlay);
+ overlay->set_overlay_pass_through(*mention_overlay, true);
+ mention_overlay->signal_realize().connect([mention_overlay]() {
+ mention_overlay->get_window()->set_pass_through(true);
+ });
+ mention_overlay->show();
+ overlay->show();
+ return overlay;
+}
+
void GuildList::AddGuild(Snowflake id) {
if (auto item = CreateGuildWidget(id)) {
item->show();
- add(*item);
+ add(*AddMentionOverlay(item, id));
}
}
@@ -132,12 +163,12 @@ void GuildList::AddFolder(const UserSettingsGuildFoldersEntry &folder) {
for (const auto guild_id : folder.GuildIDs) {
if (auto *guild_widget = CreateGuildWidget(guild_id)) {
guild_widget->show();
- folder_widget->AddGuildWidget(guild_widget);
+ folder_widget->AddGuildWidget(AddMentionOverlay(guild_widget, guild_id));
}
}
folder_widget->show();
- add(*folder_widget);
+ add(*AddMentionOverlay(folder_widget, folder));
}
void GuildList::Clear() {