#include "Label.hpp" #include "Window.hpp" #include "pango/pango-layout.h" #include "Styles.hpp" #include namespace Raven { void Label::set_text(std::string text) { m_text = text; if (window()) { fit_text(text); } } void Label::on_init() { set_style(&default_label_style); fit_text(m_text); set_did_init(true); } void Label::on_paint() { auto painter = window()->painter(); painter.source_rgb(style()->foreground()); painter.set_pango_font_description(style()->font_description()); painter.text(rect(), m_text, PaintTextAlign::Left, PANGO_ELLIPSIZE_NONE, true); painter.fill(); } }