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"
25 Painter & Painter::button(int x, int y, int w, int h)
27 fillRectangle(x, y, w, h, LColor::buttonbg);
28 buttonFrame(x, y, w, h);
33 Painter & 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 // Now a couple of trapezoids
44 x1[0] = x + d; y1[0] = y + d;
45 x1[1] = x + d; y1[1] = (y + h - d);
46 x1[2] = x; y1[2] = y + h;
48 fillPolygon(x1, y1, 4, LColor::left);
50 x1[0] = (x + w - d); y1[0] = y + d;
51 x1[1] = (x + w - d); y1[1] = (y + h - d);
52 x1[2] = x + w; y1[2] = (y + h - d);
53 x1[3] = x + w; y1[3] = y;
54 fillPolygon(x1, y1, 4, LColor::right);
60 Painter & Painter::rectText(int x, int baseline,
70 font_metrics::rectText(str, font, width, ascent, descent);
72 if (back != LColor::none) {
73 fillRectangle(x + 1, baseline - ascent + 1, width - 1,
74 ascent + descent - 1, back);
77 if (frame != LColor::none) {
78 rectangle(x, baseline - ascent, width, ascent + descent, frame);
81 text(x + 3, baseline, str, font);
86 Painter & Painter::buttonText(int x, int baseline,
94 font_metrics::buttonText(str, font, width, ascent, descent);
96 button(x, baseline - ascent, width, descent + ascent);
97 text(x + 4, baseline, str, font);
102 void Painter::underline(LyXFont const & f, int x, int y, int width)
104 int const below = max(font_metrics::maxDescent(f) / 2, 2);
105 int const height = max((font_metrics::maxDescent(f) / 4) - 1, 1);
108 line(x, y + below, x + width, y + below, f.color());
110 fillRectangle(x, y + below, width, below + height,