ETLineFragment

Authors

Quentin Mathe (qmathe@club-internet.fr)
Represents an horizontal or vertical line box in a layout.

Copyright: (C) 2006 Quentin Mathe

Software documentation for the ETLineFragment class

ETLineFragment : NSObject

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

horizontalLineWithOwner: itemMargin: maxWidth: 

+ (id) horizontalLineWithOwner: (id)anOwner itemMargin: (CGFloat)aMargin maxWidth: (CGFloat)aWidth;
Description forthcoming.

verticalLineWithOwner: itemMargin: maxHeight: isFlipped: 

+ (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.


fillWithItems: 

- (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.


height 

- (CGFloat) height;

Returns the height of the line.


isVerticallyOriented 

- (BOOL) isVerticallyOriented;
An empty method provided for subclasses to override.

Returns whether the line is vertical or horizontal.


itemMargin 

- (CGFloat) itemMargin;

Returns the fragment margin that lies between between each fragment.


items 

- (NSArray*) items;

Returns the fragments that fills the receiver.


length 

- (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.


maxHeight 

- (CGFloat) maxHeight;

Returns the max height to which the receiver can be stretched to.

See -maxLength .


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.


maxWidth 

- (CGFloat) maxWidth;

Returns the max width to which the receiver can be stretched to.

See -maxLength .


origin 

- (NSPoint) origin;

Returns the origin of the line in a layout.


setOrigin: 

- (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.


thickness 

- (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.


width 

- (CGFloat) width;

Returns the width of the line.




Instance Variables for ETLineFragment Class

_flipped

@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.

_fragmentMargin

@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.

_fragments

@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.

_maxHeight

@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.

_maxWidth

@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.

_origin

@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.

_owner

@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.