3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "TextPainter.h"
14 #include "support/std_ostream.h"
20 TextPainter::TextPainter(int xmax, int ymax)
21 : xmax_(xmax), ymax_(ymax), data_(xmax_ * (ymax_ + 1), ' ')
25 char_type & TextPainter::at(int x, int y)
27 return data_[y * xmax_ + x];
31 char_type TextPainter::at(int x, int y) const
33 return data_[y * xmax_ + x];
37 void TextPainter::draw(int x, int y, char_type const * str)
39 //cerr << "drawing string '" << str << "' at " << x << ',' << y << endl;
40 for (int i = 0; *str && x + i < xmax_; ++i, ++str)
46 void TextPainter::horizontalLine(int x, int y, int n, char_type c)
48 for (int i = 0; i < n && i + x < xmax_; ++i)
53 void TextPainter::verticalLine(int x, int y, int n, char_type c)
55 for (int i = 0; i < n && i + y < ymax_; ++i)
60 void TextPainter::draw(int x, int y, char_type c)
62 //cerr << "drawing char '" << c << "' at " << x << ',' << y << endl;
68 void TextPainter::show(odocstream & os, int offset) const
71 for (int j = 0; j <= ymax_; ++j) {
72 for (int i = 0; i < offset; ++i)
74 for (int i = 0; i < xmax_; ++i)