3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include "font_metrics.h"
26 void Painter::button(int x, int y, int w, int h)
28 fillRectangle(x, y, w, h, LColor::buttonbg);
29 buttonFrame(x, y, w, h);
33 void Painter::buttonFrame(int x, int y, int w, int h)
35 // Width of a side of the button
38 fillRectangle(x, y, w, d, LColor::top);
39 fillRectangle(x, y + h - d, w, d, LColor::bottom);
41 for (int i = 0 ; i < d ; ++i) {
43 x + i, y + h - 1 - i, LColor::left);
44 line(x + w - 1 - i, y + i + 1,
45 x + w - 1 - i, y + h - 1 - i, LColor::right);
50 void Painter::rectText(int x, int y,
60 font_metrics::rectText(str, font, width, ascent, descent);
62 if (back != LColor::none)
63 fillRectangle(x + 1, y - ascent + 1, width - 1,
64 ascent + descent - 1, back);
66 if (frame != LColor::none)
67 rectangle(x, y - ascent, width, ascent + descent, frame);
69 text(x + 3, y, str, font);
73 void Painter::buttonText(int x, int y, string const & str, LyXFont const & font)
79 font_metrics::buttonText(str, font, width, ascent, descent);
81 button(x, y - ascent, width, descent + ascent);
82 text(x + 4, y, str, font);
86 void Painter::underline(LyXFont const & f, int x, int y, int width)
88 int const below = max(font_metrics::maxDescent(f) / 2, 2);
89 int const height = max((font_metrics::maxDescent(f) / 4) - 1, 1);
92 line(x, y + below, x + width, y + below, f.color());
94 fillRectangle(x, y + below, width, below + height, f.color());
97 } // namespace frontend