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