Authors
- Quentin Mathe (
qmathe@club-internet.fr)
-
Represents an horizontal or vertical line box in a
layout.
Copyright: (C) 2006 Quentin Mathe
- Declared in:
- ETLineFragment.h
- Conforms to:
- ETFragment
A line fragment is a collection of fragments to be
layouted either horizontally or vertically.
A line fragment is typically used together with
ETComputedLayout to cluster items
spatially without requiring that these layout
items belong to an item group.
Although we name 'items' the elements hold by a
line fragment, they can be any objects that comply to
the ETFragment protocol when their layout implements
the ETLayoutFragmentOwner protocol in a compatible way.
Take note that ETComputedLayout and its
EtoileUI subclasses only accept ETLayoutItem
objects as arguments to
-rectForItem:
and
-setOrigin:forItem:
.
You can write subclasses and override these
methods to solve this limitation.
It is not advised to subclass ETLineFragment. In any
case, the ivars must be considered private.
Instance Variables
Method summary
+ (id)
horizontalLineWithOwner: (id
)anOwner itemMargin: (CGFloat)aMargin maxWidth: (CGFloat)aWidth;
Description forthcoming.
+ (id)
verticalLineWithOwner: (id
)anOwner itemMargin: (CGFloat)aMargin maxHeight: (CGFloat)aHeight isFlipped: (BOOL)isFlipped;
Returns a new autoreleased vertical layout line
filled with the given fragments.
- (
NSArray*)
fillWithItems: (
NSArray*)fragments;
Adds the given fragments sequentially to
the receiver until its length becomes greater than
its max allowed length, then return all the
fragments that were accepted and added.
Accepted fragments can be an empty
array or equal to the fragments given in
input.
- (
CGFloat)
height;
Returns the height of the line.
- (BOOL)
isVerticallyOriented;
An empty method provided for subclasses to override.
Returns whether the line is vertical or
horizontal.
- (
CGFloat)
itemMargin;
Returns the fragment margin that lies between
between each fragment.
- (
NSArray*)
items;
Returns the fragments that fills the receiver.
- (
CGFloat)
length;
An empty method provided for subclasses to override.
Returns the lenght of the line.
The length is the width when the line is horizontal,
the height when the line is vertical.
- (
CGFloat)
maxHeight;
Returns the max height to which the receiver can
be stretched to.
See
-maxLength
.
- (
CGFloat)
maxLength;
An empty method provided for subclasses to override.
Returns the max lenght of the line.
When the receiver length reaches the max length, it
starts to refuse fragments.
The max length is the max width when the line is
horizontal, the max height when the line is
vertical.
- (
CGFloat)
maxWidth;
Returns the max width to which the receiver can
be stretched to.
See
-maxLength
.
- (
NSPoint)
origin;
Returns the origin of the line in a layout.
- (void)
setOrigin: (
NSPoint)location;
Sets the origin of the line in a layout.
The origin is at the top left corner of the line when
the parent coordinate space is flipped, ortherwise at
the bottom left corner.
- (
CGFloat)
thickness;
An empty method provided for subclasses to override.
Returns the lenght of the line.
The thickness is the height when the line is
horizontal, the width when the line is
vertical.
- (
CGFloat)
width;
Returns the width of the line.
Instance Variables for ETLineFragment Class
@protected BOOL _flipped;
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected CGFloat _fragmentMargin;
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSMutableArray* _fragments;
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected CGFloat _maxHeight;
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected CGFloat _maxWidth;
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected NSPoint _origin;
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
@protected id _owner;
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.