Name
layout (LzLayout) — Abstract layout base class.
Description
This layout class is the base class that all other layouts —
such as, for example simplelayout
and
resizelayout
— extend.
A layout arranges the views within the element that it is attached
to. simplelayout
is one example of a basic
extension of this layout object, and the code sample below illustrates
its use.
For example, the layout in:
is necessary to keep the A and B text views from being positioned
on top of each other. As an alternative to the
layout
element, a view may specify a
layout
attribute. For example, the previous
example is equivalent to:
You do not use layout
to explicitly position
views. Rather, you may extend this class to create new types of
layouts.
Layouts, like constraints and animators, affect specific attributes of a view. Views can have more than one layout, as long
as each set of attributes
associated with a layout does not overlap with any of the other sets.
Details
Properties (4)
-
delegates
-
<attribute name="delegates" type="lzDelegate" />
public var delegates : LzDelegate;
An array of all the delegates used by the layout
-
locked
-
<attribute name="locked" type="boolean" />
public var locked : Boolean = 2;
Set to true if layout is locked from updates.
-
subviews
-
<attribute name="subviews" type="array" />
protected var subviews : Array = null;
Array holding the views under this layout's control.
-
updateDelegate
-
<attribute name="updateDelegate" type="lzDelegate" />
public var updateDelegate : LzDelegate;
A delegate used to update the layout.
Setters (1)
Setters for virtual properties, to be used with setAttribute. A setter may or may not have a corresponding getter method;
consult the Methods list in this section.
-
locked
Methods (17)
-
addSubview()
-
<method name="addSubview" args="sd" />
protected function addSubview(sd : LzView);
Called whenever a new subview is added to the layout. This is called both
in the layout constructor and when a new subview is called after layout
has been created. This is only called if the view's "ignorelayout" option is
not set.
-
construct()
-
<method name="construct" args="view, args" />
private function construct(view, args);
-
constructWithArgs()
-
<method name="constructWithArgs" args="args" />
private function constructWithArgs(args);
-
destroy()
-
<method name="destroy" />
private function destroy();
-
gotNewSubview()
-
<method name="gotNewSubview" args="sd" />
private function gotNewSubview(sd);
Called whenever the layout discovers a new subview. Checks to see if view
should be added by inspecting the view's "ignorelayout" option.
-
ignore()
-
<method name="ignore" args="s" />
protected function ignore(s : LzView);
Called when a subview is to be ignored by the layout. By default, most
layouts include all the subviews of a given view.
-
lock()
-
Lock the layout from processing updates. This allows the layout to register
for events that it generates itself. Unfortunately, right now all subclass
routines that can generate calls that may result in the layout calling
itself should check the lock before processing. Failure to do so is not
catastrophic, but it will slow down your program.
-
__LZinsertAfter()
-
<method name="__LZinsertAfter" args="newsub, oldsub" />
private function __LZinsertAfter(newsub, oldsub);
-
__LZsetLocked()
-
<method name="__LZsetLocked" args="locked" />
private function __LZsetLocked(locked);
Unlock the layout once update is done.
-
__parentInit()
-
<method name="__parentInit" />
private function __parentInit();
-
releaseLayout()
-
<method name="releaseLayout" />
public function releaseLayout();
Remove the layout from the view and unregister the delegates that the layout
uses.
-
removeSubview()
-
<method name="removeSubview" args="sd" />
protected function removeSubview(sd : LzView);
Called when a subview is removed. This is not well tested.
-
reset()
-
<method name="reset" args="e" />
protected function reset(e : Any);
Reset any held parameters (such as kept sizes that may have changed) and
before updating.
-
setLayoutOrder()
-
<method name="setLayoutOrder" args="sub1, sub2" />
public function setLayoutOrder(sub1 : LzView, sub2 : LzView);
Reorder the second subview given to this function so that it immediately
follows the first. Doesn't touch the placement of the first subview given
-
swapSubviewOrder()
-
<method name="swapSubviewOrder" args="sub1, sub2" />
public function swapSubviewOrder(sub1 : LzView, sub2 : LzView);
Swap the positions of the two subviews within the layout
-
toString()
-
<method name="toString" />
private function toString();
-
unlock()
-
public function unlock();
Unlock the layout once update is done.
LZX Synopsis
<class name="
LzLayout" extends="
LzNode
">
<attribute name="
delegates
" type="
lzDelegate" />
<attribute name="
locked
" type="
boolean" />
<attribute name="
subviews
" type="
array" />
<method name="
construct
" args="
view,
args" />
<method name="
ignore
" args="
s" />
<method name="
reset
" args="
e" />
</class>
JavaScript Synopsis
public
LzLayout extends
LzNode
{
public var
locked
:
Boolean = 2;
prototype protected function
addSubview
(
sd : LzView);
prototype private function
construct
(
view,
args);
prototype private function
destroy
();
prototype protected function
ignore
(
s : LzView);
prototype public function
lock
();
prototype protected function
reset
(
e : Any);
prototype public function
setLayoutOrder
(
sub1 : LzView,
sub2 : LzView);
prototype public function
unlock
();
}