MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
Mezzanine::UI::LayoutStrategy Class Reference

This is a base class for the algorithms used by QuadRenderables to determine how they should update their dimensions. More...

#include <layoutstrategy.h>

+ Inheritance diagram for Mezzanine::UI::LayoutStrategy:

Public Types

typedef std::list< Widget * > ChildContainer
 Basic container type for QuadRenderable storage by this class.
 
typedef ChildContainer::iterator ChildIterator
 Iterator type for QuadRenderable instances stored by this class.
 
typedef
ChildContainer::const_iterator 
ConstChildIterator
 Const Iterator type for QuadRenderable instances stored by this class.
 

Public Member Functions

 LayoutStrategy ()
 Class constructor.
 
virtual ~LayoutStrategy ()
 Class destructor.
 
virtual void CheckChildAspectRatio (const Vector2 &OldChildSize, Vector2 &NewChildSize, QuadRenderable *Child)
 Preserves a child's aspect ratio if it is configured to do so. More...
 
virtual void ClampChildToMaxSize (const Rect &NewSelfRect, Vector2 &NewChildSize, QuadRenderable *Child)
 Clamps the updated size to the set maximum size for the child quad. More...
 
virtual void ClampChildToMinSize (const Rect &NewSelfRect, Vector2 &NewChildSize, QuadRenderable *Child)
 Clamps the updated size to the set minimum size for the child quad. More...
 
virtual Real HandleChildHorizontalPositioning (const Rect &OldSelfRect, const Rect &NewSelfRect, const Vector2 &NewChildSize, QuadRenderable *Child)
 Handles the positioning of a child on the X axis. More...
 
virtual Real HandleChildHorizontalSizing (const Rect &OldSelfRect, const Rect &NewSelfRect, const Real PrevAxisResult, QuadRenderable *Child)
 Handles the sizing of a child on the X axis. More...
 
virtual Vector2 HandleChildPositioning (const Rect &OldSelfRect, const Rect &NewSelfRect, const Vector2 &NewChildSize, QuadRenderable *Child)
 Handles the positioning of a child that needs it's dimensions updated. More...
 
virtual Vector2 HandleChildSizing (const Rect &OldSelfRect, const Rect &NewSelfRect, QuadRenderable *Child)
 Handles the sizing of a child that needs it's dimensions updated. More...
 
virtual Real HandleChildVerticalPositioning (const Rect &OldSelfRect, const Rect &NewSelfRect, const Vector2 &NewChildSize, QuadRenderable *Child)
 Handles the positioning of a child on the Y axis. More...
 
virtual Real HandleChildVerticalSizing (const Rect &OldSelfRect, const Rect &NewSelfRect, const Real PrevAxisResult, QuadRenderable *Child)
 Handles the sizing of a child on the Y axis. More...
 
virtual void Layout (const Rect &OldSelfRect, const Rect &NewSelfRect, const ChildContainer &ChildQuads)
 Updates the dimensions of a collection of QuadRenderables. More...
 

Detailed Description

This is a base class for the algorithms used by QuadRenderables to determine how they should update their dimensions.

This class has default and implementations for the algorithms that handle the sizing, positioning, as well as how and when those methods are called. These methods can be overridden or expanded upon as neccessary to achieve any specific effect a particular Widget or QuadRenderable may need.

It is important to note that the base LayoutStrategy class does not contain any support for expanding widgets that use the "SR_Fill_Available" size rule.

Definition at line 59 of file layoutstrategy.h.

Member Function Documentation

void Mezzanine::UI::LayoutStrategy::CheckChildAspectRatio ( const Vector2 OldChildSize,
Vector2 NewChildSize,
QuadRenderable Child 
)
virtual

Preserves a child's aspect ratio if it is configured to do so.

Parameters
OldChildSizeThe previous size of the child prior to the dimension update.
NewChildSizeThe updated and current dimensions of the calling quad.
ChildThe child to update.

Definition at line 218 of file layoutstrategy.cpp.

void Mezzanine::UI::LayoutStrategy::ClampChildToMaxSize ( const Rect NewSelfRect,
Vector2 NewChildSize,
QuadRenderable Child 
)
virtual

Clamps the updated size to the set maximum size for the child quad.

Parameters
NewSelfRectThe updated and current dimensions of the calling quad.
NewChildSizeThe updated size to clamp to the set maximum size for the child.
ChildThe child to update.

Definition at line 254 of file layoutstrategy.cpp.

void Mezzanine::UI::LayoutStrategy::ClampChildToMinSize ( const Rect NewSelfRect,
Vector2 NewChildSize,
QuadRenderable Child 
)
virtual

