1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1998-2001 The LyX Team
8 *======================================================*/
13 #pragma implementation
16 #include "PainterBase.h"
22 int PainterBase::paperMargin() const
28 int PainterBase::paperWidth() const
30 return owner.workWidth();
34 int PainterBase::paperHeight() const
36 return owner.height();
40 PainterBase & PainterBase::circle(int x, int y, unsigned int d,
43 return ellipse(x, y, d, d, col);
47 PainterBase & PainterBase::ellipse(int x, int y,
48 unsigned int w, unsigned int h,
51 return arc(x, y, w, h, 0, 0, col);
55 PainterBase & PainterBase::button(int x, int y, int w, int h)
57 fillRectangle(x, y, w, h, LColor::buttonbg);
58 buttonFrame(x, y, w, h);
63 PainterBase & PainterBase::buttonFrame(int x, int y, int w, int h)
65 // Width of a side of the button
68 fillRectangle(x, y, w, d, LColor::top);
69 fillRectangle(x, (y+h-d), w, d, LColor::bottom);
71 // Now a couple of trapezoids
74 x1[0] = x + d; y1[0] = y + d;
75 x1[1] = x + d; y1[1] = (y + h - d);
76 x1[2] = x; y1[2] = y + h;
78 fillPolygon(x1, y1, 4, LColor::left);
80 x1[0] = (x + w - d); y1[0] = y + d;
81 x1[1] = (x + w - d); y1[1] = (y + h - d);
82 x1[2] = x + w; y1[2] = (y + h - d);
83 x1[3] = x + w; y1[3] = y;
84 fillPolygon(x1, y1, 4, LColor::right);
90 PainterBase & PainterBase::rectText(int x, int baseline,
100 lyxfont::rectText(str, font, width, ascent, descent);
101 rectangle(x, baseline - ascent, width, ascent + descent, frame);
102 fillRectangle(x + 1, baseline - ascent + 1, width - 1,
103 ascent + descent - 1, back);
104 text(x + 3, baseline, str, font);
109 PainterBase & PainterBase::buttonText(int x, int baseline,
111 LyXFont const & font)
117 lyxfont::buttonText(str, font, width, ascent, descent);
118 button(x, baseline - ascent, width, descent + ascent);
119 text(x + 4, baseline, str, font);