Drag[en]gine Script Module DragonScript Script API  1.0
GridLayout Class Reference

Lay out widgets in a regular grid. More...

Inheritance diagram for GridLayout:
Layout

Public Member Functions

void addWidget (Widget widget, Object settings)
 Add widget to Layout. More...
 
void doLayout (Container container)
 Lay out widgets. More...
 
int getAxis ()
 Arrange direction if both row and column count is not 0. More...
 
int getColumnCount ()
 Number of columns or 0 to choose automatically. More...
 
int getGap ()
 Size of gap between widgets. More...
 
Point getMinimumSize (Container container)
 Minimal size required for layout in container. More...
 
Point getMinimumSizeForHeight (Container container, int height)
 Minimum size of layout using reference widget height and variable width. More...
 
Point getMinimumSizeForWidth (Container container, int width)
 Minimum size of layout using reference width and variable height. More...
 
int getRowCount ()
 Number of rows or 0 to choose automatically. More...
 
GridLayout new (int columnCount, int rowCount)
 Create GridLayout with no gap between widgets. More...
 
GridLayout new (int columnCount, int rowCount, int gap)
 Create GridLayout. More...
 
GridLayout new (int columnCount, int rowCount, int gap, int axis)
 Create GridLayout. More...
 
void removeWidget (Widget widget)
 Remove widget from layout. More...
 
void setAxis (int axis)
 Set arrange direction if both row and column count is not 0. More...
 
void setColumnCount (int count)
 Set number of columns or 0 to choose automatically. More...
 
void setGap (int gap)
 Set size of gap between widgets. More...
 
void setRowCount (int count)
 Set number of rows or 0 to choose automatically. More...
 

Public Attributes

final int X_AXIS = 0
 Arrange along X-Axis if both row and column count is not 0. More...
 
final int Y_AXIS = 1
 Arrange along Y-Axis if both row and column count is not 0. More...
 

Protected Member Functions

Point getMinimumCellSize (Container container, int width, int height)
 Minimal cell size. More...
 
Point getMinimumSizeFor (Container container, int width, int height)
 Minimal size child widgets need. More...
 
int getRequiredColumnCount (Container container)
 Required colunm count. More...
 
int getRequiredRowCount (Container container)
 Required row count. More...
 
void layoutXAxis (Container container, int columnCount, int rowCount)
 Lay out widgets columns first. More...
 
void layoutYAxis (Container container, int columnCount, int rowCount)
 Lay out widgets rows first. More...
 
void updateUsedAxis ()
 Determine the actual axis to use for layout. More...
 

Detailed Description

Lay out widgets in a regular grid.

Either (but not both) column or row count can be 0 in which case the required column or row count is calculated depending on the visible number of widgets.

If row and column constraint are not 0 the axis defines if widgets are arranges first in rows (Y_AXIS) or columns (X_AXIS). If row count is 0 axis is ignore and Y_AXIS arrangement is used. If column count is 0 axis is ignored and X_AXIS arrangement is used.

Instances of this layout can be shared by multiple widgets.

Member Function Documentation

§ addWidget()

void addWidget ( Widget  widget,
Object  settings 
)

Add widget to Layout.

Implements Layout.

§ doLayout()

void doLayout ( Container  container)

Lay out widgets.

Implements Layout.

§ getAxis()

int getAxis ( )

Arrange direction if both row and column count is not 0.

§ getColumnCount()

int getColumnCount ( )

Number of columns or 0 to choose automatically.

§ getGap()

int getGap ( )

Size of gap between widgets.

§ getMinimumCellSize()

Point getMinimumCellSize ( Container  container,
int  width,
int  height 
)
protected

Minimal cell size.

§ getMinimumSize()

Point getMinimumSize ( Container  container)

Minimal size required for layout in container.

Implements Layout.

§ getMinimumSizeFor()

Point getMinimumSizeFor ( Container  container,
int  width,
int  height 
)
protected

Minimal size child widgets need.

§ getMinimumSizeForHeight()

Point getMinimumSizeForHeight ( Container  container,
int  height 
)

Minimum size of layout using reference widget height and variable width.

Implements Layout.

§ getMinimumSizeForWidth()

Point getMinimumSizeForWidth ( Container  container,
int  width 
)

Minimum size of layout using reference width and variable height.

Implements Layout.

§ getRequiredColumnCount()

int getRequiredColumnCount ( Container  container)
protected

Required colunm count.

§ getRequiredRowCount()

int getRequiredRowCount ( Container  container)
protected

Required row count.

§ getRowCount()

int getRowCount ( )

Number of rows or 0 to choose automatically.

§ layoutXAxis()

void layoutXAxis ( Container  container,
int  columnCount,
int  rowCount 
)
protected

Lay out widgets columns first.

§ layoutYAxis()

void layoutYAxis ( Container  container,
int  columnCount,
int  rowCount 
)
protected

Lay out widgets rows first.

§ new() [1/3]

GridLayout new ( int  columnCount,
int  rowCount 
)

Create GridLayout with no gap between widgets.

§ new() [2/3]

GridLayout new ( int  columnCount,
int  rowCount,
int  gap 
)

Create GridLayout.

§ new() [3/3]

GridLayout new ( int  columnCount,
int  rowCount,
int  gap,
int  axis 
)

Create GridLayout.

§ removeWidget()

void removeWidget ( Widget  widget)

Remove widget from layout.

Implements Layout.

§ setAxis()

void setAxis ( int  axis)

Set arrange direction if both row and column count is not 0.

§ setColumnCount()

void setColumnCount ( int  count)

Set number of columns or 0 to choose automatically.

§ setGap()

void setGap ( int  gap)

Set size of gap between widgets.

§ setRowCount()

void setRowCount ( int  count)

Set number of rows or 0 to choose automatically.

§ updateUsedAxis()

void updateUsedAxis ( )
protected

Determine the actual axis to use for layout.

Actual axis depends on row and column count before axis.

Member Data Documentation

§ X_AXIS

final int X_AXIS = 0

Arrange along X-Axis if both row and column count is not 0.

§ Y_AXIS

final int Y_AXIS = 1

Arrange along Y-Axis if both row and column count is not 0.


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