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"
28 void Painter::button(int x, int y, int w, int h)
30 fillRectangle(x, y, w, h, LColor::buttonbg);
31 buttonFrame(x, y, w, h);
35 void Painter::buttonFrame(int x, int y, int w, int h)
37 // Width of a side of the button
40 fillRectangle(x, y, w, d, LColor::top);
41 fillRectangle(x, y + h - d, w, d, LColor::bottom);
43 for (int i = 0 ; i < d ; ++i) {
45 x + i, y + h - 1 - i, LColor::left);
46 line(x + w - 1 - i, y + i + 1,
47 x + w - 1 - i, y + h - 1 - i, LColor::right);
52 void Painter::rectText(int x, int y,
53 docstring const & str,
62 font_metrics::rectText(str, font, width, ascent, descent);
64 if (back != LColor::none)
65 fillRectangle(x + 1, y - ascent + 1, width - 1,
66 ascent + descent - 1, back);
68 if (frame != LColor::none)
69 rectangle(x, y - ascent, width, ascent + descent, frame);
71 text(x + 3, y, str, font);
75 void Painter::buttonText(int x, int y, docstring const & str, LyXFont const & font)
81 font_metrics::buttonText(str, font, width, ascent, descent);
83 button(x, y - ascent, width, descent + ascent);
84 text(x + 4, y, str, font);
88 void Painter::underline(LyXFont const & f, int x, int y, int width)
90 int const below = max(font_metrics::maxDescent(f) / 2, 2);
91 int const height = max((font_metrics::maxDescent(f) / 4) - 1, 1);
94 line(x, y + below, x + width, y + below, f.color());
96 fillRectangle(x, y + below, width, below + height, f.color());
99 } // namespace frontend