#pragma once #include "Box.hpp" #include "Point.hpp" #include "RGB.hpp" #include "cairomm/xlib_surface.h" #include #include namespace Raven { enum class PaintTextAlign { Center = 0, Left }; class Painter { private: Cairo::RefPtr m_cairo { nullptr }; PangoFontDescription *m_pango_font_description { nullptr }; public: Painter() {} Cairo::RefPtr cairo() { return m_cairo; } void set_cairo(Cairo::RefPtr cairo) { m_cairo = cairo; } void set_pango_font_description(PangoFontDescription *pango_font_description) { m_pango_font_description = pango_font_description; } PangoFontDescription *pango_font_description() { return m_pango_font_description; } void rounded_rectangle(Box &geometry, double border_radius); Point text(Box &geometry, std::string &text, PaintTextAlign align, PangoEllipsizeMode ellipsize, bool set_size); Point compute_text_size(Box &widget_geometry, std::string &text); bool can_paint() { if (m_cairo) return true; else return false; } void source_rgb(RGB &source_rgb); void fill(); void begin_paint_group(); void end_paint_group(); void flush_paint_group(); }; }