]> git.lyx.org Git - lyx.git/blob - src/Painter.h
Fix small bug in reading \set_color in lyxrc
[lyx.git] / src / Painter.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1995-2000 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 "config.h"
19 #include "LString.h"
20
21 // This is only included to provide stuff for the non-public sections
22 #include <X11/Xlib.h>
23
24 #include "PainterBase.h"
25 #include "LColor.h"
26
27 class LyXFont;
28 class WorkArea;
29
30 /** An inplementation for the X Window System. Xlib.
31     
32     Classes similar to this one can be made for gtk+, Qt, etc.
33 */
34 class Painter : public PainterBase {
35 public:
36         /// Constructor 
37         explicit Painter(WorkArea &);
38         
39         /**@Basic drawing routines */
40         /// Draw a line from point to point
41         PainterBase & line(int x1, int y1, int x2, int y2, 
42                            LColor::color = LColor::foreground,
43                            enum line_style = line_solid,
44                            enum line_width = line_thin);
45         
46         /// Here xp and yp are arrays of points
47         PainterBase & lines(int const * xp, int const * yp, int np,
48                             LColor::color = LColor::foreground,
49                             enum line_style = line_solid,
50                             enum line_width = line_thin);
51         
52         /// Here xp and yp are arrays of points
53         PainterBase & fillPolygon(int const * xp, int const * yp, int np,
54                                   LColor::color = LColor::foreground);
55         
56         /// Draw lines from x1,y1 to x2,y2. They are arrays
57         PainterBase & segments(int const * x1, int const * y1, 
58                                int const * x2, int const * y2, int ns,
59                                LColor::color = LColor::foreground,
60                                enum line_style = line_solid,
61                                enum line_width = line_thin);
62         
63         /// Draw a rectangle 
64         PainterBase & rectangle(int x, int y, int w, int h,
65                                 LColor::color = LColor::foreground,
66                                 enum line_style = line_solid,
67                                 enum line_width = line_thin);
68         
69         /// Draw an arc
70         PainterBase & arc(int x, int y, unsigned int w, unsigned int h, 
71                           int a1, int a2,
72                           LColor::color = LColor::foreground);
73         
74         /// Draw a pixel
75         PainterBase & point(int x, int y, LColor::color = LColor::foreground);
76         
77         /// Fill a rectangle
78         PainterBase & fillRectangle(int x, int y, int w, int h,
79                                     LColor::color = LColor::background);
80         
81         /**@Image stuff */
82         
83         /// For the figure inset
84         PainterBase & pixmap(int x, int y, int w, int h, Pixmap bitmap);
85         
86         /**@String functions */
87         
88         /// Draw a string at position x, y (y is the baseline)
89         PainterBase & text(int x, int y,
90                            string const & str, LyXFont const & f);
91         
92         /** Draw a string at position x, y (y is the baseline)
93             This is just for fast drawing */
94         PainterBase & text(int x, int y, char const * str, int l,
95                            LyXFont const & f);
96         
97         /// Draw a char at position x, y (y is the baseline)
98         PainterBase & text(int x, int y, char c, LyXFont const & f);
99
100         /// Draw a wide string at position x, y
101         PainterBase & text(int x, int y, XChar2b const * str, int l,
102                    LyXFont const & f);  
103 private:
104         /// Check the font, and if set, draw an underline
105         void underline(LyXFont const & f, int x, int y, int width);
106         
107         /**@Low level X parameters */
108         ///
109         Display * display;
110 };
111
112 #endif