Guiliani  Version 2.6 revision 7293 (documentation build 12)
CGUILayoutHelper Class Reference

A collection of methods to help layout a GUI. More...

#include <GUILayoutHelper.h>

Public Types

enum  LayoutAlignment_t {
  LAYOUT_ALIGN_LEFT , LAYOUT_ALIGN_RIGHT , LAYOUT_ALIGN_TOP , LAYOUT_ALIGN_BOTTOM ,
  LAYOUT_ALIGN_HORIZONTAL_CENTERED , LAYOUT_ALIGN_VERTICAL_CENTERED , LAYOUT_DISTRIBUTE_HORIZONTALLY , LAYOUT_DISTRIBUTE_VERTICALLY
}
 
enum  LayoutFlip_t { LAYOUT_FLIP_HORIZONTAL , LAYOUT_FLIP_VERTICAL }
 
enum  LayoutRotate_t { LAYOUT_ROTATE_RIGHT , LAYOUT_ROTATE_LEFT }
 
enum  ListAlignment_t { LIST_ALIGN_HORIZONTAL =0 , LIST_ALIGN_VERTICAL , LIST_ALIGN_INVALID }
 
enum  RepositionAlignment_t {
  REPOSITION_ALIGN_TOP =0 , REPOSITION_ALIGN_BOTTOM , REPOSITION_ALIGN_LEFT , REPOSITION_ALIGN_RIGHT ,
  REPOSITION_ALIGN_INVALID
}
 

Public Member Functions

 ~CGUILayoutHelper ()
 Destructor.
 

Static Public Member Functions

static void AdaptHeight (CGUIObject *pkObj, CGUIObject *pkRefObj)
 
static void AdaptHeight (eC_TListDoubleLinked< CGUIObject * > &pkObjs, CGUIObject *pkRefObj)
 
static void AdaptWidth (CGUIObject *pkObj, const CGUIObject *pkRefObj)
 
static void AdaptWidth (eC_TListDoubleLinked< CGUIObject * > &pkObjs, const CGUIObject *pkRefObj)
 
static void AdjustListArrangement (CGUICompositeObject *pkParent, const CGUIRect &kAvailableArea, const eC_Bool &bUnifyItemSize, const ListAlignment_t &eBasePoint)
 
static void AlignChildren (const CGUICompositeObject *pkParent, LayoutAlignment_t eAlignment, const eC_Value &vRelDistance=eC_FromInt(0))
 
static void AlignObject (CGUIObject *pkAlignedObj, LayoutAlignment_t eAlignment)
 
static void AlignObject (CGUIObject *pkAlignedObj, LayoutAlignment_t eAlignment, const CGUIObject *pkRefObj)
 
static void AlignObjects (eC_TListDoubleLinked< CGUIObject * > &pkAlignedObjs, LayoutAlignment_t eAlignment, const CGUIObject *pkRefObj)
 
static void AlignToGrid (const CGUICompositeObject *pkParentObj, eC_UInt uiRow, eC_UInt uiColumn, eC_Bool bMakeSameSize)
 
static void DistributeObjects (eC_TListDoubleLinked< CGUIObject * > &pkObjs, eC_Bool bHorizontal, eC_Bool bVertical)
 
static void FlipObject (CGUIObject *pkFlipObj, const LayoutFlip_t &eFlip)
 
static CGUIRect GetCurrentAbsRect (const CGUIObject *pkObject)
 
static eC_Value GetCurrentAbsXDistance (const CGUIObject *pkObjectOnRight, const CGUIObject *pkObjectOnLeft)
 
static eC_Value GetCurrentAbsXPos (const CGUIObject *pkObject)
 
static eC_Value GetCurrentAbsYDistance (const CGUIObject *pkObjectAtBottom, const CGUIObject *pkObjectAtTop)
 
static eC_Value GetCurrentAbsYPos (const CGUIObject *pkObject)
 
static void MoveToCurrentAbsXPos (CGUIObject *pkObject, const eC_Value &vAbsXPos)
 
static void MoveToCurrentAbsYPos (CGUIObject *pkObject, const eC_Value &vAbsYPos)
 
static void RepositionChildren (CGUICompositeObject *pkParent, const eC_Value &vBorder, const eC_Value &vGap, const RepositionAlignment_t &eBasePoint, const eC_Bool &bResizeParent=true, const eC_Bool &bDoubleBorder=true)
 
static void ResizeChildren (CGUICompositeObject *pkParent, const eC_Value &vWidthScale, const eC_Value &vHeightScale)
 
static void ResizeObject (CGUIObject *pkObj, const CGUIObject *pkRefObj)
 
static void ResizeObjects (eC_TListDoubleLinked< CGUIObject * > &pkObjs, const CGUIObject *pkRefObj)
 
