The Painter class provides methods for drawing Glyphs to the screen, this is
used in the paint_event()
handler.
Each invocation of the paint event handler should create a new Painter object, taking a reference to the Widget that will be painted to. All coordinates passed to the Painter object will be local to the passed in Widget.
Places a Glyph at a local Point within the Widget, overriding any previously placed Glyph.
Places the first Glyph of a Glyph_string at a local Point within the Widget with all other Glyphs following from left to right, overriding any previously palced Glyphs that the string would overlap with. If the string goes out of bounds, those Glyphs are not drawn.
Fills in a Rectangle with the given Glyph. The top left corner is given by the Point and the Area is the size of the space to fill.
Fills in a line of the given Glyph from Point a
to Point b
. Diagonals are
not implemented yet.
bool paint_event(Painter& p) override
{
p.put(U'X' | Trait::Bold, {3, 5});
p.line(U'-', {0, 0}, {0, this->area().height - 1});
p.fill(U'#', Point{7, 2}, Area{5, 5});
return Widget::paint_event(p);
}