]> git.lyx.org Git - features.git/blob - src/frontends/qt3/QLPainter.h
delete Painter::fillPolygon() and associated frontend implementations
[features.git] / src / frontends / qt3 / QLPainter.h
1 // -*- C++ -*-
2 /**
3  * \file QLPainter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef QLPAINTER_H
13 #define QLPAINTER_H
14
15 #include "frontends/Painter.h"
16
17 #include <boost/scoped_ptr.hpp>
18
19
20 class LyXFont;
21 class QPainter;
22 class QString;
23
24 namespace lyx {
25 namespace frontend {
26
27 class QWorkArea;
28
29 /**
30  * QLPainter - a painter implementation for Xlib
31  */
32 class QLPainter : public lyx::frontend::Painter {
33 public:
34         QLPainter(QWorkArea &);
35
36         /// begin painting
37         virtual void start();
38
39         /// end painting
40         virtual void end();
41
42         /// return the width of the work area in pixels
43         virtual int paperWidth() const;
44         /// return the height of the work area in pixels
45         virtual int paperHeight() const;
46
47         /// draw a line from point to point
48         virtual void line(
49                 int x1, int y1,
50                 int x2, int y2,
51                 LColor_color,
52                 line_style = line_solid,
53                 line_width = line_thin);
54
55         /**
56          * lines -  draw a set of lines
57          * @param xp array of points' x co-ords
58          * @param yp array of points' y co-ords
59          * @param np size of the points array
60          */
61         virtual void lines(
62                 int const * xp,
63                 int const * yp,
64                 int np,
65                 LColor_color,
66                 line_style = line_solid,
67                 line_width = line_thin);
68
69         /// draw a rectangle
70         virtual void rectangle(
71                 int x, int y,
72                 int w, int h,
73                 LColor_color,
74                 line_style = line_solid,
75                 line_width = line_thin);
76
77         /// draw a filled rectangle
78         virtual void fillRectangle(
79                 int x, int y,
80                 int w, int h,
81                 LColor_color);
82
83         /// draw an arc
84         virtual void arc(
85                 int x, int y,
86                 unsigned int w, unsigned int h,
87                 int a1, int a2,
88                 LColor_color);
89
90         /// draw a pixel
91         virtual void point(
92                 int x, int y,
93                 LColor_color);
94
95         /// draw an image from the image cache
96         virtual void image(int x, int y,
97                 int w, int h,
98                 lyx::graphics::Image const & image);
99
100         /// draw a string at position x, y (y is the baseline)
101         virtual void text(int x, int y,
102                 std::string const & str, LyXFont const & f);
103
104         /** Draw a string at position x, y (y is the baseline)
105          *  This is just for fast drawing
106          */
107         virtual void text(int x, int y,
108                 char const * str, size_t l,
109                 LyXFont const & f);
110
111         /// draw a char at position x, y (y is the baseline)
112         virtual void text(int x, int y,
113                 char c, LyXFont const & f);
114 private:
115         /// draw small caps text
116         void smallCapsText(int x, int y,
117                 QString const & str, LyXFont const & f);
118
119         /// set pen parameters
120         QPainter & setPen(LColor_color c,
121                 line_style ls = line_solid,
122                 line_width lw = line_thin);
123
124         /// our owner who we paint upon
125         QWorkArea & owner_;
126
127         /// our qt painter
128         boost::scoped_ptr<QPainter> qp_;
129
130         /// recursion check
131         int paint_check_;
132 };
133
134 } // namespace frontend
135 } // namespace lyx
136
137 #endif // QLPAINTER_H