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