]> git.lyx.org Git - lyx.git/blob - src/Painter.h
fix typo that put too many include paths for most people
[lyx.git] / src / Painter.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *          Copyright 1995-2001 The LyX Team
8  *
9  * ======================================================*/
10
11 #ifndef PAINTER_H
12 #define PAINTER_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "LString.h"
19
20 // This is only included to provide stuff for the non-public sections
21 #include <X11/Xlib.h>
22
23 #include "PainterBase.h"
24
25 class LyXFont;
26 class WorkArea;
27
28 /** An inplementation for the X Window System. Xlib.
29     Classes similar to this one can be made for gtk+, Qt, etc.
30 */
31 class Painter : public PainterBase {
32 public:
33         /// Constructor
34         explicit Painter(WorkArea &);
35
36         /// Draw a line from point to point
37         PainterBase & line(int x1, int y1, int x2, int y2,
38                            LColor::color = LColor::foreground,
39                            enum line_style = line_solid,
40                            enum line_width = line_thin);
41
42         /// Here xp and yp are arrays of points
43         PainterBase & lines(int const * xp, int const * yp, int np,
44                             LColor::color = LColor::foreground,
45                             enum line_style = line_solid,
46                             enum line_width = line_thin);
47
48         /// Here xp and yp are arrays of points
49         PainterBase & fillPolygon(int const * xp, int const * yp, int np,
50                                   LColor::color = LColor::foreground);
51
52         /// Draw lines from x1,y1 to x2,y2. They are arrays
53         PainterBase & segments(int const * x1, int const * y1,
54                                int const * x2, int const * y2, int ns,
55                                LColor::color = LColor::foreground,
56                                enum line_style = line_solid,
57                                enum line_width = line_thin);
58
59         /// Draw a rectangle
60         PainterBase & rectangle(int x, int y, int w, int h,
61                                 LColor::color = LColor::foreground,
62                                 enum line_style = line_solid,
63                                 enum line_width = line_thin);
64
65         /// Draw an arc
66         PainterBase & arc(int x, int y, unsigned int w, unsigned int h,
67                           int a1, int a2,
68                           LColor::color = LColor::foreground);
69
70         /// Draw a pixel
71         PainterBase & point(int x, int y, LColor::color = LColor::foreground);
72
73         /// Fill a rectangle
74         PainterBase & fillRectangle(int x, int y, int w, int h,
75                                     LColor::color);
76
77         /// For the graphics inset.
78         PainterBase & image(int x, int y, int w, int h,
79                             grfx::GImage const & image);
80
81         /// Draw a string at position x, y (y is the baseline)
82         PainterBase & text(int x, int y,
83                            string const & str, LyXFont const & f);
84
85         /** Draw a string at position x, y (y is the baseline)
86             This is just for fast drawing */
87         PainterBase & text(int x, int y, char const * str, size_t l,
88                            LyXFont const & f);
89
90         /// Draw a char at position x, y (y is the baseline)
91         PainterBase & text(int x, int y, char c, LyXFont const & f);
92
93         /// Draw a wide string at position x, y
94         PainterBase & text(int x, int y, XChar2b const * str, int l,
95                            LyXFont const & f);
96 private:
97         /// Check the font, and if set, draw an underline
98         void underline(LyXFont const & f, int x, int y, int width);
99 };
100
101 #endif