Pyro higlevel API
Classes | Public Member Functions | Protected Member Functions | Friends | List of all members
os::LayoutNode Class Reference

Layout node. More...

Inheritance diagram for os::LayoutNode:
os::HLayoutNode os::LayoutSpacer os::VLayoutNode os::DateView::MonthView os::DateView::YearView os::HLayoutSpacer os::VLayoutSpacer

Classes

class  Private
 

Public Member Functions

 LayoutNode (const String &cName, float vWeight=1.0f, LayoutNode *pcParent=NULL, View *pcView=NULL)
 
virtual ~LayoutNode ()
 
virtual void SetView (View *pcView)
 
ViewGetView () const
 
virtual void Layout ()
 
virtual void SetBorders (const Rect &cBorder)
 
virtual Rect GetBorders () const
 
void ExtendMinSize (const Point &cMinSize)
 
void LimitMaxSize (const Point &cMaxSize)
 
void ExtendMaxSize (const Point &cMaxSize)
 
float GetWeight () const
 
void SetWeight (float vWeight)
 
virtual void SetFrame (const Rect &cFrame)
 
virtual Rect GetFrame () const
 
virtual Rect GetBounds () const
 
Rect GetAbsFrame () const
 
void SetHAlignment (alignment eAlignment)
 
void SetVAlignment (alignment eAlignment)
 
alignment GetHAlignment () const
 
alignment GetVAlignment () const
 
void AdjustPrefSize (Point *pcMinSize, Point *pcMaxSize)
 
virtual Point GetPreferredSize (bool bLargest)
 
void AddChild (LayoutNode *pcChild)
 
LayoutNodeAddChild (View *pcChild, float vWeight=1.0f)
 
void RemoveChild (LayoutNode *pcChild)
 
void RemoveChild (View *pcChild)
 
String GetName () const
 
const std::vector< LayoutNode * > & GetChildList () const
 
LayoutNodeGetParent () const
 
LayoutViewGetLayoutView () const
 
LayoutNodeFindNode (const String &cName, bool bRecursive=true, bool bIncludeSelf=false)
 
void SameWidth (const char *pzName1,...)
 
void SameHeight (const char *pzName1,...)
 
void SetBorders (const Rect &cBorders, const char *pzFirstName,...)
 
void SetWeights (float vWeight, const char *pzFirstName,...)
 
void SetHAlignments (alignment eAlign, const char *pzFirstName,...)
 
void SetVAlignments (alignment eAlign, const char *pzFirstName,...)
 
void AddToWidthRing (LayoutNode *pcRing)
 
void AddToHeightRing (LayoutNode *pcRing)
 

Protected Member Functions

virtual Point CalculatePreferredSize (bool bLargest)
 

Friends

class LayoutView
 

Detailed Description

Description:
This class is a base class for those classes that arrange GUI items by a specific algorithm, such as horizontal layout or vertical layout. Unless you intend to create such an algorithm yourself, you will not use this class directly, but instead one of its subclasses (HLayoutNode or VLayoutNode).
Example:
HLayoutNode* pcRoot = HLayoutNode( "pcRoot" );
pcRoot->AddChild( new Button( Rect(), "Button1", "One", new Message( ID_ONE ) ), 2.0 );
pcRoot->AddChild( new HLayoutSpacer( "Spacer" ) );
pcRoot->AddChild( new Button( Rect(), "Button2", "Two", new Message( ID_TWO ) ), 1.0 );
LayoutView* pcLayoutView = new LayoutView( pcMyWindow->GetBounds(), "pcLayoutView" );
pcLayoutView->SetRoot( pcRoot );
pcMyWindow->AddChild( pcLayoutView );
This example will result in a layout like this:
[One][Two]
If the window is made larger, the weights and the spacer will cause the layout to look like this:
[ One ] [Two]
That is, "One" has twice the weight of the two others, thus it will get twice the amount of excess screen space.
See Also
VLayoutNode, HLayoutNode, LayoutSpacer, SameWidth, SameHeight
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Constructor & Destructor Documentation

LayoutNode::LayoutNode ( const String cName,
float  vWeight = 1.0f,
LayoutNode pcParent = NULL,
View pcView = NULL 
)
LayoutNode::~LayoutNode ( )
virtual

Member Function Documentation

void LayoutNode::AddChild ( LayoutNode pcChild)
LayoutNode * LayoutNode::AddChild ( View pcChild,
float  vWeight = 1.0f 
)
void LayoutNode::AddToHeightRing ( LayoutNode pcRing)
void LayoutNode::AddToWidthRing ( LayoutNode pcRing)
void LayoutNode::AdjustPrefSize ( Point pcMinSize,
Point pcMaxSize 
)
Point LayoutNode::CalculatePreferredSize ( bool  bLargest)
protectedvirtual
void LayoutNode::ExtendMaxSize ( const Point cMaxSize)
void LayoutNode::ExtendMinSize ( const Point cMinSize)
LayoutNode * LayoutNode::FindNode ( const String cName,
bool  bRecursive = true,
bool  bIncludeSelf = false 
)
Rect LayoutNode::GetAbsFrame ( ) const
Rect LayoutNode::GetBorders ( ) const
virtual
Rect LayoutNode::GetBounds ( void  ) const
virtual
const std::vector< LayoutNode * > & LayoutNode::GetChildList ( ) const
Rect LayoutNode::GetFrame ( ) const
virtual

References os::LayoutNode::Private::m_cFrame.

Referenced by GetBounds().

alignment LayoutNode::GetHAlignment ( ) const
LayoutView * LayoutNode::GetLayoutView ( ) const
String LayoutNode::GetName ( ) const
LayoutNode * LayoutNode::GetParent ( ) const
Point LayoutNode::GetPreferredSize ( bool  bLargest)
virtual
alignment LayoutNode::GetVAlignment ( ) const
View * LayoutNode::GetView ( ) const
float LayoutNode::GetWeight ( ) const
void LayoutNode::Layout ( )
virtual
void LayoutNode::LimitMaxSize ( const Point cMaxSize)
void LayoutNode::RemoveChild ( LayoutNode pcChild)
void LayoutNode::RemoveChild ( View pcChild)
void LayoutNode::SameHeight ( const char *  pzName1,
  ... 
)
void LayoutNode::SameWidth ( const char *  pzName1,
  ... 
)
void LayoutNode::SetBorders ( const Rect cBorder)
virtual
void LayoutNode::SetBorders ( const Rect cBorders,
const char *  pzFirstName,
  ... 
)

References FOR_EACH_NAME, and SetBorders().

void LayoutNode::SetFrame ( const Rect cFrame)
virtual
void LayoutNode::SetHAlignment ( alignment  eAlignment)
void LayoutNode::SetHAlignments ( alignment  eAlign,
const char *  pzFirstName,
  ... 
)

References FOR_EACH_NAME, and SetHAlignment().

void LayoutNode::SetVAlignment ( alignment  eAlignment)
void LayoutNode::SetVAlignments ( alignment  eAlign,
const char *  pzFirstName,
  ... 
)

References FOR_EACH_NAME, and SetVAlignment().

void LayoutNode::SetView ( View pcView)
virtual
void LayoutNode::SetWeight ( float  vWeight)
void LayoutNode::SetWeights ( float  vWeight,
const char *  pzFirstName,
  ... 
)

References FOR_EACH_NAME, and SetWeight().

Friends And Related Function Documentation

friend class LayoutView
friend