User:Oscar.Ken
From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Auto Layout System
It like Qt's layout system. Support position and stretch the window objects.
The design UML chart:
(I have no place to upload image files :( )
Auto layout the CEGUI Window objects with XML configure files. Just write xml file like this:
<GridLayout CellCount="{3,3}"> <LayoutObject ID="Root/PlayerInfo_1" CellIndex="0" AlignMask="TopRight | Offset" SizeFlag="Fixed" Offset="{-20,0}" /> <LayoutObject ID="Root/PlayerInfo_4" CellIndex="2" AlignMask="TopRight | Offset" SizeFlag="Fixed" Offset="{0,-10}" /> <LayoutObject ID="PlayerInfo/DeployTime" CellIndex="4" /> <LayoutObject ID="Root/PlayerInfo_2" CellCoord="{0,2}" AlignMask="TopLeft | Offset" Offset="{0,-10}" /> <LayoutObject ID="Root/PlayerInfo_3" CellCoord="{1,2}" AlignMask="BottomRight | Offset" Offset="{180,0}" /> <LayoutObject ID="PlayerInfo/SaveReplay" CellCoord="{2,2}" AlignMask="BottomRight | Offset" Offset="{-9,-5}" /> </GridLayout>
The "ID" property is the CEGUI Window object's ID which you can specify in the cegui layout fiels. And you can composite HLayout/VLayout/GridLayout objects.
Limitations:
- Only work well with "cegui_absdim" at present, maybe do some additional work to make it work well with "cegui_reldim".
- Currrently xml file parse was implemented with MSXML, maybe can refractoring to parse xml file through IXMLDocument & IXMLElement, I'll do it when free.
EAlignMask values: eAlignMask_Left eAlignMask_Right eAlignMask_Top eAlignMask_Bottom eAlignMask_VCenter eAlignMask_HCenter eAlignMask_Offset eAlignMask_Center = eAlignMask_HCenter | eAlignMask_VCenter, eAlignMask_LeftCenter = eAlignMask_Left | eAlignMask_VCenter, eAlignMask_RightCenter = eAlignMask_Right | eAlignMask_VCenter, eAlignMask_TopLeft = eAlignMask_Top | eAlignMask_Left, eAlignMask_TopCenter = eAlignMask_Top | eAlignMask_HCenter, eAlignMask_TopRight = eAlignMask_Top | eAlignMask_Right, eAlignMask_BottomLeft = eAlignMask_Bottom | eAlignMask_Left, eAlignMask_BottomCenter = eAlignMask_Bottom | eAlignMask_HCenter, eAlignMask_BottomRight = eAlignMask_Bottom | eAlignMask_Right,
ESizeFlag values: eSizeFlag_Fixed eSizeFlag_HStretch eSizeFlag_VStretch eSizeFlag_StretchAll