Clamps the updated size to the set minimum size for the child quad.

Parameters
NewSelfRectThe updated and current dimensions of the calling quad.
NewChildSizeThe updated size to clamp to the set minimum size for the child.
ChildThe child to update.

Definition at line 242 of file layoutstrategy.cpp.

Real Mezzanine::UI::LayoutStrategy::HandleChildHorizontalPositioning ( const Rect OldSelfRect,
const Rect NewSelfRect,
const Vector2 NewChildSize,
QuadRenderable Child 
)
virtual

Handles the positioning of a child on the X axis.

Parameters
OldSelfRectThe previous dimensions of the calling quad prior to it's dimensions being updated.
NewSelfRectThe updated and current dimensions of the calling quad.
NewChildSizeThe post-update size of the child being updated.
ChildThe child to update.
Returns
Returns the childs updated position on the X axis.

Definition at line 107 of file layoutstrategy.cpp.

Real Mezzanine::UI::LayoutStrategy::HandleChildHorizontalSizing ( const Rect OldSelfRect,
const Rect NewSelfRect,
const Real  PrevAxisResult,
QuadRenderable Child 
)
virtual

Handles the sizing of a child on the X axis.

Parameters
OldSelfRectThe previous dimensions of the calling quad prior to it's dimensions being updated.
NewSelfRectThe updated and current dimensions of the calling quad.
PrevAxisResultThe result of the previous axis, in case the settings require it.
ChildThe child to update.
Returns
Returns the childs updated size on the X axis.

Definition at line 190 of file layoutstrategy.cpp.

Vector2 Mezzanine::UI::LayoutStrategy::HandleChildPositioning ( const Rect OldSelfRect,
const Rect NewSelfRect,
const Vector2 NewChildSize,
QuadRenderable Child 
)
virtual

Handles the positioning of a child that needs it's dimensions updated.

Parameters
OldSelfRectThe previous dimensions of the calling quad prior to it's dimensions being updated.
NewSelfRectThe updated and current dimensions of the calling quad.
NewChildSizeThe post-update size of the child being updated.
ChildThe child to update.
Returns
Returns the childs updated position.

Definition at line 96 of file layoutstrategy.cpp.

Vector2 Mezzanine::UI::LayoutStrategy::HandleChildSizing ( const Rect OldSelfRect,
const Rect NewSelfRect,
QuadRenderable Child 
)
virtual

Handles the sizing of a child that needs it's dimensions updated.

Parameters
OldSelfRectThe previous dimensions of the calling quad prior to it's dimensions being updated.
NewSelfRectThe updated and current dimensions of the calling quad.
ChildThe child to update.
Returns
Returns the childs updated size.

Definition at line 155 of file layoutstrategy.cpp.

Real Mezzanine::UI::LayoutStrategy::HandleChildVerticalPositioning ( const Rect OldSelfRect,
const Rect NewSelfRect,
const Vector2 NewChildSize,
QuadRenderable Child 
)
virtual

Handles the positioning of a child on the Y axis.

Parameters
OldSelfRectThe previous dimensions of the calling quad prior to it's dimensions being updated.
NewSelfRectThe updated and current dimensions of the calling quad.
NewChildSizeThe post-update size of the child being updated.
ChildThe child to update.
Returns
Returns the childs updated position on the Y axis.

Definition at line 131 of file layoutstrategy.cpp.

Real Mezzanine::UI::LayoutStrategy::HandleChildVerticalSizing ( const Rect OldSelfRect,
const Rect NewSelfRect,
const Real  PrevAxisResult,
QuadRenderable Child 
)
virtual

Handles the sizing of a child on the Y axis.

Parameters
OldSelfRectThe previous dimensions of the calling quad prior to it's dimensions being updated.
NewSelfRectThe updated and current dimensions of the calling quad.
PrevAxisResultThe result of the previous axis, in case the settings require it.
ChildThe child to update.
Returns
Returns the childs updated size on the Y axis.

Definition at line 204 of file layoutstrategy.cpp.

void Mezzanine::UI::LayoutStrategy::Layout ( const Rect OldSelfRect,
const Rect NewSelfRect,
const ChildContainer ChildQuads 
)
virtual

Updates the dimensions of a collection of QuadRenderables.

Parameters
OldSelfRectThe pre-update dimensions of the calling quad.
NewSelfRectThe post-update dimensions of the calling quad.
ChildQuadsA container of all the Quads to be updated by this strategy.

Reimplemented in Mezzanine::UI::HorizontalLayoutStrategy, and Mezzanine::UI::VerticalLayoutStrategy.

Definition at line 66 of file layoutstrategy.cpp.


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