1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
/*
** Copyright 2004-2011, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#ifndef cursesmultilinelabel_H
#define cursesmultilinelabel_H
#include "mycurses.H"
////////////////////////////////////////////////////////////////////////
//
// A multiline label that's word-wrapped to a given width.
// A plain, garden variety, label. Centered, or right-aligned, perhaps.
//
// A lot of work, just for this
class CursesMultilineLabel : public Curses {
std::vector<unicode_char> text;
std::vector< std::vector<unicode_char> > lines;
protected:
int width;
Curses::CursesAttr attribute;
public:
void init(); // Subclass must call init() in constructor.
CursesMultilineLabel(CursesContainer *parent,
std::string textArg,
Curses::CursesAttr attributeArg
=Curses::CursesAttr());
~CursesMultilineLabel();
void setRow(int row);
void setCol(int col);
void resized();
void setAlignment(Alignment alignment);
void setAttribute(Curses::CursesAttr attr);
virtual void setText(std::string textArg);
int getWidth() const;
int getHeight() const;
void setWidth(int w);
void draw();
void erase();
};
#endif
|