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