ETLayoutItem

Authors

Quentin Mathe (qmathe@club-internet.fr)
ETLayoutItem is the base class for all node subclasses that can be used in a layout item tree. ETLayoutItem instances are leaf nodes for the layout item tree structure.

Copyright: (C) 2007 Quentin Mathe


Contents -

  1. Software documentation for the ETLayoutItem class
  2. Software documentation for the NSObject(ETLayoutItemDelegate) informal protocol
  3. ETLayoutItem types
  4. ETLayoutItem variables

Software documentation for the ETLayoutItem class

ETLayoutItem : ETUIItem

Declared in:
ETLayoutItem.h
Conforms to:
ETObjectInspection
ETFragment

You must never subclass ETLayoutItem.


Instance Variables

Method summary

disablesAutolayout 

+ (void) disablesAutolayout;

Disables automatic layout updates in the interval between the current event and the next event.

EtoileUI also stops to track items that need a layout update. So -setNeedsLayoutUpdate does nothing then, the method returns immediately.

Before the next event, +enablesAutolayout can be called to entirely cancel +disablesAutolayoutIncludingNeedsUpdate: .
You can nest these method invocations, but automatic layout won't be restored until +enablesAutolayout has been called the same number of times than +disablesAutolayoutIncludingNeedsUpdate: .

See also +enablesAutolayout .


enablesAutolayout 

+ (void) enablesAutolayout;

Enables automatic layout updates in the interval between the current event and the next event.

See also +disablesAutolayout .


isAutolayoutEnabled 

+ (BOOL) isAutolayoutEnabled;

@taskunit Autolayout

Returns whether automatic layout updates are enabled.

If YES, items on which -setNeedsLayoutUpdate was invoked, will receive -updateLayoutRecursively: in the interval between the current event and the next event.
By default, returns YES to eliminate the need to use -updateLayout .

Returns whether automatic layout updates are enabled.

If YES, items on which -setNeedsLayoutUpdate was invoked, will receive -updateLayoutRecursively: in the interval between the current event and the next event.
By default, returns YES to eliminate the need to use -updateLayout .


setShowsBoundingBox: 

+ (void) setShowsBoundingBox: (BOOL)shows;

Sets whether the bounding box is drawn.

See also -showsBoundingBox .


setShowsFrame: 

+ (void) setShowsFrame: (BOOL)shows;

Sets whether the frame is drawn.

See also -showsFrame .


showsBoundingBox 

+ (BOOL) showsBoundingBox;

Returns whether the bounding box is drawn.

When YES, the receiver draws its bounding box as a red stroked rect.


showsFrame 

+ (BOOL) showsFrame;

Returns whether the frame is drawn.

When YES, the receiver draws its frame as a blue stroked rect.


UTI 

- (ETUTI*) UTI;

Returns the receiver UTI type as -[NSObject UTI], but combines it with the subtype and the represented object type when available.

When the receiver has a subtype, the returned type is a transient type whose supertypes are the class type and the subtype.
When the receiver has a represented object, the returned type is a transient type whose supertypes are the class type and the represented object class type.
In case, the receiver has both a represented object and a subtype, the returned type will combine both as supertypes.


acceptsActions 

- (BOOL) acceptsActions;

Returns NO when the receiver should be ignored by the tools for both hit tests and action dispatch. By default, returns YES, otherwise NO when -actionsHandler returns nil.


action 

- (SEL) action;

Returns the action that can be sent by the action handler associated with the receiver.

See also -setAction: .


actionHandler 

- (id) actionHandler;

Returns the action handler associated with the receiver. See ETTool to know more about event handling in the layout item tree.


ancestorItemForOpaqueLayout 

- (ETLayoutItem*) ancestorItemForOpaqueLayout;

Returns the topmost ancestor layout item, including itself, whose layout returns YES to -isOpaque (see ETLayout). If none is found, returns self.


anchorPoint 

- (NSPoint) anchorPoint;

Returns the current anchor point associated with the receiver content bounds. The anchor point is expressed in the receiver content coordinate space.

By default, the anchor point is centered in the content bounds rectangle. See -contentBounds .

The item position is relative to the anchor point. See -position .


autoresizingMask 

- (ETAutoresizing) autoresizingMask;

Returns the autoresizing mask that applies to the layout item as whole.

See also -setAutoresizingMask: .


baseItem 

- (ETLayoutItemGroup*) baseItem;

Returns the layout item group which controls the receiver.
An item group is said to be base item that controls its descendant items when its represented path base is neither nil nor a blank value (see -hasValidRepresentedPathBase).

For every descendant item under its control, the base item will drive:

  • pick and drop validation
  • source access
Various delegate-like methods use the base item as their main argument.

All descendant items are controlled by the receiver base item until a descendant becomes a new base item (by providing a represented path base).
See also -representedPathBase , -representedPath , -[ETLayoutItemGroup source] and related setter methods.

An item group is automatically turned into a base item, when you set a source or a controller (see -[ETLayoutItemGroup setController:]).

This method will return nil when the receiver isn't a base item or has no ancestor which is a base item.
Hence -[[[ETLayoutItem alloc] init] baseItem] returns nil.


beginEditing 

- (void) beginEditing;

Invokes -beginEditingForItem: on the action handler which makes the item view the first responder or the item when there is no view.


beginEditingUI 

- (void) beginEditingUI;

This feature is not yet implemented.


boundingBox 

- (NSRect) boundingBox;

Returns the rect that fully encloses the receiver and represents the maximal extent on which hit test is done and redisplay requested. This rect is expressed in the receiver content coordinate space.

You must be cautious with the bounding box, since its value is subject to be overwritten by the layout in use. See -setBoundingBox: .


