#include "../include/ChatMessage.hpp" namespace dchat { ChatMessage::ChatMessage(const Glib::ustring &_username, const Glib::ustring &_text, uint32_t _timestampSeconds) : username(_username), text(_text), timestampSeconds(_timestampSeconds) { 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/PeepoHide.png"; username.set_selectable(true); username.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START); username.get_style_context()->add_class("message-message-username"); text.set_selectable(true); 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("message-message-text"); attach(avatar, 0, 0, 1, 2); attach_next_to(username, avatar, Gtk::POS_RIGHT, 1, 1); attach_next_to(text, username, Gtk::POS_BOTTOM, 1, 1); get_style_context()->add_class("message-message"); set_column_spacing(10); set_row_spacing(0); set_vexpand(false); } }