Interactions – MiG InfoCom MiG Calendar AShape Developer Manual User Manual

Page 13

Advertising
background image

MiG InfoCom AB

depend on each other in any way, only on its parent.

CutEdgeAShapeLayout
Layout the sub shapes according to the following algorithm:

1. The bounds of the parent is offered to the shape in turn to

get laid out.

2. The actual abounds that that shape will use (depending on

its

PlaceRect

normally) is cut of from the parents

bounds and the bounds left are offered to the next sub
shape. This then repeats until all sub shapes has gotten
laid out.

What this means is that no sub shape will overlap. This works
much like a DockingLayout (sometimes called EdgeLayout)
and is normally used as one. The sub shapes to be “docked”
should have their

PlaceRect

cut of the correct piece. There

is an optimized constructor for this in

AbsRect

(which

implements

PlaceRect

).

RowAShapeLayout
A layout not unlike

BoxLayout

in Swing, but much more

flexible. It lays out the sub shapes in one row, with the size
in the non laid out dimension set to match that of the parent.

The size in the laid out dimension can be absolute or relative
and have min/preferred/max sizes set. This makes it very
flexible, especially since it asks the sub shapes what is their
min/preferred/max size, if that information isn't set directly
for the

RowAShapeLayout

.

It will not make the sum of the sub shapes larger that its
own size.

This layout can be used for creating a list of icons for
instance.

Rolling Your Own
It is very easy to make your own

ShapeLayout

. You either

implement

ShapeLayout

directly and write the two methods

it specifies or if the the

AbstractAShapeLayout

's size

estimation is adequate you just extend it to implement the
actual layout algorithm.

Interactions

AShape Developer Manual

Page 13 / 24

Advertising