Documentation

ETLineFragment

ETLineFragment : NSObject <ETFragment>

Represents an horizontal or vertical line box in a layout.

AuthorsQuentin Mathe
Declared inETLineFragment.h

Overview

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.


Default

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

        - (NSArray *) items

        Returns the fragments that fills the receiver.

          - (CGFloat) itemMargin

          Returns the fragment margin that lies between between each fragment.

            - (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) height

                Returns the height of the line.

                  - (CGFloat) width

                  Returns the width of the line.

                    - (CGFloat) maxWidth

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

                    See -maxLength .

                      - (CGFloat) maxHeight

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

                      See -maxLength .

                        - (CGFloat) maxLength

                        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) length

                          Returns the lenght of the line.

                          The length is the width when the line is horizontal, the height when the line is vertical.

                            - (CGFloat) thickness

                            Returns the lenght of the line.

                            The thickness is the height when the line is horizontal, the width when the line is vertical.

                              - (BOOL) isVerticallyOriented

                              Returns whether the line is vertical or horizontal.