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