Rocket::Core::LayoutBlockBox Class Reference

#include <LayoutBlockBox.h>

Collaboration diagram for Rocket::Core::LayoutBlockBox:

Public Types

enum  FormattingContext { BLOCK, INLINE }
enum  CloseResult { OK, LAYOUT_SELF, LAYOUT_PARENT }

Public Member Functions

 LayoutBlockBox (LayoutEngine *layout_engine, LayoutBlockBox *parent, Element *element)
 LayoutBlockBox (LayoutEngine *layout_engine, LayoutBlockBox *parent)
 ~LayoutBlockBox ()
 Releases the block box.
CloseResult Close ()
bool CloseBlockBox (LayoutBlockBox *child)
LayoutInlineBoxCloseLineBox (LayoutLineBox *child, LayoutInlineBox *overflow, LayoutInlineBox *overflow_chain)
LayoutBlockBoxAddBlockElement (Element *element)
LayoutInlineBoxAddInlineElement (Element *element, const Box &box)
void AddBreak ()
 Adds a line-break to this block box.
bool AddFloatElement (Element *element)
 Adds an element to this block box to be handled as a floating element.
void AddAbsoluteElement (Element *element)
void CloseAbsoluteElements ()
 Formats, sizes, and positions all absolute elements in this block.
void PositionBox (Vector2f &box_position, float top_margin=0, int clear_property=0) const
void PositionBlockBox (Vector2f &box_position, const Box &box, int clear_property) const
void PositionLineBox (Vector2f &box_position, float &box_width, bool &wrap_content, const Vector2f &dimensions) const
ElementGetElement () const
LayoutBlockBoxGetParent () const
const Vector2fGetPosition () const
LayoutBlockBoxGetOffsetParent () const
LayoutBlockBoxGetOffsetRoot () const
BoxGetBox ()
const BoxGetBox () const
void * operator new (size_t size)
void operator delete (void *chunk)

Data Structures

struct  AbsoluteElement

Detailed Description

Author:
Peter Curry

Constructor & Destructor Documentation

Rocket::Core::LayoutBlockBox::LayoutBlockBox ( LayoutEngine layout_engine,
LayoutBlockBox parent,
Element element 
)

Creates a new block box for rendering a block element.

Parameters:
layout_engine[in] The layout engine that created this block box.
parent[in] The parent of this block box. This will be NULL for the root element.
element[in] The element this block box is laying out.

Rocket::Core::LayoutBlockBox::LayoutBlockBox ( LayoutEngine layout_engine,
LayoutBlockBox parent 
)

Creates a new block box in an inline context.

Parameters:
layout_engine[in] The layout engine that created this block box.
parent[in] The parent of this block box.


Member Function Documentation

LayoutBlockBox::CloseResult Rocket::Core::LayoutBlockBox::Close (  ) 

Closes the box. This will determine the element's height (if it was unspecified).

Returns:
The result of the close; this may request a reformat of this element or our parent.

bool Rocket::Core::LayoutBlockBox::CloseBlockBox ( LayoutBlockBox child  ) 

Called by a closing block box child. Increments the cursor.

Parameters:
child[in] The closing child block box.
Returns:
False if the block box caused an automatic vertical scrollbar to appear, forcing an entire reformat of the block box.

LayoutInlineBox * Rocket::Core::LayoutBlockBox::CloseLineBox ( LayoutLineBox child,
LayoutInlineBox overflow,
LayoutInlineBox overflow_chain 
)

Called by a closing line box child. Increments the cursor, and creates a new line box to fit the overflow (if any).

Parameters:
child[in] The closing child line box.
overflow[in] The overflow from the closing line box. May be NULL if there was no overflow.
overflow_chain[in] The end of the chained hierarchy to be spilled over to the new line, as the parent to the overflow box (if one exists).
Returns:
If the line box had overflow, this will be the last inline box created by the overflow.

LayoutBlockBox * Rocket::Core::LayoutBlockBox::AddBlockElement ( Element element  ) 

Adds a new block element to this block-context box.

Parameters:
element[in] The new block element.
placed[in] True if the element is to be placed, false otherwise.
Returns:
The block box representing the element. Once the element's children have been positioned, Close() must be called on it.

LayoutInlineBox * Rocket::Core::LayoutBlockBox::AddInlineElement ( Element element,
const Box box 
)

Adds a new inline element to this inline-context box.

Parameters:
element[in] The new inline element.
box[in] The box defining the element's bounds.
Returns:
The inline box representing the element. Once the element's children have been positioned, Close() must be called on it.

void Rocket::Core::LayoutBlockBox::AddAbsoluteElement ( Element element  ) 

Adds an element to this block box to be handled as an absolutely-positioned element. This element will be laid out, sized and positioned appropriately once this box is finished. This should only be called on boxes rendering in a block-context.

Parameters:
element[in] The element to be positioned absolutely within this block box.

void Rocket::Core::LayoutBlockBox::PositionBox ( Vector2f box_position,
float  top_margin = 0,
int  clear_property = 0 
) const

Returns the offset from the top-left corner of this box's offset element the next child box will be positioned at.

Parameters:
[out] box_position The box cursor position.
[in] top_margin The top margin of the box. This will be collapsed as appropriate against other block boxes.
[in] clear_property The value of the underlying element's clear property.

void Rocket::Core::LayoutBlockBox::PositionBlockBox ( Vector2f box_position,
const Box box,
int  clear_property 
) const

Returns the offset from the top-left corner of this box's offset element the next child block box, of the given dimensions, will be positioned at. This will include the margins on the new block box.

Parameters:
[out] box_position The block box cursor position.
[in] box The dimensions of the new box.
[in] clear_property The value of the underlying element's clear property.

void Rocket::Core::LayoutBlockBox::PositionLineBox ( Vector2f box_position,
float &  box_width,
bool &  wrap_content,
const Vector2f dimensions 
) const

Returns the offset from the top-left corner of this box for the next line.

Parameters:
box_position[out] The line box position.
box_width[out] The available width for the line box.
wrap_content[out] Set to true if the line box should grow to fit inline boxes, false if it should wrap them.
dimensions[in] The minimum dimensions of the line.

Element * Rocket::Core::LayoutBlockBox::GetElement (  )  const

Returns the block box's element.

Returns:
The block box's element.

LayoutBlockBox * Rocket::Core::LayoutBlockBox::GetParent (  )  const

Returns the block box's parent.

Returns:
The block box's parent.

const Vector2f & Rocket::Core::LayoutBlockBox::GetPosition (  )  const

Returns the position of the block box, relative to its parent's content area.

Returns:
The relative position of the block box.

LayoutBlockBox * Rocket::Core::LayoutBlockBox::GetOffsetParent (  )  const

Returns the block box against which all positions of boxes in the hierarchy are set relative to.

Returns:
This box's offset parent.

LayoutBlockBox * Rocket::Core::LayoutBlockBox::GetOffsetRoot (  )  const

Returns the block box against which all positions of boxes in the hierarchy are calculated relative to.

Returns:
This box's offset root.

Box & Rocket::Core::LayoutBlockBox::GetBox (  ) 

Returns the block box's dimension box.

Returns:
The block box's dimension box.

const Box & Rocket::Core::LayoutBlockBox::GetBox (  )  const

Returns the block box's dimension box.

Returns:
The block box's dimension box.


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