From c7138bca7ea7d007198c544b2d8bc27ae414d2e2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 3 Nov 2018 22:49:29 +0100 Subject: Start with gif/image widget --- src/ChatMessage.cpp | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'src/ChatMessage.cpp') 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) - { - #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 -- cgit v1.2.3