]> git.lyx.org Git - lyx.git/blob - src/mathed/textpainter.h
Fix event loop to no longer eat CPU
[lyx.git] / src / mathed / textpainter.h
1 // -*- C++ -*-
2 /**
3  * \file textpainter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef TEXTPAINTER_H
13 #define TEXTPAINTER_H
14
15
16 #include <vector>
17 #include <iosfwd>
18
19 class TextPainter {
20         public:
21                 ///
22                 TextPainter(int xmax, int ymax);
23                 ///
24                 void draw(int x, int y, char const * str);
25                 ///
26                 void draw(int x, int y, char c);
27                 ///
28                 void show(std::ostream & os, int offset = 0) const;
29                 ///
30                 int textheight() const { return ymax_; }
31                 ///
32                 void horizontalLine(int x, int y, int len, char c = '-');
33                 ///
34                 void verticalLine(int x, int y, int len, char c = '|');
35
36         private:
37                 ///
38                 typedef std::vector<char> data_type;
39                 ///
40                 char at(int x, int y) const;
41                 ///
42                 char & at(int x, int y);
43
44                 /// xsize of the painter area
45                 int xmax_;
46                 /// ysize of the painter area
47                 int ymax_;
48                 /// the image
49                 data_type data_;
50 };
51
52 #endif