commitEditing 

- (BOOL) commitEditing;

Invokes -commitEditingForItem: on the action handler which in turn invokes -commitEditing on the item view when possible.


containsPoint: 

- (BOOL) containsPoint: (NSPoint)point;

Returns whether a point expressed in the parent item content coordinate space is within the receiver frame. The item frame is also expressed in the parent item content coordinate space. This method checks whether the parent item is flipped or not.


contentAspect 

- (ETContentAspect) contentAspect;

Returns that the content aspect that describes how the content looks when the receiver is resized.

See ETContentAspect enum.


contentBounds 

- (NSRect) contentBounds;

Returns the content bounds associated with the receiver.


contentDrawingBox 

- (NSRect) contentDrawingBox;

This method is only exposed to be used internally by EtoileUI.

Returns the -styleGroup visible drawing area (i.e. the clipping rect).

The returned rect is the visible content bounds.


contentRectWithRect: contentAspect: boundsSize: 

- (NSRect) contentRectWithRect: (NSRect)aRect contentAspect: (ETContentAspect)anAspect boundsSize: (NSSize)maxSize;
Description forthcoming.

controllerItem 

- (ETLayoutItemGroup*) controllerItem;
Description forthcoming.

convertPointFromParent: 

- (NSPoint) convertPointFromParent: (NSPoint)point;

Returns a point expressed in the receiver coordinate space equivalent to point parameter expressed in the parent item content coordinate space.


convertPointToContent: 

- (NSPoint) convertPointToContent: (NSPoint)aPoint;

Returns a point expressed in the receiver content coordinate space equivalent to point parameter expressed in the receiver coordinate space.

The content coordinate space is located inside -contentBounds .


convertPointToParent: 

- (NSPoint) convertPointToParent: (NSPoint)point;

Returns a point expressed in the parent item content coordinate space equivalent to point parameter expressed in the receiver coordinate space.


convertRect: fromItem: 

- (NSRect) convertRect: (NSRect)rect fromItem: (ETLayoutItemGroup*)ancestor;

Returns a rect expressed in the receiver coordinate space equivalent to rect parameter expressed in ancestor coordinate space.

In case the receiver is not a descendent or ancestor is nil, returns a null rect.


convertRect: toItem: 

- (NSRect) convertRect: (NSRect)rect toItem: (ETLayoutItemGroup*)ancestor;

Returns a rect expressed in ancestor coordinate space equivalent to rect parameter expressed in the receiver coordinate space.

In case the receiver is not a descendent or ancestor is nil, returns a null rect.


convertRectFromContent: 

- (NSRect) convertRectFromContent: (NSRect)rect;

Returns a rect expressed in the receiver coordinate space equivalent to rect parameter expressed in the receiver content coordinate space.

The content coordinate space is located inside -contentBounds .


convertRectFromParent: 

- (NSRect) convertRectFromParent: (NSRect)rect;

Returns a rect expressed in the receiver coordinate space equivalent to rect parameter expressed in the parent item content coordinate space.


convertRectToContent: 

- (NSRect) convertRectToContent: (NSRect)rect;

Returns a rect expressed in the receiver content coordinate space equivalent to rect parameter expressed in the receiver coordinate space.

The content coordinate space is located inside -contentBounds .


convertRectToParent: 

- (NSRect) convertRectToParent: (NSRect)rect;

Returns a rect expressed in the parent item content coordinate space equivalent to rect parameter expressed in the receiver coordinate space.


coverStyle 

- (id) coverStyle;
Description forthcoming.

deepCopy 

- (id) deepCopy;

Must never be called in a subclass.


deepCopyWithCopier: 

- (id) deepCopyWithCopier: (ETCopier*)aCopier;

Returns a deep copy of the receiver by copying the view and all its subview hierarchy, the styles, the decorators, the represented object and all the descendant children items if the receiver is an ETLayoutItemGroup r elated classes. All copied collections are mutable (styles, decorators, representedObject, children items). TODO: Implement styles copying that is currently missing (decorators too in -copyWithZone:).


defaultFrame 

- (NSRect) defaultFrame;

Returns the default frame associated with the receiver. See -setDefaultFrame: .


defaultValueForProperty: 

- (id) defaultValueForProperty: (NSString*)key;
Description forthcoming.

didChangeLayout: 

- (void) didChangeLayout: (ETLayout*)oldLayout;
Subclasses must NOT override this method.

Tells the receiver the layout has been changed and it should post ETLayoutItemLayoutDidChangeNotification.

This method tries to notify the delegate that might exist with subclasses e.g. ETLayoutItemGroup.

You should never use this method unless you write an ETLayoutItem subclass.


didChangeRepresentedObjectValue: 

- (void) didChangeRepresentedObjectValue: (id)newValue;

Updates the view 'object value' property when the represented object value changed.


didChangeViewValue: 

- (void) didChangeViewValue: (id)newValue;

Updates the subject 'value' property when the widget view value changed.

See also -subject .


discardEditing 

- (void) discardEditing;

Invokes -discardEditingForItem: on the action handler which in turn invokes -discardEditing on the item view when possible.


display 

- (void) display;

Triggers the redisplay of the receiver and the entire layout item tree owned by it.

To handle the display, an ancestor view is looked up and the rect to refresh is converted into this ancestor coordinate space. Precisely both the lookup and the conversion are handled by -convertDisplayRect:toAncestorDisplayView:rootView:parentItem: .

If the receiver has a display view, this view will be asked to draw by itself.


displayIfNeeded 

- (void) displayIfNeeded;

Redisplays the areas marked as invalid in the receiver and all its descendant items.

