#include "Label.hpp" #include "Window.hpp" #include "pango/pango-layout.h" namespace Raven { void Label::on_init() { // the label will inherit the background color properties from the parent if (parent()) { set_do_background_fill(parent()->do_background_fill()); set_background_fill_color(parent()->background_fill_color()); } set_did_init(true); } void Label::on_paint() { auto painter = window()->painter(); auto text_color = styles()->label_text_color(); painter.source_rgb(text_color); painter.set_pango_font_description(styles()->controls_font_description()); painter.text(current_geometry(), m_text, PaintTextAlign::Left, PANGO_ELLIPSIZE_NONE); painter.fill(); } }