Guiliani  Version 2.4 revision 5970 (build 3)
CGUILayouter Class Referenceabstract

#include <GUILayouter.h>

Inheritance diagram for CGUILayouter:

Public Types

enum  eMovedEdges_t {
  CHANGED_WIDTH, CHANGED_HEIGHT, CHANGED_RELXPOS, CHANGED_RELYPOS,
  CHANGED_EDGE_ALL
}
 Enumerate possible reasons for calling layout,. More...
 

Public Member Functions

virtual ~CGUILayouter ()
 Destructor. More...
 
virtual void DoLayout (eMovedEdges_t eMovedEdges)=0
 
CGUIObjectGetAssociatedObject () const
 
virtual void InitLayouter (eMovedEdges_t eMovedEdges)
 
virtual eC_Bool IsDependentOnParentSize ()=0
 
virtual eC_Bool IsGroupLayouter () const
 
virtual void SetAssociatedObject (CGUIObject *const pObject)
 
- Public Member Functions inherited from CGUIStreamableObject
const eC_String & GetXMLTag () const
 
virtual void ReadFromStream ()
 
void SetXMLTag (const eC_String &kXMLTag)
 
virtual void WriteToStream (const eC_Bool bWriteClassID=false)
 

Static Public Attributes

static const eC_Char XMLTAG_LAYOUTERCLASSID [] = "LayouterClassID"
 XML tag to be used when writing a layouter class ID into a stream.
 
- Static Public Attributes inherited from CGUIStreamableObject
static const eC_Char XMLTAG_CLASSVERSION [] = "ClassVersion"
 

Protected Member Functions

 CGUILayouter (CGUIObject *const pObject=NULL)
 
- Protected Member Functions inherited from CGUIStreamableObject
eC_UInt ReadStreamingHeader (const eC_UInt &uiClassVersion, const eC_UInt &uiClassMinVersion=0) const
 
void WriteStreamingFooter (const eC_Bool &bWriteClassID) const
 
void WriteStreamingHeader (const eC_Bool &bWriteClassID, const eC_Char *const pkClassIDTag, const eC_Int &iClassID, const eC_UInt &uiClassVersion) const
 

Detailed Description

This is the Guiliani base class for layouters.

layouter.png
The "Layouter" offers several methods to set the layout behavior of a control or container. One way is to set a layout rule to arrange all object in a specified order, e.g., bottom to top. Another way is to anchor an object to one or more other objects to set its position or/and size relative to the other objects (Class: CGUILayouter).

Member Enumeration Documentation

◆ eMovedEdges_t

Enumerate possible reasons for calling layout,.

See also
DoLayout
InitLayouter
Enumerator
CHANGED_WIDTH 

distance to the parent's right border changed, that is, SetWidth() was called on associated object

CHANGED_HEIGHT 

distance to the parent's bottom border changed, that is, SetHeight() was called on associated object

CHANGED_RELXPOS 

distance to the parent's left and right borders changed, that is, SetRelXPos() was called on associated object

CHANGED_RELYPOS 

distance to the parent's top and bottom borders changed, that is, SetRelYPos() was called on associated object

CHANGED_EDGE_ALL 

distance to all edges changed

Constructor & Destructor Documentation

◆ ~CGUILayouter()

CGUILayouter::~CGUILayouter ( )
virtual

Destructor.

De-registers the layouter from its associated object.

◆ CGUILayouter()

CGUILayouter::CGUILayouter ( CGUIObject *const  pObject = NULL)
protected

Protected constructor. Called by derived classes.

Parameters
pObjectattached object

Member Function Documentation

◆ DoLayout()

virtual void CGUILayouter::DoLayout ( eMovedEdges_t  eMovedEdges)
pure virtual

Called when the size of the parent of the associated object has changed.

This method must be re-implemented in derived classes to perform the actual layout change, typically adjustments to the associated object's dimension or position.

It is called by the framework every time the width or height of the parent of the associated object has changed. The framework first calls DoLayout() on the associated object itself and then on all children of the associated object in any depth in the hierarchy.

