]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XPainter.h
Change glob() API to accept a dir parameter.
[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 class LyXFont;
21
22 namespace lyx {
23 namespace frontend {
24
25 class XWorkArea;
26
27 /**
28  * XPainter - a painter implementation for Xlib
29  */
30 class XPainter : public Painter {
31 public:
32         XPainter(XWorkArea &);
33
34         /// return the width of the work area in pixels
35         virtual int paperWidth() const;
36         /// return the height of the work area in pixels
37         virtual int paperHeight() const;
38
39         /// draw a line from point to point
40         virtual void line(
41                 int x1, int y1,
42                 int x2, int y2,
43                 LColor_color,
44                 line_style = line_solid,
45                 line_width = line_thin);
46
47         /**
48          * lines -  draw a set of lines
49          * @param xp array of points' x co-ords
50          * @param yp array of points' y co-ords
51          * @param np size of the points array
52          */
53         virtual void lines(
54                 int const * xp,
55                 int const * yp,
56                 int np,
57                 LColor_color,
58                 line_style = line_solid,
59                 line_width = line_thin);
60
61         /// draw a rectangle
62         virtual void rectangle(
63                 int x, int y,
64                 int w, int h,
65                 LColor_color,
66                 line_style = line_solid,
67                 line_width = line_thin);
68
69         /// draw a filled rectangle
70         virtual void fillRectangle(
71                 int x, int y,
72                 int w, int h,
73                 LColor_color);
74
75         /// draw a filled (irregular) polygon
76         virtual void fillPolygon(
77                 int const * xp,
78                 int const * yp,
79                 int np,
80                 LColor_color);
81
82         /// draw an arc
83         virtual void arc(
84                 int x, int y,
85                 unsigned int w, unsigned int h,
86                 int a1, int a2,
87                 LColor_color);
88
89         /// draw a pixel
90         virtual void point(
91                 int x, int y,
92                 LColor_color);
93
94         /// draw an image from the image cache
95         virtual void image(int x, int y,
96                 int w, int h,
97                 graphics::Image const & image);
98
99         /// draw a string at position x, y (y is the baseline)
100         virtual void text(int x, int y,
101                 std::string const & str, LyXFont const & f);
102
103         /** Draw a string at position x, y (y is the baseline)
104          *  This is just for fast drawing
105          */
106         virtual void text(int x, int y,
107                 char const * str, size_t l,
108                 LyXFont const & f);
109
110         /// draw a char at position x, y (y is the baseline)
111         virtual void text(int x, int y,
112                 char c, LyXFont const & f);
113
114         /// draw a wide string at position x, y
115         void text(int x, int y,
116                 XChar2b const * str, size_t l,
117                 LyXFont const & f);
118
119 private:
120         /// our owner who we paint upon
121         XWorkArea & owner_;
122 };
123
124 } // namespace frontend
125 } // namespace lyx
126
127 #endif // XPAINTER_H