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

Lays out widgets in a 2-column grid with the right column consuming extra space. More...

Inheritance diagram for FormLayout:
Layout

Classes

class  LayoutSettings
 Widget layout settings. More...
 

Public Member Functions

void addWidget (Widget widget, Object settings)
 Add Widget to Layout using settings of type LayoutSettings or null to use default. More...
 
void doLayout (Container container)
 Layout widgets. More...
 
int getGapColumns ()
 Gap between coumns. More...
 
int getGapRows ()
 Gap between rows. 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...
 
bool getStretchRightColumn ()
 Stretch right column. More...
 
FormLayout new ()
 Create form layout stretching the right column with no gap between child widgets. More...
 
FormLayout new (bool stretchRightColumn, int gapColumn, int gapRow)
 Create form layout. More...
 
void removeWidget (Widget widget)
 Remove widget from layout. More...
 
void setGapColumns (int gap)
 Set gap between columns. More...
 
void setGapRows (int gap)
 Set gap between rows. More...
 
void setStretchRightColumn (bool stretchRightColumn)
 Set stretch right column. More...
 

Protected Member Functions

Point getMinimumSizeFor (Container container, int width)
 Minimum size required for child widgets. More...
 
int getNoStretchColumnWidth (Container container, int width)
 Minimum size required for the non-stretching column widgets. More...
 
int getNumRowsStretch (Container container)
 Number of rows requiring stretching. More...
 

Detailed Description

Lays out widgets in a 2-column grid with the right column consuming extra space.

Simplifies laying out controls for configuration windows and other widgets where pairs of widgets are located under each other. The label widgets on the left side and the control widgets on the right side are aligned with their left and right edges. The label widget column consumes the minimal width required to show all labels. The right column stretches to fill the parent container.

Widgets can be assigned a constraint while adding to the layout. The default constraint stretches the widget to fill the entire cell it is located in. The constraint can be changed to not stretch the component to fill the cell in either direction. In addition the height of the row the widget belongs to can be set to consume extra space for example if the control widget is a text area. The row stretches in height if at least one of the widgets inside specifies the stretch constraint.

Instances of this layout can not be shared by multiple widgets.

Member Function Documentation

§ addWidget()

void addWidget ( Widget  widget,
Object  settings 
)

Add Widget to Layout using settings of type LayoutSettings or null to use default.

Implements Layout.

§ doLayout()

void doLayout ( Container  container)

Layout widgets.

Implements Layout.

§ getGapColumns()

int getGapColumns ( )

Gap between coumns.

§ getGapRows()

int getGapRows ( )

Gap between rows.

§ getMinimumSize()

Point getMinimumSize ( Container  container)

Minimal size required for layout in container.

Implements Layout.

§ getMinimumSizeFor()

Point getMinimumSizeFor ( Container  container,
int  width 
)
protected

Minimum size required for child widgets.

§ 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.

§ getNoStretchColumnWidth()

int getNoStretchColumnWidth ( Container  container,
int  width 
)
protected

Minimum size required for the non-stretching column widgets.

§ getNumRowsStretch()

int getNumRowsStretch ( Container  container)
protected

Number of rows requiring stretching.

§ getStretchRightColumn()

bool getStretchRightColumn ( )

Stretch right column.

§ new() [1/2]

FormLayout new ( )

Create form layout stretching the right column with no gap between child widgets.

§ new() [2/2]

FormLayout new ( bool  stretchRightColumn,
int  gapColumn,
int  gapRow 
)

Create form layout.

§ removeWidget()

void removeWidget ( Widget  widget)

Remove widget from layout.

Implements Layout.

§ setGapColumns()

void setGapColumns ( int  gap)

Set gap between columns.

§ setGapRows()

void setGapRows ( int  gap)

Set gap between rows.

§ setStretchRightColumn()

void setStretchRightColumn ( bool  stretchRightColumn)

Set stretch right column.


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