Areas can be marked as invalid with -setNeedsDisplay: and -setNeedsDisplayInRect: .


displayName 

- (NSString*) displayName;

Returns the display name associated with the receiver. See also NSObject(Model) in EtoileFoundation.


displayRect: 

- (void) displayRect: (NSRect)dirtyRect;

Triggers the redisplay of the given receiver area and the entire layout item subtree that intersects it.

More explanations in -display .


drawRect: 

- (void) drawRect: (NSRect)aRect;
Description forthcoming.

drawingBoundsForStyle: 

- (NSRect) drawingBoundsForStyle: (ETStyle*)aStyle;

Returns the bounds where the given style is expected to draw the item.

When the style is the cover style, the drawing area is enclosed in the item frame.
When the style is a content style that belongs to -styleGroup , the drawing area is enclosed in the item content bounds (which might be partially clipped by a decorator).

When no decorator is set on the receiver, returns the same rect usually.

For example, we have an item with boundingBox = {-10, -10, 170, 220} and frame = {30, 40, 150, 200}, then in an ETStyle subclass whose instances would receive this item through -render:layoutItem:dirtyRect:

// bounds.origin is the current drawing context origin
NSRect bounds = [item drawingBoundsForStyle: self]; 
NSRect box = [item boundingBox];

[NSBezierPath fillRect: bounds]; // bounds is { 0, 0, 150, 200 }
// With a custom bounding box, you can draw outside of the drawing bounds
[NSBezierPath strokeRect: box]; // box is { -10, -10, 170, 220 }

See also -contentBounds , -frame , -boundingBox , -coverStyle , -styleGroup and -style .


drawingBox 

- (NSRect) drawingBox;

This method is only exposed to be used internally by EtoileUI.

Returns the -coverStyle drawing area (i.e. the clipping rect).

The returned rect is the bouding box but adjusted to prevent drawing on the window decorations.


editedProperty 

- (NSString*) editedProperty;
Description forthcoming.

enclosingDisplayView 

- (ETView*) enclosingDisplayView;

Returns the first display view bound to a layout item upwards in the layout item tree. This item is identical to the one returned by -supervisorViewBackedAncestorItem .

The receiver display view itself can be returned.


frame 

- (NSRect) frame;

Returns the current frame. If the receiver has a view attached to it, the returned frame is equivalent to the display view frame.

This value is always in sync with the persistent frame in a positional and non-computed layout such as ETFreeLayout, but is usually different when the layout is computed.
See also -setPersistentFrame:


height 

- (CGFloat) height;

Returns the current height associated with the receiver frame size. See also -frame .


icon 

- (NSImage*) icon;

Returns the image to be displayed when the receiver must be represented in a symbolic style. This icon is commonly used by some layouts and also if the receiver represents another layout item (when -isMetaItem returns YES).

By default, this method returns by decreasing order of priority:

  1. the receiver icon (aka kETIconProperty), if -setIcon: was called previously
  2. the receiver image (aka kETImageProperty), if -image doesn't return nil
  3. the represented object icon, if the represented object and the icon associated with it are not nil
  4. a receiver snapshot, if the item can be snapshotted
  5. nil, if none of the above conditions are met
. The returned image can be overriden by calling -setIcon: .

-image and -icon can be considered as symetric equivalents of -name and -displayName methods.


identifier 

- (NSString*) identifier;

Returns the identifier associated with the layout item.

The returned value can be nil or an empty string.


image 

- (NSImage*) image;

Returns the image representation associated with the receiver.

By default this method, returns by decreasing order of priority:

  1. the receiver image (aka ETImageProperty), if -setImage: was called previously
  2. the receiver value, if -value returns an NSImage object
  3. nil, if none of the above conditions are met
. The returned image can be overriden by calling -setImage: . See also -icon .

indexPath 

- (NSIndexPath*) indexPath;

Returns the receiver absolute index path by collecting the index of each parent item until the root item is reached (when -parentItem returns nil).

This method is equivalent to [[self rootItem] indexPathForItem: self].


indexPathForItem: 

- (NSIndexPath*) indexPathForItem: (ETLayoutItem*)item;

Returns the given item index path relative to the receiver.

This method is equivalent to [item indexFromItem: self].

Returns nil when the given item isn't a receiver descendant.

Passing nil is equivalent to passing the root item. In this case, the returned value is nil because the root item can never be a receiver descendant.
If the given item is equal to self, the resulting index path is an blank one (relative to itself).


indexPathFromItem: 

- (NSIndexPath*) indexPathFromItem: (ETLayoutItem*)item;

Returns receiver index path relative to the given item.

The index path is computed by climbing up the layout item tree until we find the given item. At each level we traverse, the parent relative index is pushed into the index path to be returned.

Passing nil is equivalent to passing the root item.
If the given item is equal to self, the resulting index path is a blank one (relative to itself).


initWithView: coverStyle: actionHandler: objectGraphContext: 

- (id) initWithView: (NSView*)view coverStyle: (ETStyle*)aStyle actionHandler: (ETActionHandler*)aHandler objectGraphContext: (COObjectGraphContext*)aContext;
This is a designated initialiser for the class.

You must use -[ETLayoutItemFactory itemXXX] or -[ETLayoutItemFactory itemGroupXXX] methods rather than this method.

Initializes and returns a layout item with the given view, cover style and action handler.

Any of the arguments can be nil.

When the given view is nil, the returned item will use +defaultItemRect as its frame.

See also -setView: , -setCoverStyle: and -setActionHandler: .


inspector 

- (id<ETInspector>) inspector;

Returns the custom inspector associated with the receiver. By default, returns nil.

-[NSObject(EtoileUI) inspect:] will show this inspector, unless nil is returned.