static void RotateObject (CGUIObject *pkRotateObj, const LayoutRotate_t &eRotate)
 
static void SpreadHorizontally (const CGUICompositeObject *pkParent, const eC_Value &vSpace)
 
static void SpreadVertically (const CGUICompositeObject *pkParent, const eC_Value &vSpace)
 
static void UseBoundingRectangleOfChildren (CGUICompositeObject *pkParent)
 

Detailed Description

A collection of methods to help layout a GUI.

The following layout methods are implemented in this class:

  1. AlignChildren(): Align all children in a composite object left, right, top, bottom or center to parent.
  2. AlignObject(): Align an object left, right, top, bottom or center to a reference object.
  3. AlignObjects(): Align a list of objects left, right, top, bottom or center to a reference object.
  4. AlignToGrid(): Align all children in a composite object to grid.
  5. AdaptWidth(): Change a single object or a list of objects to have same width as the reference object.
  6. AdaptHeight(): Change a single object or a list of objects to have same height as the reference object.
  7. ResizeObject(): Change a single object to have same width or height as the reference object.
  8. ResizeObjects(): Change a list of objects to have same width or height as the reference object.
  9. SpreadHorizontally(): Align children in a composite object so that horizontally each object has same distance to the nearby object.
  10. SpreadVertically(): Align children in a composite object so that vertically each object has same distance to the nearby object.
  11. AlignToAbsXPos(): Align an object to an absolute x position.
  12. AlignToAbsYPos(): Align an object to an absolute y position.

Member Enumeration Documentation

◆ LayoutAlignment_t

Definitions of the possible alignment types.

◆ LayoutFlip_t

Definitions of the possible flipping-types.

◆ LayoutRotate_t

Definitions of the possible rotation-types.

◆ ListAlignment_t

Base point on which the list positioning is based.

◆ RepositionAlignment_t

Base point on which the reposition is based.

Member Function Documentation

◆ AdaptHeight() [1/2]

static void CGUILayoutHelper::AdaptHeight ( CGUIObject pkObj,
CGUIObject pkRefObj 
)
static

Change the height of given object to be same as the given reference object.

Parameters
pkObjThe object whose width is to be changed.
pkRefObjThe reference object.

◆ AdaptHeight() [2/2]

static void CGUILayoutHelper::AdaptHeight ( eC_TListDoubleLinked< CGUIObject * > &  pkObjs,
CGUIObject pkRefObj 
)
static

Change the height of object in the object list to be same as the given reference object.

Parameters
pkObjsA list of objects whose heights are to be changed.
pkRefObjThe reference object.

◆ AdaptWidth() [1/2]

static void CGUILayoutHelper::AdaptWidth ( CGUIObject pkObj,
const CGUIObject pkRefObj 
)
static

Change the width of given object to be same as the given reference object.

Parameters
pkObjThe object whose width is to be changed.
pkRefObjThe reference object.

◆ AdaptWidth() [2/2]

static void CGUILayoutHelper::AdaptWidth ( eC_TListDoubleLinked< CGUIObject * > &  pkObjs,
const CGUIObject pkRefObj 
)
static

Change the width of object in the object list to be same as the given reference object.

Parameters
pkObjsA list of objects whose widths are to be changed.
pkRefObjThe reference object.

◆ AdjustListArrangement()

static void CGUILayoutHelper::AdjustListArrangement ( CGUICompositeObject pkParent,
const CGUIRect kAvailableArea,
const eC_Bool &  bUnifyItemSize,
const ListAlignment_t eBasePoint 
)
static

Arranges the children of the supplied compositeobject in a list, which is either aligned vertically (column by column) or horizontally (row by row). The LayoutHelper will arrange the objects within the area given in kAvailableArea, which is a rectangle in RELATIVE coordinates within the CompositeObject. Invisible child-objects will not be taken into account while re-arranging the children.

Parameters
pkParentCompositeObject whose children shall be arranged
kAvailableAreaRectangle in coordinates relative to pkParent in which the children will be arranged.
bUnifyItemSizeIf set to true, all objects will automatically be resized to be the same size as the largest object
eBasePointSpecifices whether the objects will be arranged vertically or horizontally.

◆ AlignChildren()

static void CGUILayoutHelper::AlignChildren ( const CGUICompositeObject pkParent,
LayoutAlignment_t  eAlignment,
const eC_Value &  vRelDistance = eC_FromInt(0) 
)
static

Align all children to the given parent according to the alignment criteria and the relative distance.

Parameters
pkParentThe given parent composite object.
eAlignmentThe alignment criteria.
vRelDistanceThe relative distance to range of the parent.

◆ AlignObject() [1/2]

