|
ContRap-Core
|
Class LayoutBox is an atomic layout item. More...
#include <xmltextlayout.h>
Public Types | |
| enum | Type { TEXT, VERTICAL, HORIZONTAL, VERTICAL_GLYPH, HORIZONTAL_GLYPH } |
Type of the box. More... | |
| enum | Alignment { LEFT, CENTER, RIGHT, TOP, BOTTOM } |
Alignment type. More... | |
Public Member Functions | |
| LayoutBox (const std::string &text="", Type orientation=HORIZONTAL, LayoutBox *parent=0) | |
| Creates the layout box. | |
| virtual | ~LayoutBox () |
| Cleans up the memory. | |
| void | set_text (const std::string &text) |
| Sets the formatted text. | |
| const std::string & | get_text () |
| Return the text. | |
| void | set_glyphs (const std::vector< std::string > &glyphs) |
| Sets the glyph symbols for the given box. | |
| 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. | |
| int | get_height () const |
| Returns the height. | |
| void | set_width (int width) |
| Sets the width. | |
| void | set_height (int height) |
| Sets the height. | |
| 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. | |
| std::string | to_string () |
| Prints the layout to a string. | |
Protected Member Functions | |
| void | to_string_rec (UTF8Field &field, int global_x, int global_y) |
| Recursive printer. | |
Protected Attributes | |
| Type | type |
| Orientation. | |
| 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 |
| std::vector< std::string > | glyphs |
| Special glyphs. | |
| LayoutBox * | parent |
| Parent box. | |
| enum crp::LayoutBox::Type |
| crp::LayoutBox::LayoutBox | ( | const std::string & | text = "", |
| Type | orientation = HORIZONTAL, |
||
| LayoutBox * | parent = 0 |
||
| ) |
Creates the layout box.
| text | Text of the box |
| orientation | Orientation of the box |
| parent | Parent box |
| virtual crp::LayoutBox::~LayoutBox | ( | ) | [inline, virtual] |
Cleans up the memory.
| virtual void crp::LayoutBox::clear | ( | ) | [virtual] |
Removes all the layout children.
| int crp::LayoutBox::get_depth | ( | ) | [inline] |
Returns the number of parent items until root.
| int crp::LayoutBox::get_height | ( | ) | const [inline] |
Returns the height.
| const std::string& crp::LayoutBox::get_text | ( | ) | [inline] |
Return the text.
| int crp::LayoutBox::get_width | ( | ) | const [inline] |
Returns the width.
| void crp::LayoutBox::layout | ( | ) |
Computes the size of the box according to the sizes of the children.
| void crp::LayoutBox::set_alignment | ( | Alignment | alignment | ) | [inline] |
Sets the alignment of the glyph in the box.
| alignment | New alignment |
| void crp::LayoutBox::set_glyphs | ( | const std::vector< std::string > & | glyphs | ) | [inline] |
Sets the glyph symbols for the given box.
| glyphs | Glyphs interpretation is context dependent |
| void crp::LayoutBox::set_height | ( | int | height | ) | [inline] |
Sets the height.
| height | Height of the box |
| void crp::LayoutBox::set_text | ( | const std::string & | text | ) |
Sets the formatted text.
| text | Text to layout |
| void crp::LayoutBox::set_width | ( | int | width | ) | [inline] |
Sets the width.
| width | Width of the box |
| std::string crp::LayoutBox::to_string | ( | ) |
Prints the layout to a string.
| void crp::LayoutBox::to_string_rec | ( | UTF8Field & | field, |
| int | global_x, | ||
| int | global_y | ||
| ) | [protected] |
Recursive printer.
Alignment crp::LayoutBox::alignment [protected] |
Alignment.
std::vector<std::string> crp::LayoutBox::glyphs [protected] |
Special glyphs.
int crp::LayoutBox::height [protected] |
LayoutBox* crp::LayoutBox::parent [protected] |
Parent box.
std::string crp::LayoutBox::text [protected] |
Formated text of the box.
Type crp::LayoutBox::type [protected] |
Orientation.
int crp::LayoutBox::width [protected] |
Width and height.
int crp::LayoutBox::x [protected] |
Position of the upper-left corner.
int crp::LayoutBox::y [protected] |
1.7.3