There are two valid types of layouters: Either: Implementations of DoLayout() shall only adjust the associated object and/or direct children of it. No other decendants of the associated object shall be changed in position or size! This is called a group layouter. CGUILayouterReposition and CGUILayouterGrid are examples of group layouters. Or: Implementations of DoLayout() shall only adjust the associated object depending on the layout of its parent object. No other objects shall be changed in position or size! This is called a child layouter. CGUILayouterAnchor is an example of a child layouter.

Implementing other types of layouters may compromise the framework architecture.

The two use cases may overlap: If a direct child of a group layouter composite object has a child layouter then while streaming in the composite object associated with the group layouter, the composite will first call DoLayout() on its layouter and then call InitLayouter() on the layouters of all direct children of that composite object. Therefore, the group layouter will re-initialize the child layouter. For an anchor layouter this implies that the child layouter will have no effect and should be removed. Still the child layouter's DoLayout() will be called after the parent layouter's DoLayout() later on for any change of the size of the parent so that the child layouter might change (override) the layouting of the group layouter concerning its child layout, for example if using hardcoded values for anchor distances.

Parameters
eMovedEdgesReason for layouter call

Implemented in CGUILayouterAnchor, CGUILayouterAlignToParent, CGUILayouterPercentage, CGUILayouterList, CGUILayouterGrid, and CGUILayouterReposition.

◆ GetAssociatedObject()

CGUIObject* CGUILayouter::GetAssociatedObject ( ) const
inline

Get the object that contains this layouter.

Returns
This layouter's associated object.

◆ InitLayouter()

virtual void CGUILayouter::InitLayouter ( eMovedEdges_t  eMovedEdges)
inlinevirtual

This function is useful for child layouters. Called when the layout of the associated object itself has changed. It is called by the framework every time the width or height or x or y relative position of the associated object is changed. That is, for example when the new distance to parent's border(s) shall be set in a child layouter to base upcoming layouting on this data the framework calls this method.

InitLayouter() is only called on the layouter of the associated object for one change of the position or size of the associated object. DoLayout() in contrast is called on the layouter of the associated object and on the layouters of all decendants of the associated object for one change of the size of the associated object.

This function usually does not implement changes to any layout. It is typically used to remember layout data to be used in DoLayout() later on (useful for child layouters that depend on changes of their associated object's parent).

Parameters
eMovedEdgesReason for layouter call

Reimplemented in CGUILayouterAnchor, CGUILayouterAlignToParent, CGUILayouterList, CGUILayouterGrid, and CGUILayouterReposition.

◆ IsDependentOnParentSize()

virtual eC_Bool CGUILayouter::IsDependentOnParentSize ( )
pure virtual

This function shall determine if the layouter shall initially be called due to resizing the parent of the associated object or if it shall initially be called by resizing the associated object. If it returns false the framework will call DoLayout() on this layouter of the object that is triggering the layout procedure, that is, the composite object on which the first (in the current call stack) SetWidth() or SetHeight() is called.

Returning false is the typical use case for a group layouter that does not consider the layout of the parent of the associated object. In this case the initially resized object starting the layout procedure is the 'group object' itself, therefore you can say changing the 'group object' starts the layout procedure in this case.

If it returns true, the first DoLayout() is called on a child of the initially resized object. This is the typical use case for a child layouter or a group layouter that is considering the layout of 'its' parent. Therefore, you can say changing the parent is starting the layout procedure in this case.

Returns
eC_Bool True if dependend, False otherwise

Implemented in CGUILayouterAnchor, CGUILayouterAlignToParent, CGUILayouterPercentage, and CGUIGroupLayouter.

◆ IsGroupLayouter()

eC_Bool CGUILayouter::IsGroupLayouter ( ) const
virtual

return if is group-layouter

Returns
true if group-layouter

Reimplemented in CGUIGroupLayouter.

◆ SetAssociatedObject()

void CGUILayouter::SetAssociatedObject ( CGUIObject *const  pObject)
virtual

Sets the associated object, that means the object on which the layouter will be working. Note that there is always a one-to-one relation between a layouter and a GUIObject. Assigning a layouter to an object A first, and then assigning it to an object B will actually leave object A without a layouter.

See also
CGUIObject::SetLayouter()
Parameters
pObjectThe object to be associated

Reimplemented in CGUIGroupLayouter.


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