1 #include <l4/scout-gfx/doc/token>
2 #include <l4/mag-gfx/canvas>
9 Token::Token(Style *style, const char *str, int len)
15 _flags.takes_focus = 0;
16 _col = _style ? _style->color : Color(0, 0, 0);
17 _outline = Color(0, 0, 0, 0);
22 _size = Area(_style->font->str_w(str, len) + _style->font->str_w(" ", 1),
23 _style->font->str_h(str, len));
26 void Token::draw(Canvas *c, Point const &p)
31 if (_style->attr & Style::ATTR_BOLD)
32 _outline = Color(_col.r(), _col.g(), _col.b(), 32);
34 Point np = p + Point(1,1);
37 for (int i = -1; i <= 1; i++) for (int j = -1; j <= 1; j++)
38 c->draw_string(np + Point(i,j), _style->font, _outline, _str, _len);
40 c->draw_string(np, _style->font, _col, _str, _len);
42 if (_style->attr & Style::ATTR_UNDERLINE)
43 c->draw_box(Rect(_size).bottom(1) + p, Color(0,0,255));