static void CGUILayoutHelper::AlignObject ( CGUIObject pkAlignedObj,
LayoutAlignment_t  eAlignment 
)
static

Aligns the given object inside its parent according to the alignment criteria.

Parameters
pkAlignedObjThe given object to be aligned.
eAlignmentThe alignment criteria.

◆ AlignObject() [2/2]

static void CGUILayoutHelper::AlignObject ( CGUIObject pkAlignedObj,
LayoutAlignment_t  eAlignment,
const CGUIObject pkRefObj 
)
static

Aligns the given object to the reference object according to the alignment criteria.

Parameters
pkAlignedObjThe given object to be aligned.
eAlignmentThe alignment criteria.
pkRefObjThe reference object the given object aligned to.

◆ AlignObjects()

static void CGUILayoutHelper::AlignObjects ( eC_TListDoubleLinked< CGUIObject * > &  pkAlignedObjs,
LayoutAlignment_t  eAlignment,
const CGUIObject pkRefObj 
)
static

Aligns a list of objects to the reference object according to the alignment criteria.

Parameters
pkAlignedObjsThe given list of object to be aligned.
eAlignmentThe alignment criteria.
pkRefObjThe reference object the given object aligned to.

◆ AlignToGrid()

static void CGUILayoutHelper::AlignToGrid ( const CGUICompositeObject pkParentObj,
eC_UInt  uiRow,
eC_UInt  uiColumn,
eC_Bool  bMakeSameSize 
)
static

Aligns the all children of a given parent object to grid. The grid is decided from the row and column number. That means the width of the grid is determined by dividing the width of the parent object to the number of the column and the height of the grid is determined by such kind of algorithm too. After the children are aligned, they are centered in the grid. If the given bMakeSameSize is true, the children change their dimension to be same as the grid.

Parameters
pkParentObjThe given parent object.
uiRowThe number of rows.
uiColumnThe number of columns.
bMakeSameSizeIndicate whether the children change their dimensions to be the same as the grid or not.

◆ DistributeObjects()

static void CGUILayoutHelper::DistributeObjects ( eC_TListDoubleLinked< CGUIObject * > &  pkObjs,
eC_Bool  bHorizontal,
eC_Bool  bVertical 
)
static

Change a list of objects to have the same horizontal/vertical distance to each other. The leftmost/top position of an object position is used as left/top border and the rightmost/bottom object position is used as right/bottom border of space where the objects will be distributed. The order of the object inside the list determines the horizontal/vertical order of the objects after redistribution.

Parameters
pkObjsA list of objects who will be distributed.
bHorizontalTrue if the objects should be distributed horizontally.
bVerticalTrue if the objects should be distributed vertically.

◆ FlipObject()

static void CGUILayoutHelper::FlipObject ( CGUIObject pkFlipObj,
const LayoutFlip_t eFlip 
)
static

Flips the given object according to the flipping-criteria.

Parameters
pkFlipObjThe given object to be flipped.
eFlipThe flipping-criteria.

◆ GetCurrentAbsRect()

static CGUIRect CGUILayoutHelper::GetCurrentAbsRect ( const CGUIObject pkObject)
static

Get the current absolute bounding rectangle of the given object, recalculated with the relative positions of all parents.

Parameters
pkObjectThe given object pointer.
Returns
The absolute Y position of the given object.

◆ GetCurrentAbsXDistance()

static eC_Value CGUILayoutHelper::GetCurrentAbsXDistance ( const CGUIObject pkObjectOnRight,
const CGUIObject pkObjectOnLeft 
)
inlinestatic

Get the current difference of the absolute X position of the given objects, using the current absolute X positions, not the absolute X positions of the last redraw. Absolute X position of pkObjectRight minus absolute X position of pkObjectLeft is calculated, so the difference is negative if pkObjectRight is left of pkObjectLeft.

Parameters
pkObjectOnRightAn object pointer of any GUI control.
pkObjectOnLeftAn object pointer of any GUI control.
Returns
The difference of X positions of the two GUI controls, either positive or negative.

◆ GetCurrentAbsXPos()

static eC_Value CGUILayoutHelper::GetCurrentAbsXPos ( const CGUIObject pkObject)
static

Get the current absolute X position of the given object, recalculated from the relative positions of all parents.

Parameters
pkObjectThe given object pointer.
Returns
The absolute X position of the given object.

◆ GetCurrentAbsYDistance()

static eC_Value CGUILayoutHelper::GetCurrentAbsYDistance ( const CGUIObject pkObjectAtBottom,
const CGUIObject pkObjectAtTop 
)
inlinestatic

Get the current difference of the absolute Y position of the given objects, using the current absolute Y positions, not the absolute Y positions of the last redraw. Absolute Y position of pkObjectAtBottom minus absolute Y position of pkObjectAtTop is calculated, so the difference is negative if pkObjectAtTop is bottom of pkObjectAtBottom.

