FlowLayout:
Filter:
Classes | GUI > Layout

FlowLayout

A view decorator which autowraps the view contents
Location: NOT INSTALLED!

Description

FlowLayout is a decorator which automatically arranges views inside a container view in a row, and starts a new row if there is not enough space left for the next view. Window and CompositeView both have addFlowLayout methods which assign FlowLayout to their view decorators and return the decorator.

Class Methods

.new

Arguments:

bounds

An instance of Rect. Normally set to the parent.bounds.

margin

An instance of Point. The horizontal and vertical inner margins, within which the parent's subviews are placed.

gap

An instance of Point. The horizontal and vertical layout gap between the subviews.

Discussion:

Example:

You can also write:

Inherited class methods

Instance Methods

Accessing Instance Variables

.nextLine

Forces the decorator to start a new line:

.indentedRemaining

Returns and instance of Rect. This is a very useful method which tells you how much space is left in a row, before the next row starts. The height of indentedRemaining, is the full height remaining in the FlowLayout.

Compare this with:

.bounds

The outer bounds in which the decorator places the subviews in the parent view.

Arguments:

b

An instance of Rect.

.innerBounds

Returns the bounds inset by margin.

.gap

The horizontal and vertical layout gap between the subviews.

Arguments:

arg1

An instance of Point.

.margin

The horizontal and vertical inner margins, within which the parent's subviews are placed.

Arguments:

arg1

An instance of Point.

Subclassing and Internal Methods

The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.

.left

Get the current left indentation or manually set it.

Arguments:

arg1

A number.

Discussion:

.top

Get the current top indentation or manually set it.

Arguments:

arg1

A number.

Discussion:

.shift

Set the current left and top indentation (see above).

.maxHeight

Get/set maximium height of the subviews in the current position.

Arguments:

arg1

A number.

Discussion:

.maxRight

Get/set maximium right of the subviews in the current position.

Arguments:

arg1

A number.

Discussion:

.currentBounds

Gets a Rect with bounds.width and height = top + maxHeight.

Discussion:

.used

Gets a Rect with the space actually used.

Discussion:

.reset

Resets the layout mechanism to 0,0.

Inherited instance methods