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"
24 Painter & Painter::button(int x, int y, int w, int h)
26 fillRectangle(x, y, w, h, LColor::buttonbg);
27 buttonFrame(x, y, w, h);
32 Painter & Painter::buttonFrame(int x, int y, int w, int h)
34 // Width of a side of the button
37 fillRectangle(x, y, w, d, LColor::top);
38 fillRectangle(x, (y + h - d), w, d, LColor::bottom);
40 // Now a couple of trapezoids
43 x1[0] = x + d; y1[0] = y + d;
44 x1[1] = x + d; y1[1] = (y + h - d);
45 x1[2] = x; y1[2] = y + h;
47 fillPolygon(x1, y1, 4, LColor::left);
49 x1[0] = (x + w - d); y1[0] = y + d;
50 x1[1] = (x + w - d); y1[1] = (y + h - d);
51 x1[2] = x + w; y1[2] = (y + h - d);
52 x1[3] = x + w; y1[3] = y;
53 fillPolygon(x1, y1, 4, LColor::right);
59 Painter & Painter::rectText(int x, int baseline,
69 font_metrics::rectText(str, font, width, ascent, descent);
71 if (back != LColor::none) {
72 fillRectangle(x + 1, baseline - ascent + 1, width - 1,
73 ascent + descent - 1, back);
76 if (frame != LColor::none) {
77 rectangle(x, baseline - ascent, width, ascent + descent, frame);
80 text(x + 3, baseline, str, font);
85 Painter & Painter::buttonText(int x, int baseline,
93 font_metrics::buttonText(str, font, width, ascent, descent);
95 button(x, baseline - ascent, width, descent + ascent);
96 text(x + 4, baseline, str, font);
101 void Painter::underline(LyXFont const & f, int x, int y, int width)
103 int const below = max(font_metrics::maxDescent(f) / 2, 2);
104 int const height = max((font_metrics::maxDescent(f) / 4) - 1, 1);
107 line(x, y + below, x + width, y + below, f.color());
109 fillRectangle(x, y + below, width, below + height,