2002-03-18 11:45:53 +00:00
|
|
|
#ifndef TEXTPAINTER_H
|
|
|
|
#define TEXTPAINTER_H
|
|
|
|
|
|
|
|
#include <vector>
|
2002-03-19 16:55:58 +00:00
|
|
|
#include <iosfwd>
|
2002-03-18 11:45:53 +00:00
|
|
|
|
|
|
|
class TextPainter {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
TextPainter(int xmax, int ymax);
|
|
|
|
///
|
|
|
|
void draw(int x, int y, char const * str);
|
2002-03-19 16:55:58 +00:00
|
|
|
///
|
|
|
|
void draw(int x, int y, char c);
|
|
|
|
///
|
2002-07-11 15:04:43 +00:00
|
|
|
void show(std::ostream & os, int offset = 0) const;
|
2002-03-19 16:55:58 +00:00
|
|
|
///
|
|
|
|
int textheight() const { return ymax_; }
|
|
|
|
///
|
|
|
|
void horizontalLine(int x, int y, int len, char c = '-');
|
|
|
|
///
|
|
|
|
void verticalLine(int x, int y, int len, char c = '|');
|
2002-03-18 11:45:53 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
typedef std::vector<char> data_type;
|
|
|
|
///
|
|
|
|
char at(int x, int y) const;
|
|
|
|
///
|
|
|
|
char & at(int x, int y);
|
|
|
|
|
2002-03-19 16:55:58 +00:00
|
|
|
/// xsize of the painter area
|
2002-03-18 11:45:53 +00:00
|
|
|
int xmax_;
|
2002-03-19 16:55:58 +00:00
|
|
|
/// ysize of the painter area
|
2002-03-18 11:45:53 +00:00
|
|
|
int ymax_;
|
2002-03-19 16:55:58 +00:00
|
|
|
/// the image
|
|
|
|
data_type data_;
|
2002-03-18 11:45:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|