qnx.fuse.ui.layouts.ILayout

ILayout

Properties | Methods


Packageqnx.fuse.ui.layouts
Interfacepublic interface ILayout
Implementors LayoutBase

The interface for the Layout classes. The LayoutBase class implements this interface.

Class information:
PlayBook Tablet OS Version:   1.0.6

See also

LayoutBase



Public Properties

 PropertyDefined By
  target : IContainer
Gets of sets the underlying container, to which this layout instance is associated.
ILayout

Public Methods

 MethodDefined By
  
Returns a bitwise combination of SizeOptions GROWTH | SHRINK constants, indicating whether this control wants to grow or shrink in the given dimension. The flags have the following meaning: SizeOptions.GROW_HORIZONTAL - indicates that if the control were made wider than its preferred width, it would be able to utilize the extra space. SizeOptions.SHRINK_HORIZONTAL - indicates that if the control were made norrower than its preferred width, it would still be usable. SizeOptions.GROW_VERTICAL - indicates that if the control were made taller than its preferred height, it would be able to utilize the extra space. SizeOptions.SHRINK_VERTICAL - indicates that if the control were made shorter than its preferred height, it would still be usable. For example, a wrapping text label would return its unwrapped dimensions as its preferred size.
ILayout
  
layoutChanged(resizedChild:DisplayObject = null):Boolean
Notifies the layout that something has changed in the container or in one of its children.
ILayout
  
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Returns the preferred size of the control, given one or both dimensions that have been chosen by its parent.
ILayout
  
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Requests that a layout operation be performed immediately.
ILayout

Property Detail

target


target:IContainer

Gets of sets the underlying container, to which this layout instance is associated.


Implementation

public function get target():IContainer
public function set target(value:IContainer):void

Method Detail

getSizeOptions()


public function getSizeOptions():int

Returns a bitwise combination of SizeOptions GROWTH | SHRINK constants, indicating whether this control wants to grow or shrink in the given dimension.

The flags have the following meaning:

  • SizeOptions.GROW_HORIZONTAL - indicates that if the control were made wider than its preferred width, it would be able to utilize the extra space.
  • SizeOptions.SHRINK_HORIZONTAL - indicates that if the control were made norrower than its preferred width, it would still be usable.
  • SizeOptions.GROW_VERTICAL - indicates that if the control were made taller than its preferred height, it would be able to utilize the extra space.
  • SizeOptions.SHRINK_VERTICAL - indicates that if the control were made shorter than its preferred height, it would still be usable.

For example, a wrapping text label would return its unwrapped dimensions as its preferred size. It would return SizeOptions.SHRINK_HORIZONTAL as its only growth flag since its parent can compress it horizontally. Compressing the label horizontally will cause it to grow vertically, but since the vertical growth is initiated by the label itself and not its parent, it should not return the SizeOptions.GROW_VERTICAL flag.

A single-line, editable text box would return both the SizeOptions.GROW_HORIZONTAL flag and the SizeOptions.SHRINK_HORIZONTAL flag, since the text box would still be usable with any horizontal size. It would not return any vertical flags since a one-line text box would always be exactly the height of one line of text.

Returns

int

See also

SizeOptions

layoutChanged()


public function layoutChanged(resizedChild:DisplayObject = null):Boolean

Notifies the layout that something has changed in the container or in one of its children. If the only resulted from a child's measure() method or getSizeFlags(), this method is called given a reference to the child that changed. If anything else changed (for example, if a child was added, removed, re-ordered, or if the layout data was changed on any child object), this method is called with null.

Parameters

resizedChild:DisplayObject (default = null)

Returns

Boolean — Returns true if there is any possibility that this change may have affected the measurement or size options of the layout. Returns false if there is no possibility of the change affecting the the measurement or size options of the layout.

measure()


public function measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement

Returns the preferred size of the control, given one or both dimensions that have been chosen by its parent. The preferred size may be totally different than the control's actual size. This is an indication of what size the control "wants" to be. The parent layout is still free to ignore this and set the control to a different size.

If both dimensions are DefaultSize then the control will return whatever size it feels it looks best at. If exactly one dimension is DefaultSize then the other dimension is constrained. The caller is essentially asking the control: "If I were to make you exactly this wide, how tall would you want to be?". The control is required to return any constrained dimension verbatim, so if neither dimension is set to DefaultSize, this method must return the point (availableX, availableY).

Implementations of this method must not modify the control in any way or cause any events to be dispatched. If the implementation of this method will perform any expensive calculations, it should make use of a SizeCache or other caching strategy to ensure that the average cost of this function is reasonable.

If the result of this method changes for any given input, the control will fire a ControlEvent.CONSTRAINTS_CHANGED event.

A controls will often return the most extreme size as their preferred size, since doing so allows it to return a more specific resize flag. For example, if a wrapping text control returns its unwrapped (widest possible) size as its preferred size, it would only need to specify the SizeOptions.SHRINK_HORIZONTAL resize flag. This tells its parent "I can be made up to this wide and no wider". The wrapping text control can also choose a preferred wrapping point and return that as its preferred width. However, since such a control would support other widths that are both larger and smaller than its preferred size, it would have to specify both the SizeOptions.GROW_HORIZONTAL and SizeOptions.SHRINK_HORIZONTAL flags and would not be able to communicate its maximum size to its parent. In such cases, it is generally better to report the unwrapped size as the preferred size and override the preferred size in the layout if it is not appropriate.

Parameters

availableWidth:Number — The horizontal space available in the parent, or DefaultSize if the horizontal dimension is unconstrained.
availableHeight:Number — The vertical space available in the parent, or DefaultSize if the vertical dimension is unconstrained.

Returns

LayoutMeasurement — A LayoutMeasurement instance, indicating the preferred size of the control.

updateDisplayList()


public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void

Requests that a layout operation be performed immediately.

Parameters

unscaledWidth:Number — The width of the layout.
unscaledHeight:Number — The height of the layout.