]> git.lyx.org Git - lyx.git/blob - src/Painter.h
some support for matrix operations with maple ('M-x math-extern maple evalm')
[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 <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
26 class LyXFont;
27 class WorkArea;
28
29 /** An inplementation for the X Window System. Xlib.
30     
31     Classes similar to this one can be made for gtk+, Qt, etc.
32 */
33 class Painter : public PainterBase {
34 public:
35         /// Constructor 
36         explicit Painter(WorkArea &);
37         
38         /// Draw a line from point to point
39         PainterBase & line(int x1, int y1, int x2, int y2, 
40                            LColor::color = LColor::foreground,
41                            enum line_style = line_solid,
42                            enum line_width = line_thin);
43         
44         /// Here xp and yp are arrays of points
45         PainterBase & lines(int const * xp, int const * yp, int np,
46                             LColor::color = LColor::foreground,
47                             enum line_style = line_solid,
48                             enum line_width = line_thin);
49         
50         /// Here xp and yp are arrays of points
51         PainterBase & fillPolygon(int const * xp, int const * yp, int np,
52                                   LColor::color = LColor::foreground);
53         
54         /// Draw lines from x1,y1 to x2,y2. They are arrays
55         PainterBase & segments(int const * x1, int const * y1, 
56                                int const * x2, int const * y2, int ns,
57                                LColor::color = LColor::foreground,
58                                enum line_style = line_solid,
59                                enum line_width = line_thin);
60         
61         /// Draw a rectangle 
62         PainterBase & rectangle(int x, int y, int w, int h,
63                                 LColor::color = LColor::foreground,
64                                 enum line_style = line_solid,
65                                 enum line_width = line_thin);
66         
67         /// Draw an arc
68         PainterBase & arc(int x, int y, unsigned int w, unsigned int h, 
69                           int a1, int a2,
70                           LColor::color = LColor::foreground);
71         
72         /// Draw a pixel
73         PainterBase & point(int x, int y, LColor::color = LColor::foreground);
74         
75         /// Fill a rectangle
76         PainterBase & fillRectangle(int x, int y, int w, int h,
77                                     LColor::color);
78         
79         /// For the graphics inset.
80         PainterBase & image(int x, int y, int w, int h, LyXImage const * image);
81         
82         /// For the figinset
83         PainterBase & pixmap(int x, int y, int w, int h, Pixmap bitmap);
84         
85         /// Draw a string at position x, y (y is the baseline)
86         PainterBase & text(int x, int y,
87                            string const & str, LyXFont const & f);
88         
89         /** Draw a string at position x, y (y is the baseline)
90             This is just for fast drawing */
91         PainterBase & text(int x, int y, char const * str, size_t l,
92                            LyXFont const & f);
93         
94         /// Draw a char at position x, y (y is the baseline)
95         PainterBase & text(int x, int y, char c, LyXFont const & f);
96
97         /// Draw a wide string at position x, y
98         PainterBase & text(int x, int y, XChar2b const * str, int l,
99                    LyXFont const & f);  
100 private:
101         /// Check the font, and if set, draw an underline
102         void underline(LyXFont const & f, int x, int y, int width);
103         
104         ///
105         Display * display;
106 };
107
108 #endif