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