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"
21 int PainterBase::dummy1 = 0;
22 int PainterBase::dummy2 = 0;
23 int PainterBase::dummy3 = 0;
25 int PainterBase::paperMargin() const
31 int PainterBase::paperWidth() const
33 return owner.workWidth();
37 int PainterBase::paperHeight() const
39 return owner.height();
43 PainterBase & PainterBase::circle(int x, int y, unsigned int d,
46 return ellipse(x, y, d, d, col);
50 PainterBase & PainterBase::ellipse(int x, int y,
51 unsigned int w, unsigned int h,
54 return arc(x, y, w, h, 0, 0, col);
58 PainterBase & PainterBase::button(int x, int y, int w, int h)
60 fillRectangle(x, y, w, h, LColor::buttonbg);
61 buttonFrame(x, y, w, h);
66 PainterBase & PainterBase::buttonFrame(int x, int y, int w, int h)
68 // Width of a side of the button
71 fillRectangle(x, y, w, d, LColor::top);
72 fillRectangle(x, (y+h-d), w, d, LColor::bottom);
74 // Now a couple of trapezoids
77 x1[0] = x+d; y1[0] = y+d;
78 x1[1] = x+d; y1[1] = (y+h-d);
79 x1[2] = x; y1[2] = y+h;
81 fillPolygon(x1, y1, 4, LColor::left);
83 x1[0] = (x+w-d); y1[0] = y+d;
84 x1[1] = (x+w-d); y1[1] = (y+h-d);
85 x1[2] = x+w; y1[2] = (y+h-d);
86 x1[3] = x+w; y1[3] = y;
87 fillPolygon(x1, y1, 4, LColor::right);
93 PainterBase & PainterBase::rectText(int x, int baseline,
103 lyxfont::rectText(str, font, width, ascent, descent);
104 rectangle(x, baseline - ascent, width, ascent + descent, frame);
105 fillRectangle(x + 1, baseline - ascent + 1, width - 1,
106 ascent + descent - 1, back);
107 text(x + 3, baseline, str, font);
112 PainterBase & PainterBase::buttonText(int x, int baseline,
114 LyXFont const & font)
120 lyxfont::buttonText(str, font, width, ascent, descent);
121 button(x, baseline - ascent, width, descent + ascent);
122 text(x + 4, baseline, str, font);