ContRap-Core
|
Class XMLLayoutBox is an atomic layout item. More...
#include <xmllayout.h>
Public Types | |
enum | Type { TEXT, NODE } |
Type of the box. More... | |
enum | Alignment { LEFT, CENTER, RIGHT, TOP, BOTTOM } |
Alignment type. More... | |
enum | Layout { VERTICAL, HORIZONTAL, GRID } |
Layout of the box. More... | |
Public Member Functions | |
XMLLayoutBox (XMLGlyphPrinter *printer, XMLLayoutBox *parent=0) | |
Creates the layout box. | |
virtual | ~XMLLayoutBox () |
Cleans up the memory. | |
void | set_text (const std::string &text) |
Sets the formatted text. | |
const std::string & | get_text () |
Return the text. | |
void | layout () |
Computes the size of the box according to the sizes of the children. | |
virtual void | clear () |
Removes all the layout children. | |
int | get_width () const |
Returns the width of the box without recomputing the width recursively. | |
int | get_height () const |
Returns the height of the box without recomputing the height recursively. | |
int | get_depth () |
Returns the number of parent items until root. | |
void | set_alignment (Alignment alignment) |
Sets the alignment of the glyph in the box. | |
void | print_layout () |
Prints the layout to the device defined by the printer. | |
Protected Attributes | |
Type | type |
Type of the box. | |
Alignment | alignment |
Alignment. | |
std::string | text |
Formated text of the box. | |
int | x |
Position of the upper-left corner. | |
int | y |
int | width |
Width and height. | |
int | height |
XMLGlyphPrinter * | printer |
Glyph printer implementation. | |
XMLLayoutBox * | parent |
Parent box. |
Class XMLLayoutBox is an atomic layout item.
A layout is tightly connected with the corresponding XMLGlyphPrinter. When the printer changes its values the layout also changes its appearence.
crp::XMLLayoutBox::XMLLayoutBox | ( | XMLGlyphPrinter * | printer, |
XMLLayoutBox * | parent = 0 |
||
) |
Creates the layout box.
text | Text of the box |
orientation | Orientation of the box |
parent | Parent box |
virtual crp::XMLLayoutBox::~XMLLayoutBox | ( | ) | [inline, virtual] |
Cleans up the memory.
virtual void crp::XMLLayoutBox::clear | ( | ) | [virtual] |
Removes all the layout children.
int crp::XMLLayoutBox::get_depth | ( | ) | [inline] |
Returns the number of parent items until root.
int crp::XMLLayoutBox::get_height | ( | ) | const [inline] |
Returns the height of the box without recomputing the height recursively.
Use the layout()-method to recompute the height.
const std::string& crp::XMLLayoutBox::get_text | ( | ) | [inline] |
Return the text.
int crp::XMLLayoutBox::get_width | ( | ) | const [inline] |
Returns the width of the box without recomputing the width recursively.
Use the layout()-method to recompute the width.
void crp::XMLLayoutBox::layout | ( | ) |
Computes the size of the box according to the sizes of the children.
void crp::XMLLayoutBox::print_layout | ( | ) |
Prints the layout to the device defined by the printer.
void crp::XMLLayoutBox::set_alignment | ( | Alignment | alignment | ) | [inline] |
Sets the alignment of the glyph in the box.
alignment | New alignment |
void crp::XMLLayoutBox::set_text | ( | const std::string & | text | ) | [inline] |
Sets the formatted text.
text | Text to layout |
Alignment crp::XMLLayoutBox::alignment [protected] |
Alignment.
int crp::XMLLayoutBox::height [protected] |
XMLLayoutBox* crp::XMLLayoutBox::parent [protected] |
Parent box.
XMLGlyphPrinter* crp::XMLLayoutBox::printer [protected] |
Glyph printer implementation.
std::string crp::XMLLayoutBox::text [protected] |
Formated text of the box.
Type crp::XMLLayoutBox::type [protected] |
Type of the box.
int crp::XMLLayoutBox::width [protected] |
Width and height.
int crp::XMLLayoutBox::x [protected] |
Position of the upper-left corner.
int crp::XMLLayoutBox::y [protected] |