isBaseItem 

- (BOOL) isBaseItem;

Returns whether the receiver is a base item or not.

To be a base item the receiver must have a source or a controller set. See -[ETLayoutItemGroup setSource:] and -[ETLayoutItemGroup setController:].

By default, returns NO.


isFlipped 

- (BOOL) isFlipped;

Returns whether the receiver uses flipped coordinates to position its content. The returned value will be taken in account in methods related to geometry, event handling and drawing. If you want to alter the flipping, you must use -setFlipped: and never alter the supervisor view directly with -[ETView setFlipped:].


isGroup 

- (BOOL) isGroup;

Returns NO, see -[ETLayoutItemGroup isGroup]


isLayoutItem 

- (BOOL) isLayoutItem;

Returns YES, see [NSObject(EtoileUI) -isLayoutItem]


isMetaItem 

- (BOOL) isMetaItem;

Returns whether the value is ETLayoutItem object or not. See also -value , -valueKey and -representedObject .


isSelectable 

- (BOOL) isSelectable;

Returns whether the receiver can be selected.

By default, returns YES.

See also -setSelectable: .


isSelected 

- (BOOL) isSelected;

Returns the receiver selection state. See also -setSelected: .


isVisible 

- (BOOL) isVisible;

Returns whether the receiver should be displayed or not. See also -setVisible: .


layout 

- (id) layout;

Returns the layout associated with the receiver to present its content.


matchesPredicate: 

- (BOOL) matchesPredicate: (NSPredicate*)aPredicate;

@taskunit Filtering


name 

- (NSString*) name;

Returns the name associated with the layout item. The returned value can be nil or an empty string.


needsLayoutUpdate 

- (BOOL) needsLayoutUpdate;

Returns whether the layout is going to be updated in the interval between the current and the next event.


origin 

- (NSPoint) origin;

Returns the current origin associated with the receiver frame. See also -frame .


parentItem 

- (ETLayoutItemGroup*) parentItem;

Returns the layout item group to which the receiver belongs to.

For the root item, returns nil.


persistentFrame 

- (NSRect) persistentFrame;

Returns the persistent frame associated with the receiver.

This custom frame is used by ETFreeLayout. This property keeps track of the fixed location and size that are used for the receiver in the free layout, even if you switch to another layout that alters the receiver frame. The current frame is returned by -frame in all cases, hence when ETFreeLayout is in use, -frame is equal to -persistentFrame .


pointInside: useBoundingBox: 

- (BOOL) pointInside: (NSPoint)point useBoundingBox: (BOOL)extended;

Returns whether a point expressed in the receiver coordinate space is inside the receiver frame.

If the bounding box is used to test the point location, YES can be returned with a point whose y or x values are negative.


position 

- (NSPoint) position;

Returns the current position associated with the receiver frame. The position is expressed in the parent item coordinate space. See also -setPosition: .


provideWindowItem 

- (ETWindowItem*) provideWindowItem;

Returns a basic window item.


refreshIfNeeded 

- (void) refreshIfNeeded;

When the receiver is visible in an opaque layout and won't redraw by itself, marks the ancestor item to redisplay the area that corresponds to the receiver in this layout. Else marks the receiver to be redisplayed exactly as -setNeedsDisplay: with YES.

See also -ancestorItemForOpaqueLayout .


removeFromParent 

- (void) removeFromParent;

Detaches the receiver from the item group it belongs to.

You are in charge of retaining the receiver, otherwise it could be deallocated if no other objects retains it.


render: dirtyRect: inContext: 

- (void) render: (NSMutableDictionary*)inputValues dirtyRect: (NSRect)dirtyRect inContext: (id)ctxt;
An empty method provided for subclasses to override.

Renders or draws the receiver in the given rendering context.

The rendering is entirely delegated to the style group.
Subclasses such as ETLayoutItemGroup can override this method to extend, alter or replace this behavior.

EtoileUI will lock and unlock the focus when needed around this method, unless you call this method directly. In this case, you are responsible to lock/unlock the focus.