Parameters
pkObjectAtBottomAn object pointer of any GUI control.
pkObjectAtTopAn object pointer of any GUI control.
Returns
The difference of Y positions of the two GUI controls, either positive or negative.

◆ GetCurrentAbsYPos()

static eC_Value CGUILayoutHelper::GetCurrentAbsYPos ( const CGUIObject pkObject)
static

Get the current absolute Y position of the given object, recalculated from the relative positions of all parents.

Parameters
pkObjectThe given object pointer.
Returns
The absolute Y position of the given object.

◆ MoveToCurrentAbsXPos()

static void CGUILayoutHelper::MoveToCurrentAbsXPos ( CGUIObject pkObject,
const eC_Value &  vAbsXPos 
)
static

Moves the given object to the given absolute x position by changing the relative x position of pkObject. Calculation is based on current absolute coordinates.

Parameters
pkObjectThe object that is to be moved.
vAbsXPosThe absolute x position that the given object is moved to.

◆ MoveToCurrentAbsYPos()

static void CGUILayoutHelper::MoveToCurrentAbsYPos ( CGUIObject pkObject,
const eC_Value &  vAbsYPos 
)
static

Moves the given object under the given absolute y position by changing the relative y position of pkObject.

Parameters
pkObjectThe object that is to be moved.
vAbsYPosThe absolute y position that the given object is moved to.

◆ RepositionChildren()

static void CGUILayoutHelper::RepositionChildren ( CGUICompositeObject pkParent,
const eC_Value &  vBorder,
const eC_Value &  vGap,
const RepositionAlignment_t eBasePoint,
const eC_Bool &  bResizeParent = true,
const eC_Bool &  bDoubleBorder = true 
)
static

Repositions a composite object's visible children based on a base point and minimizes the composite's size. E.g. if the base point is REPOSITION_ALIGN_BOTTOM, the first child is positioned at the bottom, the next one on top of it, and so forth, and the height of the parent is minimized to match the top and bottom edges of the visible repositioned child objects.

Parameters
pkParentThe parent object.
vBorderGap between outer children and parent's edges.
vGapThe gap between the children.
eBasePointThe base point on which the repositioning is based.
bResizeParentIf true, the parent will be resized to be big enough to encapsulate all children. If false, the parent's size will remain untouched.
bDoubleBorderIf true the border will appear on both edges

◆ ResizeChildren()

static void CGUILayoutHelper::ResizeChildren ( CGUICompositeObject pkParent,
const eC_Value &  vWidthScale,
const eC_Value &  vHeightScale 
)
static

resize all children inside container according to scaling factors

Parameters
pkParentcontainer
vWidthScalescaling factor for width
vHeightScalescaling factor for height

◆ ResizeObject()

static void CGUILayoutHelper::ResizeObject ( CGUIObject pkObj,
const CGUIObject pkRefObj 
)
static

Change the given object to have the same width and height as the given reference object.

Parameters
pkObjThe object whose dimension is to be changed.
pkRefObjThe reference object.

◆ ResizeObjects()

static void CGUILayoutHelper::ResizeObjects ( eC_TListDoubleLinked< CGUIObject * > &  pkObjs,
const CGUIObject pkRefObj 
)
static

Change a list of objects to have the same width and height as the given reference object.

Parameters
pkObjsA list of objects whose dimensions are to be changed.
pkRefObjThe reference object.

◆ RotateObject()

static void CGUILayoutHelper::RotateObject ( CGUIObject pkRotateObj,
const LayoutRotate_t eRotate 
)
static

Rotates the given object according to the rotation-criteria.

Parameters
pkRotateObjThe given object to be rotated.
eRotateThe rotation-criteria.

◆ SpreadHorizontally()

static void CGUILayoutHelper::SpreadHorizontally ( const CGUICompositeObject pkParent,
const eC_Value &  vSpace 
)
static

Arrange all children in the composite object to have same space between each other in horizontally. This takes the left most object and then make same space between two objects.

Parameters
pkParentThe parent object.
vSpaceThe space between two objects.

◆ SpreadVertically()

static void CGUILayoutHelper::SpreadVertically ( const CGUICompositeObject pkParent,
const eC_Value &  vSpace 
)
static

Arrange all children in the composite object to have same space between each other vertically This takes the top most object and then make same space between two objects.

Parameters
pkParentThe parent object.
vSpaceThe space between two objects.

◆ UseBoundingRectangleOfChildren()

static void CGUILayoutHelper::UseBoundingRectangleOfChildren ( CGUICompositeObject pkParent)
static

Resizes and moves pkParent to bounding rectangle of children.

Parameters
pkParentThe parent object

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