Crazy Eddie's GUI System  0.8.4
CEGUI::GridLayoutContainer Class Reference

A Layout Container window layouting it's children into a grid. More...

+ Inheritance diagram for CEGUI::GridLayoutContainer:
+ Collaboration diagram for CEGUI::GridLayoutContainer:

List of all members.

Public Types

enum  AutoPositioning { AP_Disabled, AP_LeftToRight, AP_TopToBottom }

Public Member Functions

 GridLayoutContainer (const String &type, const String &name)
 Constructor for GUISheet windows.
virtual ~GridLayoutContainer (void)
 Destructor for GUISheet windows.
void setGridDimensions (size_t width, size_t height)
 Sets grid's dimensions.
void setGrid (const Sizef &size)
 Sets grid's dimensions.
size_t getGridWidth () const
 Retrieves grid width, the amount of cells in one row.
size_t getGridHeight () const
 Retrieves grid height, the amount of rows in the grid.
Sizef getGrid () const
 Retrieves grid width, the amount of cells in one row.
void setAutoPositioning (AutoPositioning positioning)
 Sets new auto positioning method.
AutoPositioning getAutoPositioning () const
 Retrieves current auto positioning method.
void setNextAutoPositioningIdx (size_t idx)
 Sets the next auto positioning "sequence position", this will be used next time when addChild is called.
size_t getNextAutoPositioningIdx () const
 Retrieves auto positioning "sequence position", this will be used next time when addChild is called.
void autoPositioningSkipCells (size_t cells)
 Skips given number of cells in the auto positioning sequence.
void addChildToPosition (Window *window, size_t gridX, size_t gridY)
 Add the specified Window to specified grid position as a child of this Grid Layout Container. If the Window window is already attached to a Window, it is detached before being added to this Window.
WindowgetChildAtPosition (size_t gridX, size_t gridY)
 Retrieves child window that is currently at given grid position.
void removeChildFromPosition (size_t gridX, size_t gridY)
 Removes the child window that is currently at given grid position.
virtual void swapChildPositions (size_t wnd1, size_t wnd2)
 Swaps positions of 2 windows given by their index.
void swapChildPositions (size_t gridX1, size_t gridY1, size_t gridX2, size_t gridY2)
 Swaps positions of 2 windows given by grid positions.
void swapChildren (Window *wnd1, Window *wnd2)
 Swaps positions of given windows.
void swapChildren (Window *wnd1, const String &wnd2)
 Swaps positions of given windows.
void swapChildren (const String &wnd1, Window *wnd2)
 Swaps positions of given windows.
void moveChildToPosition (Window *wnd, size_t gridX, size_t gridY)
 Moves given child window to given grid position.
void moveChildToPosition (const String &wnd, size_t gridX, size_t gridY)
 Moves named child window to given grid position.
virtual void layout ()

Static Public Attributes

static const String WidgetTypeName
 The unique typename of this widget.
static const String DummyName
 Widget name for dummies.
static const String EventNamespace
 Namespace for global events.
static const String EventChildOrderChanged
 fired when child windows get rearranged

Protected Member Functions

virtual void onChildOrderChanged (WindowEventArgs &e)
 Handler called when children of this window gets rearranged in any way.
size_t mapFromGridToIdx (size_t gridX, size_t gridY, size_t gridWidth, size_t gridHeight) const
 converts from grid cell position to idx
void mapFromIdxToGrid (size_t idx, size_t &gridX, size_t &gridY, size_t gridWidth, size_t gridHeight) const
 converts from idx to grid cell position
UVector2 getGridCellOffset (const std::vector< UDim > &colSizes, const std::vector< UDim > &rowSizes, size_t gridX, size_t gridY) const
USize getGridSize (const std::vector< UDim > &colSizes, const std::vector< UDim > &rowSizes) const
 calculates total grid size
size_t translateAPToGridIdx (size_t APIdx) const
 translates auto positioning index to absolute grid index
WindowcreateDummy ()
 creates a dummy window
bool isDummy (Window *wnd) const
 checks whether given window is a dummy
virtual void addChild_impl (Element *element)
virtual void removeChild_impl (Element *element)

Protected Attributes

size_t d_gridWidth
 stores grid width - amount of columns
size_t d_gridHeight
 stores grid height - amount of rows
AutoPositioning d_autoPositioning
 stores currently used auto positioning method
size_t d_nextAutoPositioningIdx
size_t d_nextGridX
size_t d_nextGridY
size_t d_nextDummyIdx

Detailed Description

A Layout Container window layouting it's children into a grid.


Member Enumeration Documentation

enumerates auto positioning methods for the grid - these allow you to fill the grid without specifying gridX and gridY positions for each addChild.

Enumerator:
AP_Disabled 

no auto positioning!

AP_LeftToRight 

Left to right positioning:

  • 1 2 3
  • 4 5 6
AP_TopToBottom 

Top to bottom positioning

  • 1 3 5
  • 2 4 6

Member Function Documentation

virtual void CEGUI::GridLayoutContainer::addChild_impl ( Element element) [protected, virtual]

Add given element to child list at an appropriate position.

Reimplemented from CEGUI::LayoutContainer.

void CEGUI::GridLayoutContainer::addChildToPosition ( Window window,
size_t  gridX,
size_t  gridY 
)

Add the specified Window to specified grid position as a child of this Grid Layout Container. If the Window window is already attached to a Window, it is detached before being added to this Window.

If something is already in given grid cell, it gets removed!
This disabled auto positioning from further usage! You need to call setAutoPositioning(..) to set it back to your desired value and use setAutoPositioningIdx(..) to set it's starting point back
See also:
Window::addChild
UVector2 CEGUI::GridLayoutContainer::getGridCellOffset ( const std::vector< UDim > &  colSizes,
const std::vector< UDim > &  rowSizes,
size_t  gridX,
size_t  gridY 
) const [protected]

calculates grid cell offset (relative to position of this layout container)

virtual void CEGUI::GridLayoutContainer::layout ( ) [virtual]

(re)layouts all windows inside this layout container immediately

Implements CEGUI::LayoutContainer.

virtual void CEGUI::GridLayoutContainer::onChildOrderChanged ( WindowEventArgs e) [protected, virtual]

Handler called when children of this window gets rearranged in any way.

Parameters:
eWindowEventArgs object whose 'window' field is set this layout container.
virtual void CEGUI::GridLayoutContainer::removeChild_impl ( Element element) [protected, virtual]

Remove given element from child list.

Reimplemented from CEGUI::LayoutContainer.

void CEGUI::GridLayoutContainer::removeChildFromPosition ( size_t  gridX,
size_t  gridY 
)

Removes the child window that is currently at given grid position.

See also:
Window::removeChild

Sets new auto positioning method.

The newly set auto positioning sequence will start over! Use setAutoPositioningIdx to set it's starting point
virtual void CEGUI::GridLayoutContainer::swapChildPositions ( size_t  wnd1,
size_t  wnd2 
) [virtual]

Swaps positions of 2 windows given by their index.

For advanced users only!

Member Data Documentation

stores next auto positioning index (will be used for next added window if d_autoPositioning != AP_Disabled)

stores next used dummy suffix index (used to generate unique dummy names)

stores next used grid X position (only used if d_autoPositioning == AP_Disabled)

stores next used grid Y position (only used if d_autoPositioning == AP_Disabled)

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends