A collection of methods to help layout a GUI.
More...
#include <GUILayoutHelper.h>
|
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
} |
|
|
| ~CGUILayoutHelper () |
| Destructor.
|
|
|
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 | 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) |
|
A collection of methods to help layout a GUI.
The following layout methods are implemented in this class:
- AlignChildren(): Align all children in a composite object left, right, top, bottom or center to parent.
- AlignObject(): Align an object left, right, top, bottom or center to a reference object.
- AlignObjects(): Align a list of objects left, right, top, bottom or center to a reference object.
- AlignToGrid(): Align all children in a composite object to grid.
- AdaptWidth(): Change a single object or a list of objects to have same width as the reference object.
- AdaptHeight(): Change a single object or a list of objects to have same height as the reference object.
- ResizeObject(): Change a single object to have same width or height as the reference object.
- ResizeObjects(): Change a list of objects to have same width or height as the reference object.
- SpreadHorizontally(): Align children in a composite object so that horizontally each object has same distance to the nearby object.
- SpreadVertically(): Align children in a composite object so that vertically each object has same distance to the nearby object.
- AlignToAbsXPos(): Align an object to an absolute x position.
- AlignToAbsYPos(): Align an object to an absolute y position.
◆ 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.
◆ AdaptHeight() [1/2]
Change the height of given object to be same as the given reference object.
- Parameters
-
pkObj | The object whose width is to be changed. |
pkRefObj | The reference object. |
◆ AdaptHeight() [2/2]
Change the height of object in the object list to be same as the given reference object.
- Parameters
-
pkObjs | A list of objects whose heights are to be changed. |
pkRefObj | The reference object. |
◆ AdaptWidth() [1/2]
Change the width of given object to be same as the given reference object.
- Parameters
-
pkObj | The object whose width is to be changed. |
pkRefObj | The reference object. |
◆ AdaptWidth() [2/2]
Change the width of object in the object list to be same as the given reference object.
- Parameters
-
pkObjs | A list of objects whose widths are to be changed. |
pkRefObj | The reference object. |
◆ AdjustListArrangement()
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
-
pkParent | CompositeObject whose children shall be arranged |
kAvailableArea | Rectangle in coordinates relative to pkParent in which the children will be arranged. |
bUnifyItemSize | If set to true, all objects will automatically be resized to be the same size as the largest object |
eBasePoint | Specifices whether the objects will be arranged vertically or horizontally. |
◆ AlignChildren()
Align all children to the given parent according to the alignment criteria and the relative distance.
- Parameters
-
pkParent | The given parent composite object. |
eAlignment | The alignment criteria. |
vRelDistance | The relative distance to range of the parent. |
◆ AlignObject() [1/2]
Aligns the given object inside its parent according to the alignment criteria.
- Parameters
-
pkAlignedObj | The given object to be aligned. |
eAlignment | The alignment criteria. |
◆ AlignObject() [2/2]
Aligns the given object to the reference object according to the alignment criteria.
- Parameters
-
pkAlignedObj | The given object to be aligned. |
eAlignment | The alignment criteria. |
pkRefObj | The reference object the given object aligned to. |
◆ AlignObjects()
Aligns a list of objects to the reference object according to the alignment criteria.
- Parameters
-
pkAlignedObjs | The given list of object to be aligned. |
eAlignment | The alignment criteria. |
pkRefObj | The 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
-
pkParentObj | The given parent object. |
uiRow | The number of rows. |
uiColumn | The number of columns. |
bMakeSameSize | Indicate whether the children change their dimensions to be the same as the grid or not. |
◆ DistributeObjects()
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
-
pkObjs | A list of objects who will be distributed. |
bHorizontal | True if the objects should be distributed horizontally. |
bVertical | True if the objects should be distributed vertically. |
◆ FlipObject()
Flips the given object according to the flipping-criteria.
- Parameters
-
pkFlipObj | The given object to be flipped. |
eFlip | The flipping-criteria. |
◆ GetCurrentAbsRect()
Get the current absolute bounding rectangle of the given object, recalculated with the relative positions of all parents.
- Parameters
-
pkObject | The 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
-
pkObjectOnRight | An object pointer of any GUI control. |
pkObjectOnLeft | An 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
-
pkObject | The 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
-
pkObjectAtBottom | An object pointer of any GUI control. |
pkObjectAtTop | An 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
-
pkObject | The 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
-
pkObject | The object that is to be moved. |
vAbsXPos | The 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
-
pkObject | The object that is to be moved. |
vAbsYPos | The 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
-
pkParent | The parent object. |
vBorder | Gap between outer children and parent's edges. |
vGap | The gap between the children. |
eBasePoint | The base point on which the repositioning is based. |
bResizeParent | If true, the parent will be resized to be big enough to encapsulate all children. If false, the parent's size will remain untouched. |
bDoubleBorder | If true the border will appear on both edges |
◆ ResizeObject()
Change the given object to have the same width and height as the given reference object.
- Parameters
-
pkObj | The object whose dimension is to be changed. |
pkRefObj | The reference object. |
◆ ResizeObjects()
Change a list of objects to have the same width and height as the given reference object.
- Parameters
-
pkObjs | A list of objects whose dimensions are to be changed. |
pkRefObj | The reference object. |
◆ RotateObject()
Rotates the given object according to the rotation-criteria.
- Parameters
-
pkRotateObj | The given object to be rotated. |
eRotate | The 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
-
pkParent | The parent object. |
vSpace | The 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
-
pkParent | The parent object. |
vSpace | The space between two objects. |
◆ UseBoundingRectangleOfChildren()
Resizes and moves pkParent to bounding rectangle of children.
- Parameters
-
pkParent | The parent object |
The documentation for this class was generated from the following file: