aboutsummaryrefslogtreecommitdiff
path: root/src/ChatMessage.cpp
blob: 048bfcaf69e2dd3227e3cccd9b0e01f8ca89fcf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "../include/ChatMessage.hpp"

namespace dchat
{
    ChatMessage::ChatMessage(const Glib::ustring &_username, const Glib::ustring &_text) : 
        username(_username),
        text(_text)
    {
        username.set_selectable(true);
        username.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
        username.get_style_context()->add_class("chat-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.get_style_context()->add_class("chat-message-text");

        attach(username, 0, 0, 1, 1);
        attach(text, 0, 1, 1, 1);
        get_style_context()->add_class("chat-message");
    }
}