You are allowed to draw beyond the receiver frame (EtoileUI doesn't clip the drawing). In that case, you have to use -setBoundingBox to specify the area were the redisplay is now expected to occur, otherwise methods like -display and -setNeedsDisplay: won't work correctly.
You should be careful and only use this possibility to draw visual embellishments strictly related to the receiver. e.g. borders, selection mark, icon badge, control points etc.

dirtyRect indicates the receiver portion that needs to be redrawn and is expressed in the receiver coordinate space. This rect is is usally equal to -drawingFrame . But it can be smaller when the parent item doesn't need to be entirely redrawn and the portion to redraw intersects the receiver area (without covering it).
Warning: When -decoratorItem is not nil, the receiver coordinate space is not equal to the receiver content coordinate space.

inputValues is a key/value pair list that is initially passed to the ancestor item on which the rendering was started. You can add or remove key/value pairs to let styles know how they are expected to be rendered.
This key/value pair list will be carried downwards until the rendering is finished.

ctxt represents the rendering context which encloses the drawing context. For now, the context is nil and must be ignored.


representedObject 

- (id) representedObject;

Returns the model object which embeds the data to be displayed and represented on screen by the receiver. See also -setRepresentedObject: .


requiresKeyValueCodingForAccessingProperties 

- (BOOL) requiresKeyValueCodingForAccessingProperties;

Returns YES. See -[ETPropertyValueCoding requiresKeyValueCodingForAccessingProperties].


responder 

- (id) responder;

Returns the item, or a responder view inside it in case the item uses a widget view (either provided by the layout or as a simple widget view).

Used by -[ETFirstResponderSharingArea makeFirstResponder:] to determine the real responder.

If the receiver is returned, then first responder and focused item are one and the same.

See also -usesWidgetView , -[ETLayout responder] and -[NSView responder].


restoreDefaultFrame 

- (void) restoreDefaultFrame;

Modifies the frame associated with the receiver to match the current default frame.


rootItem 

- (id) rootItem;

Returns the root item of the layout item tree to which the receiver belongs to.

This method never returns nil. The returned value is equal to self when the receiver has no parent item.


scrollableAreaItem 

- (ETScrollableAreaItem*) scrollableAreaItem;

When the receiver content is presented inside scrollers, returns the decorator item that owns the scrollers provided by the widget backend (e.g. AppKit), otherwise returns nil.

When multiple scrollable area items are present in the decorator chain, the first is returned.

Won't return an enclosing scrollable area item bound to an ancestor item.


setAction: 

- (void) setAction: (SEL)aSelector;

Sets the action that can be sent by the action handler associated with the receiver.

This won't alter the action set on the receiver view, both are completely distinct.


setActionHandler: 

- (void) setActionHandler: (id)anHandler;

Sets the action handler associated with the receiver.


setAnchorPoint: 

- (void) setAnchorPoint: (NSPoint)anchor;

Sets the current anchor point associated with the receiver content bounds. anchor must be expressed in the receiver content coordinate space.


setAutoresizingMask: 

- (void) setAutoresizingMask: (ETAutoresizing)aMask;

Sets the autoresizing mask that applies to the layout item as whole.

The autoresizing mask only applies to the last decorator item (which might be the receiver itself).
When the receiver has a decorator, the content autoresizing is controlled by the decorator and not by the receiver autoresizing mask directly.

Marks the receiver as needing a layout update. Marks the parent item too, when the receiver has no decorator.

TODO: Autoresizing mask isn't yet supported when the receiver has no view.


setBoundingBox: 

- (void) setBoundingBox: (NSRect)extent;

Sets the rect that fully encloses the receiver and represents the maximal extent on which hit test is done and redisplay requested. This rect must be expressed in the receiver coordinate space.

The bounding box is used by ETTool in the hit test phase. It is also used by -display and -setNeedsDisplay: methods to compute the dirty area that needs to be refreshed. Hence it can be used by ETLayout subclasses related code to increase the area which requires to be redisplayed. For example, ETHandleGroup calls -setBoundingBox: on its manipulated object, because its handles are not fully enclosed in the receiver frame.

The bounding box must be always be greater or equal to the receiver frame.

Marks the receiver as needing a layout update. Marks the parent item too, when the receiver has no decorator.


setContentAspect: 

- (void) setContentAspect: (ETContentAspect)anAspect;

Sets the content aspect that describes how the content looks when the receiver is resized.

When the item has a view, the view autoresizing mask and frame are altered to match the new content aspect.

See ETContentAspect enum.


setContentBounds: 

- (void) setContentBounds: (NSRect)rect;

Sets the content bounds associated with the receiver.

By default, the origin of the content bounds is (0.0, 0.0). You can customize it to translate the coordinate system used to draw the receiver. The receiver transform, which might include a translation too, won't be altered. Both translations are cumulative.

If the flipped property is modified, the content bounds remains identical.

Marks the receiver as needing a layout update. Marks the parent item too, when the receiver has no decorator.


setContentSize: 

- (void) setContentSize: (NSSize)size;

Sets the content size associated with the receiver.


setCoverStyle: 

- (void) setCoverStyle: (ETStyle*)aStyle;
Description forthcoming.

setDefaultFrame: 

- (void) setDefaultFrame: (NSRect)frame;

Sets the default frame associated with the receiver and updates the item frame to match. The default frame is not touched by layout-related transforms (such as item scaling) unlike the item frame returned by -frame .

When the layout item gets instantiated, the value is set to the initial item frame.


setDefaultValue: forProperty: 

- (void) setDefaultValue: (id)aValue forProperty: (NSString*)key;
Description forthcoming.

setDisplayName: 

- (void) setDisplayName: (NSString*)aName;

Sets the name associated with the receiver with -setName: .


setFlipped: 

- (void) setFlipped: (BOOL)flip;

Sets whether the receiver uses flipped coordinates to position its content.

This method updates the supervisor view and the decorator chain to match the flipping of the receiver.

You must never alter the supervisor view directly with -[ETView setFlipped:].

Marks the receiver as needing a layout update.


setFrame: 

- (void) setFrame: (NSRect)rect;

Sets the current frame and also the persistent frame if the layout of the parent item is positional and non-computed such as ETFreeLayout.

Marks the receiver as needing a layout update. Marks the parent item too, when the receiver has no decorator.

See also -[ETLayout isPositional] and -[ETLayout isComputedLayout].


setHeight: 

- (void) setHeight: (CGFloat)height;

Sets the current height associated with the receiver frame size. See also -setFrame: .


setIcon: 

- (void) setIcon: (NSImage*)img;

Sets the image to be displayed when the receiver must be represented in a symbolic style. See also -icon .

If img is nil, then the default behavior of -icon is restored and the icon image should not be expected to be nil.


setIdentifier: 

- (void) setIdentifier: (NSString*)anId;

Sets the identifier associated with the layout item.


setImage: 

- (void) setImage: (NSImage*)img;

Sets the image representation associated with the receiver.

The image is drawn by the styles based on the content aspect. See ETBasicItemStyle as an example.
You can adjust the image size by altering the receiver size combined with a content aspect such as ETContentAspectScaleXXX or ETContentAspectStretchXXX.

If img is nil, then the default behavior of -image is restored and the returned image should not be expected to be nil.


setInspector: 

- (void) setInspector: (id<ETInspector>)inspector;

Sets the custom inspector associated with the receiver.


setLayout: 

- (void) setLayout: (ETLayout*)aLayout;

Sets the layout associated with the receiver to present its content.

Layout are not yet supported on ETLayoutItem instances, which this method is useless currently.


setName: 

- (void) setName: (NSString*)name;

Sets the name associated with the layout item.


setNeedsDisplay: 

- (void) setNeedsDisplay: (BOOL)flag;

Marks the receiver and the entire layout item tree owned by it to be redisplayed the next time an ancestor view receives a display if needed request (see -[NSView displayIfNeededXXX] methods).

More explanations in -display .


setNeedsDisplayInRect: 

- (void) setNeedsDisplayInRect: (NSRect)dirtyRect;

Marks the given receiver area and the entire layout item subtree that intersects it, to be redisplayed the next time an ancestor view receives a display if needed request (see -[NSView displayIfNeededXXX] methods).

More explanations in -display .


setNeedsLayoutUpdate 

- (void) setNeedsLayoutUpdate;

Marks the receiver to have its layout updated and be redisplayed in the interval between the current and the next event.

See also +disablesAutolayout .


setOrigin: 

- (void) setOrigin: (NSPoint)origin;

Sets the current origin associated with the receiver frame. See also -setFrame: .


setParentItem: 

- (void) setParentItem: (ETLayoutItemGroup*)parent;

Sets the layout item group to which the receiver belongs to.

If the given parent is nil, the receiver becomes a root item.

You must never call this method directly, unless you write a subclass.
To change the parent, use -addItem: , -removeFromParent and other similar methods to manipulate the item collection that belongs to the parent.


setPersistentFrame: 

- (void) setPersistentFrame: (NSRect)frame;

Sets the persistent frame associated with the receiver. See -persistentFrame .


setPosition: 

- (void) setPosition: (NSPoint)position;

Sets the current position associated with the receiver frame.

When -setPosition: is called, the position is applied relative to -anchorPoint . position must be expressed in the parent item coordinate space (exactly as the frame). When the position is set, the frame is moved to have the anchor point location in the parent item coordinate space equal to the new position value.

Marks the parent item as needing a layout update.


setRepresentedObject: 

- (void) setRepresentedObject: (id)modelObject;

Sets the model object which embeds the data to be displayed and represented on screen by the receiver.

Take note modelObject can be any objects including an ETLayoutItem instance, in this case the receiver becomes a meta item and returns YES for -isMetaItem .

The item view is also synchronized with the object value of the given represented object when the view is a widget.


setSelectable: 

- (void) setSelectable: (BOOL)selectable;

Sets whether the receiver can be selected.

If selectable is NO, resets the selected property to NO.

Layouts can customize the item appearance based on -isSelectable . For instance, ETTableLayout or ETOutlineLayout turn such items into group rows.

See also -setSelected , -isSelected and -isSelectable .


setSelected: 

- (void) setSelected: (BOOL)selected;

Sets the receiver selection state.

You rarely need to call this method. You should rather use -setSelectionIndex: , -setSelectionIndexes: or -setSelectionIndexPaths: on the parent item (see ETLayoutItemGroup).

This method doesn't post an ETItemGroupSelectionDidChangeNotification unlike the previously mentioned ETLayoutItemGroup methods.

The new selection state won't be apparent until a redisplay occurs.

If -isSelectable returns NO, the new selection state is not set.


setSize: 

- (void) setSize: (NSSize)size;

Sets the current size associated with the receiver frame. See also -setFrame: .


setStyle: 

- (void) setStyle: (ETStyle*)aStyle;

Removes all styles inside the style group, then adds the given style to the style group.

If the given style is nil, the style group becomes empty.


setStyleGroup: 

- (void) setStyleGroup: (ETStyleGroup*)aStyle;

Sets the style group associated with the receiver.

The styles inside the style group control the drawing of the receiver.
See ETStyle to understand how to customize the layout item look.


setSubtype: 

- (void) setSubtype: (ETUTI*)aUTI;

Sets the receiver subtype.

This method can be used to subtype an object (without involving any subclassing).

You can use it to restrict pick and drop allowed types to the receiver type, when the receiver is a "pure UI object" without a represented object bound to it.


setSupervisorView: sync: 

- (void) setSupervisorView: (ETView*)aSupervisorView sync: (ETSyncSupervisorView)syncDirection;

Sets the supervisor view associated with the receiver.

You should never need to call this method.

The view will be added as a subview to the supervisor view bound to the parent item to which the given item belongs to. Which means, this method may move the view to a different place in the view hierarchy.

Throws an exception when item parameter is nil.

See also -supervisorView: .


setTarget: 

- (void) setTarget: (id)aTarget;

Sets the target to which actions should be sent.

The target is not retained.


setTransform: 

- (void) setTransform: (NSAffineTransform*)aTransform;

Sets the transform applied within the content bounds.

Marks the receiver as needing a layout update. Marks the parent item too, when the receiver has no decorator.


setValue: 

- (void) setValue: (id)value;

Sets a value object based on -valueKey .

The method uses -setValue:forProperty: to set the value object for the value key. For a nil value key, the represented object is set (without resorting to -setValue:forProperty:). See -setRepresentedObject . If the represented object is a viewpoint, then the viewpoint value is set rather than setting the item represented object. See -[ETPropertyViewpoint setValue:]. Styles or layouts can use it to show the receiver with a basic value representation or when they restrict their presentation to a single property.
e.g. a table layout with a single column, or a positional layout letting items draw their value through ETBasicItemStyle. To know how the value can be presented, see ETLayout and ETStyle subclasses.

If -valueKey is not nil and the represented object declares a property 'value', both [receiver valueForProperty: @"value"] and [receiver setValue: anObject forProperty: @"value"] access the receiver value and not the one provided by the represented object, as usually expected for -valueForProperty: and -setValue:forProperty: . See also -value .


setValue: forProperty: 

- (BOOL) setValue: (id)value forProperty: (NSString*)key;

Sets a value identified by key of the model object returned by -representedObject .

See -valueForProperty: for more details.


setValueKey: 

- (void) setValueKey: (NSString*)aKey;

Returns a value key to describe which property of the represented object is exposed through -value and -setValue: .


setValueTransformer: forProperty: 

- (void) setValueTransformer: (ETItemValueTransformer*)aValueTransformer forProperty: (NSString*)key;

Registers the value transformer for the given property.

If the value transformer is nil, it is unregistered.

For a nil key, raises a NSInvalidArgumentException.

See also -valueTransformerForProperty: .


setView: 

- (void) setView: (NSView*)newView;

Sets the view associated with the receiver. This view is commonly a widget provided by the widget backend.


setVisible: 

- (void) setVisible: (BOOL)visible;

Sets whether the receiver should be displayed or not.

The new visibility state won't be apparent until a redisplay occurs.

When the layout changes, this receiver visibility might change. Any custom value you might have set is lost too and won't be restored by switching back to the previous layout in use.


setWidth: 

- (void) setWidth: (CGFloat)width;

Sets the current width associated with the receiver frame size. See also -setFrame: .


setX: 

- (void) setX: (CGFloat)x;

Sets the current x coordinate associated with the receiver frame origin. See also -setFrame: .


setY: 

- (void) setY: (CGFloat)y;

Sets the current y coordinate associated with the receiver frame origin. See also -setFrame: .


shortDescription 

- (NSString*) shortDescription;

@taskunit Description


size 

- (NSSize) size;

Returns the current size associated with the receiver frame. See also -frame .


sizeToFit 

- (void) sizeToFit;

Tries to resize the item view with -sizeToFit , then adjusts the receiver content size to match the view size.


snapshotFromRect: 

- (NSImage*) snapshotFromRect: (NSRect)aRect;

Returns an image snapshot of the receiver. The snapshot is taken at the time this method is called.

The given rect must be expressed in the receiver coordinate space.

When the receiver isn't backed by a window and has no window-backed ancestor item backed either, returns nil.


stopKVOObservation 

- (void) stopKVOObservation;
An empty method provided for subclasses to override.

Removes the receiver as an observer on all objects that it was observing until now.

You must override this method when a subclass calls KVO methods such as -addObserver:XXX . In the overriden method, you must call the superclass implementation.
You must never call this method in your own code.

In -dealloc , we must stop to be a KVO observer immediately, otherwise we may receive KVO notifications triggered by releasing objects we observe. In the worst case, we can be retained/released and thereby reenter -dealloc .


stopKVOObservationIfNeeded 

- (void) stopKVOObservationIfNeeded;
Subclasses must NOT override this method.

See -[ETLayoutItem dealloc].


style 

- (id) style;

Returns the first style inside the style group.


styleGroup 

- (ETStyleGroup*) styleGroup;

Returns the style group associated with the receiver. By default, returns a style group whose only style element is an ETBasicItemStyle object.


subject 

- (id) subject;

Returns the represented object when not nil, otherwise returns the receiver.

You shouldn't have to use this method a lot since -valueForProperty: and -setValue:forProperty: make the property access transparent. For example [self valueForProperty: kNameProperty] is equivalent to [[self subject] name].

-subject can be useful with KVC which only considers the layout item itself. e.g. [itemCollection valueForKey: @"subject.name"].


subjectDidBeginEditingForProperty: fieldEditorItem: 

- (void) subjectDidBeginEditingForProperty: (NSString*)aKey fieldEditorItem: (ETLayoutItem*)aFieldEditorItem;

Notifies the item it has begun to be edited.

This method is usually invoked by the item view or the action handler to allow the item to notify the controller item controller about the editing.

You can invoke it in an action handler method when you want the possibility to react with -commitEditingForItem: or -discardEditingForItem: to an early editing termination by the controller.

See also -objectDidEndEditing: .


subjectDidEndEditingForProperty: 

- (void) subjectDidEndEditingForProperty: (NSString*)aKey;

Notifies the item the editing underway ended.

This method is usually invoked by the item view or the action handler to allow the item to notify the controller item controller about the editing.

You must invoke it in an action handler method when you have previously call -objectDidBeginEditing and your editor has finished to edit a property.

See also -objectDidBeginEditing: .


subtype 

- (ETUTI*) subtype;

Returns the receiver subtype.

More explanations in -setSubtype . See also -type .


supervisorView 

- (ETView*) supervisorView;
Description forthcoming.

supervisorViewBackedAncestorItem 

- (ETLayoutItem*) supervisorViewBackedAncestorItem;

Returns the first layout item bound to a view upwards in the layout item tree.

The receiver itself can be returned.


target 

- (id) target;

Returns the target to which actions should be sent.


transform 

- (NSAffineTransform*) transform;

Returns the transform applied within the content bounds.


updateLayout 

- (void) updateLayout;
An empty method provided for subclasses to override.

Forces the layout to be recomputed to take in account geometry and content related changes since the last layout update.

This method is not yet implemented.
See also -[ETLayoutItemGroup updateLayout].


updateLayoutIfNeeded 

- (void) updateLayoutIfNeeded;

Updates the layouts, previously marked with -setNeedsLayoutUpdate , in the entire item tree.

For ETLayoutItemGroup, won't be limited to the item subtree.


updateLayoutRecursively: 

- (void) updateLayoutRecursively: (BOOL)recursively;
Description forthcoming.

usesFlexibleLayoutFrame 

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

This method is only exposed to be used internally by EtoileUI.

Returns NO. See -[ETLayoutItemGroup usesFlexibleLayoutFrame].


usesWidgetView 

- (BOOL) usesWidgetView;

Returns whether the view used by the receiver is a widget.

Also returns YES when the receiver uses a layout view which is a widget provided by the widget backend. See -[ETLayout isWidget].

See also -[NSView(Etoile) isWidget].


validateUserInterfaceItem: 

- (BOOL) validateUserInterfaceItem: (id)anItem;

Controls the automatic enabling/disabling of UI elements (such as menu items) that uses the responder chain to validate themselves, based on whether the receiver or its action handler can respond to the selector action that would be sent by the UI element in the EtoileUI responder chain.


value 

- (id) value;

Returns a value object based on -valueKey .

The method returns the result of -valueForProperty: for the value key. For a nil value key, the represented object is returned (without resorting to -valueForProperty:). If the represented object is a viewpoint, then the viewpoint value is returned rather than returning the item represented object. See -[ETPropertyViewpoint value:]. For items that presents a single property in the UI, using -value and -valueKey is a good choice. For example, a text field or a slider presenting a common object value or a property belonging to the represent object. See also -setValue: .


valueForProperty: 

- (id) valueForProperty: (NSString*)key;

Returns a value of the model object -representedObject , usually by calling -valueForProperty: on the represented object. If the represented object is a layout item, -valueForKey: will be called instead of -valueForProperty: .

-valueForProperty: is implemented by NSObject as part of the ETPropertyValueCoding informal protocol. When the represented object is a custom model object, it must override -valueForProperty: and -setValue:forProperty: or conform to NSKeyValueCoding protocol. See ETPropertyValueCoding to understand how to implement your model object.

When the represented object is a layout item, the receiver is a meta layout item (see -isMetaItem and -[NSObject(ETLayoutItem) isLayoutItem]).


valueKey 

- (id) valueKey;

Sets a value key to describe which property of the represented object is exposed through -value and -setValue: .


valueTransformerForProperty: 

- (ETItemValueTransformer*) valueTransformerForProperty: (NSString*)key;

Returns the value transformer registered for the given property.

-valueForProperty: converts the value just before returning it by using -[ETItemValueTransformer transformValue:forKey:ofItem:] if a transformer is registered for the property. -setValue:forProperty: converts the value just before returning it by using -[ETItemValueTransformer receverTransformValue:forKey:ofItem:] if a transformer is registered for the property.


view 

- (id) view;

Returns the view associated with the receiver.

The view is an NSView class or subclass instance. See -setView: .


visibleContentBounds 

- (NSRect) visibleContentBounds;

This method is only exposed to be used internally by EtoileUI.

Returns the visible portion of the content bounds when the receiver content is clipped by a decorator, otherwise the same than -contentBounds .

The returned rect is expressed in the receiver content coordinate space.


widget 

- (id) widget;

Returns a widget proxy for target/action and value related settings. You should use this proxy to control the widget settings rather than setting them directly on the view.

If -view is nil, the widget proxy holds the settings for the item. You can use -widget to access these settings in an action handler or a cover style (for example, if you are implementing a new widget using custom ETStyle and ETActionHandler objects without resorting to a widget from the backend).


width 

- (CGFloat) width;

Returns the current width associated with the receiver frame size. See also -frame .


windowBackedAncestorItem 

- (id) windowBackedAncestorItem;

Returns the first layout item decorated by a window upwards in the layout item tree.

The receiver itself can be returned.


windowItem 

- (ETWindowItem*) windowItem;

When the receiver content is presented inside a window, returns the decorator item that owns the window provided by the widget backend (e.g. AppKit), otherwise returns nil.

Won't return an enclosing window item bound to an ancestor item.
To retrieve the enclosing window item, use [[self windowBackedAncestorItem] windowItem].


x 

- (CGFloat) x;

Returns the current x coordinate associated with the receiver frame origin. See also -frame .


y 

- (CGFloat) y;

Returns the current y coordinate associated with the receiver frame origin. See also -frame .




Instance Variables for ETLayoutItem Class

_isDeallocating

@protected BOOL _isDeallocating;
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.

_parentItem

@protected ETLayoutItemGroup* _parentItem;
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.




Software documentation for the NSObject(ETLayoutItemDelegate) informal protocol

NSObject(ETLayoutItemDelegate)

Declared in:
ETLayoutItem.h
Description forthcoming.
Method summary

layoutDidChange: 

- (void) layoutDidChange: (NSNotification*)notif;

See ETLayoutItemLayoutDidChangeNotification.


ETLayoutItem types

ETAutoresizing

typedef NSUInteger ETAutoresizing;
Description forthcoming.

ETContentAspect

typedef enum ... ETContentAspect;

Describes how the content looks when the layout item is resized.

The content can be:

The content aspect is applied to a view by altering its autoresizing mask.
For their parts, styles are expected to rely on the item content aspect to know how they should draw the properties they retrieve through the layout item.

Some content aspects won't be applied to a view because they cannot be translated into an autoresizing mask.


ETLayoutItem variables

ETLayoutItemLayoutDidChangeNotification

NSString* ETLayoutItemLayoutDidChangeNotification;

Notification posted by ETLayoutItem and subclasses in reply to -setLayout: on the poster object. The poster object can be retrieved through -[NSNotification object].

If -setLayout: results in no layout change, no notification is posted.

This notification is also posted when the layout is modified by the user (e.g. through an inspector).