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

crp::XMLLayoutBox Class Reference

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
XMLGlyphPrinterprinter
 Glyph printer implementation.
XMLLayoutBoxparent
 Parent box.

Detailed Description

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.


Member Enumeration Documentation

Alignment type.

Enumerator:
LEFT 
CENTER 
RIGHT 
TOP 
BOTTOM 

Layout of the box.

Enumerator:
VERTICAL 
HORIZONTAL 
GRID 

Type of the box.

Enumerator:
TEXT 
NODE 

Constructor & Destructor Documentation

crp::XMLLayoutBox::XMLLayoutBox ( XMLGlyphPrinter printer,
XMLLayoutBox parent = 0 
)

Creates the layout box.

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

Cleans up the memory.


Member Function Documentation

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.

Returns:
Depth of the current node
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.

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

Return the text.

Returns:
Current 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.

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

Parameters:
alignmentNew alignment
void crp::XMLLayoutBox::set_text ( const std::string &  text) [inline]

Sets the formatted text.

Parameters:
textText to layout

Field Documentation

Alignment.

int crp::XMLLayoutBox::height [protected]

Parent box.

Glyph printer implementation.

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

Formated text of the box.

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]

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