A LUIContainerLayouter must answer the following quest:
Where exactly are all children placed in the given parent?
The parent and children are of LUIElement and can be seen Rectangles with annotation.
Basic Example:
perform(parent:LUIElement):void { // At this point parent's position is set and can be accessed via: e.getPosition()
// Let's iterate over all children for (leti=0; i<parent.numChildren(); i++) { constchild = parent.getChildAt(i);
// Yes, you can even decide how to handle // 'invisible' children, if (!child.isVisible()) continue;
// With e.getPosition() you can get the position of the // parent and layout it any way you like. // // Here: all children consume the same space as the parent does child.getPosition().set( parent.getPosition().getX(), parent.getPosition().getY(), parent.getPosition().getWidth(), parent.getPosition().getHeight(), ) } }
NOTE: parent.getPosition() must not be changed.
A child cannot force the parent to change it's position.
It can only take the parent's position and try to fit in.
If the parent needs to resize based on it's parent
you need to connect the container-layouts of the parents.
Layout-Properties
It's possible to set layout-properties on LUIElements which can be read druing the perform() call.
There are two categories of properties:
Parent Properties can be set as normal class members during the LUIContainerLayouter implementation.
Children Properties on the other hand are set using child.setLayoutProperties(..).
The idea is that you can annotate the children with information that help the parent's container layout
implementation to do it's job.
Where exactly are all children placed in the given parent?
The parent and children are of LUIElement and can be seen Rectangles with annotation.
parent.getPosition()
must not be changed. A child cannot force the parent to change it's position. It can only take the parent's position and try to fit in.If the parent needs to resize based on it's parent you need to connect the container-layouts of the parents.
It's possible to set layout-properties on LUIElements which can be read druing the
perform()
call. There are two categories of properties:Parent Properties
can be set as normal class members during the LUIContainerLayouter implementation.Children Properties
on the other hand are set using child.setLayoutProperties(..).The idea is that you can annotate the children with information that help the parent's container layout implementation to do it's job.
See