ContRap-Core
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

crp::LayoutBox Class Reference

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.
LayoutBoxparent
 Parent box.

Detailed Description

Class LayoutBox is an atomic layout item.


Member Enumeration Documentation

Alignment type.

Enumerator:
LEFT 
CENTER 
RIGHT 
TOP 
BOTTOM 

Type of the box.

Enumerator:
TEXT 
VERTICAL 
HORIZONTAL 
VERTICAL_GLYPH 
HORIZONTAL_GLYPH 

Constructor & Destructor Documentation

crp::LayoutBox::LayoutBox ( const std::string &  text = "",
Type  orientation = HORIZONTAL,
LayoutBox parent = 0 
)

Creates the layout box.

Parameters:
textText of the box
orientationOrientation of the box
parentParent box
virtual crp::LayoutBox::~LayoutBox ( ) [inline, virtual]

Cleans up the memory.


Member Function Documentation

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.

Returns:
Depth of the current node
int crp::LayoutBox::get_height ( ) const [inline]

Returns the height.

Returns:
Width of the box
const std::string& crp::LayoutBox::get_text ( ) [inline]

Return the text.

Returns:
Current text
int crp::LayoutBox::get_width ( ) const [inline]

Returns the width.

Returns:
Width of the box
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.

Parameters:
alignmentNew alignment
void crp::LayoutBox::set_glyphs ( const std::vector< std::string > &  glyphs) [inline]

Sets the glyph symbols for the given box.

Parameters:
glyphsGlyphs interpretation is context dependent
void crp::LayoutBox::set_height ( int  height) [inline]

Sets the height.

Parameters:
heightHeight of the box
void crp::LayoutBox::set_text ( const std::string &  text)

Sets the formatted text.

Parameters:
textText to layout
void crp::LayoutBox::set_width ( int  width) [inline]

Sets the width.

Parameters:
widthWidth of the box
std::string crp::LayoutBox::to_string ( )

Prints the layout to a string.

Returns:
String with the layout
void crp::LayoutBox::to_string_rec ( UTF8Field field,
int  global_x,
int  global_y 
) [protected]

Recursive printer.


Field Documentation

Alignment.

std::vector<std::string> crp::LayoutBox::glyphs [protected]

Special glyphs.

int crp::LayoutBox::height [protected]

Parent box.

std::string crp::LayoutBox::text [protected]

Formated text of the box.

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]

The documentation for this class was generated from the following file: