]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLPainter.h
rename LFUN enum values according to their command (as used in th minibuffer/bind...
[lyx.git] / src / frontends / qt4 / 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  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QLPAINTER_H
14 #define QLPAINTER_H
15
16 #include "Painter.h"
17
18 #include <boost/scoped_ptr.hpp>
19
20 class LyXFont;
21 class QPaintDevice;
22 class QPainter;
23 class QString;
24 class QPixmap;
25 class QImage;
26 class QWorkArea;
27
28 /**
29  * QLPainter - a painter implementation for Qt4
30  */
31 class QLPainter : public Painter {
32 public:
33         QLPainter(QWorkArea *);
34
35         ~QLPainter();
36
37         /// begin painting
38         /**
39         Not used in the the Qt4 frontend.
40         */
41         virtual void start() {}
42
43         /// end painting
44         /**
45         Not used in the the Qt4 frontend.
46         */
47         virtual void end() {}
48
49         /// return the width of the work area in pixels
50         virtual int paperWidth() const;
51         /// return the height of the work area in pixels
52         virtual int paperHeight() const;
53
54         /// draw a line from point to point
55         virtual void line(
56                 int x1, int y1,
57                 int x2, int y2,
58                 LColor_color,
59                 line_style = line_solid,
60                 line_width = line_thin);
61
62         /**
63          * lines -  draw a set of lines
64          * @param xp array of points' x co-ords
65          * @param yp array of points' y co-ords
66          * @param np size of the points array
67          */
68         virtual void lines(
69                 int const * xp,
70                 int const * yp,
71                 int np,
72                 LColor_color,
73                 line_style = line_solid,
74                 line_width = line_thin);
75
76         /// draw a rectangle
77         virtual void rectangle(
78                 int x, int y,
79                 int w, int h,
80                 LColor_color,
81                 line_style = line_solid,
82                 line_width = line_thin);
83
84         /// draw a filled rectangle
85         virtual void fillRectangle(
86                 int x, int y,
87                 int w, int h,
88                 LColor_color);
89
90         /// draw a filled (irregular) polygon
91         virtual void fillPolygon(
92                 int const * xp,
93                 int const * yp,
94                 int np,
95                 LColor_color);
96
97         /// draw an arc
98         virtual void arc(
99                 int x, int y,
100                 unsigned int w, unsigned int h,
101                 int a1, int a2,
102                 LColor_color);
103
104         /// draw a pixel
105         virtual void point(
106                 int x, int y,
107                 LColor_color);
108
109         /// draw an image from the image cache
110         virtual void image(int x, int y,
111                 int w, int h,
112                 lyx::graphics::Image const & image);
113
114         /// draw a string at position x, y (y is the baseline)
115         virtual void text(int x, int y,
116                 std::string const & str, LyXFont const & f);
117
118         /** Draw a string at position x, y (y is the baseline)
119          *  This is just for fast drawing
120          */
121         virtual void text(int x, int y,
122                 char const * str, size_t l,
123                 LyXFont const & f);
124
125         /// draw a char at position x, y (y is the baseline)
126         virtual void text(int x, int y,
127                 char c, LyXFont const & f);
128
129         /// draw a pixmap from the image cache
130         virtual void drawPixmap(int x, int y, QPixmap const & pixmap);
131
132         /// draw a pixmap from the image cache
133         virtual void drawImage(int x, int y, QImage const & image);
134
135 private:
136         /// draw small caps text
137         void smallCapsText(int x, int y,
138                 QString const & str, LyXFont const & f);
139
140         /// set pen parameters
141         QPainter & setQPainterPen(QPainter & qp, LColor_color c,
142                 line_style ls = line_solid,
143                 line_width lw = line_thin);
144
145         /// our qt painter
146         boost::scoped_ptr<QPainter> qp_;
147
148         /// the working area
149         QWorkArea * qwa_;
150 };
151
152 #endif // QLPAINTER_H