aboutsummaryrefslogtreecommitdiff
path: root/src/ChatMessage.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-11-03 22:49:29 +0100
committerdec05eba <dec05eba@protonmail.com>2018-11-03 22:49:32 +0100
commitc7138bca7ea7d007198c544b2d8bc27ae414d2e2 (patch)
treeb27752bc5e4e452a9a4c047e884b8952a22a0f0a /src/ChatMessage.cpp
parent405459e93be718b0e6aad26746036105dd3f3226 (diff)
Start with gif/image widget
Diffstat (limited to 'src/ChatMessage.cpp')
-rw-r--r--src/ChatMessage.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/ChatMessage.cpp b/src/ChatMessage.cpp
index d48a6a9..fe3afdc 100644
--- a/src/ChatMessage.cpp
+++ b/src/ChatMessage.cpp
@@ -1,6 +1,4 @@
#include "../include/ChatMessage.hpp"
-#include "../include/GlobalCache.hpp"
-#include "../include/GtkGif.hpp"
namespace dchat
{
@@ -11,6 +9,8 @@ namespace dchat
{
avatar.set_halign(Gtk::ALIGN_START);
avatar.set_valign(Gtk::ALIGN_START);
+ avatar.set_size_request(50, 50);
+ avatar.url = "https://discordemoji.com/assets/emoji/7752_PepePOOGERSFAST.gif";
username.set_selectable(true);
username.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
@@ -20,6 +20,7 @@ namespace dchat
text.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
text.set_line_wrap(true);
text.set_line_wrap_mode(Pango::WRAP_WORD_CHAR);
+ text.set_vexpand(true);
text.get_style_context()->add_class("chat-message-text");
attach(avatar, 0, 0, 1, 2);
@@ -27,26 +28,8 @@ namespace dchat
attach_next_to(text, username, Gtk::POS_BOTTOM, 1, 1);
get_style_context()->add_class("chat-message");
- signal_draw().connect(sigc::mem_fun(*this, &ChatMessage::updateContent));
- }
-
- bool ChatMessage::updateContent(const Cairo::RefPtr<Cairo::Context> &cairo)
- {
- #if 0
- auto result = getGlobalCache().getContentByUrl("https://discordemoji.com/assets/emoji/3644_epicKirby.gif");
- printf("result type: %d\n", result.type);
- if(result.type == ContentByUrlResult::Type::CACHED && result.gif)
- {
- Gtk::Widget *child = avatar.get_child_at(0, 0);
- if(!child)
- {
- printf("add gif!\n");
- //GtkGif *gif = new GtkGif(GtkGif*)result.gif;
- //gif->copy
- //avatar.attach(*(GtkGif*)result.gif, 0, 0, 1, 1);
- }
- }
- #endif
- return true;
+ set_column_spacing(10);
+ set_row_spacing(0);
+ set_vexpand(false);
}
} \ No newline at end of file