ETLayoutItem
ETLayoutItem : ETUIItem <ETObjectInspection, ETFragment>Overview
You must never subclass ETLayoutItem.
Default
- + (BOOL) showsBoundingBox
Returns whether the bounding box is drawn.
When YES, the receiver draws its bounding box as a red stroked rect.
- + (void) setShowsBoundingBox: (BOOL)shows
Sets whether the bounding box is drawn.
See also -showsBoundingBox .
- + (BOOL) showsFrame
Returns whether the frame is drawn.
When YES, the receiver draws its frame as a blue stroked rect.
Autolayout
- + (BOOL) isAutolayoutEnabled
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 .
- + (void) enablesAutolayout
Enables automatic layout updates in the interval between the current event and the next event.
See also +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 .
- - (id) initWithView: (NSView *)view coverStyle: (ETStyle *)aStyle actionHandler: (ETActionHandler *)aHandler objectGraphContext: (COObjectGraphContext *)aContext
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: .
- - (void) stopKVOObservation
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 .
- - (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:).
Description
- - (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.
- - (ETLayoutItemGroup *) controllerItem
- Description forthcoming.
- - (ETLayoutItemGroup *) baseItem
Returns the layout item group which controls the receiver.
For every descendant item under its control, the base item will drive:
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).- pick and drop validation
- source access
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.
- - (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.
- - (ETLayoutItemGroup *) parentItem
Returns the layout item group to which the receiver belongs to.
For the root item, returns nil.
- - (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.
- - (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.
- - (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.
- - (ETLayoutItem *) supervisorViewBackedAncestorItem
Returns the first layout item bound to a view upwards in the layout item tree.
The receiver itself can be returned.
- - (id) windowBackedAncestorItem
Returns the first layout item decorated by a window upwards in the layout item tree.
The receiver itself can be returned.
- - (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).
- - (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).
- - (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].
- - (NSString *) identifier
Returns the identifier associated with the layout item.
The returned value can be nil or an empty string.
- - (NSString *) name
Returns the name associated with the layout item. The returned value can be nil or an empty string.
- - (NSString *) displayName
Returns the display name associated with the receiver. See also NSObject(Model) in EtoileFoundation.
- - (void) setDisplayName: (NSString *)aName
Sets the name associated with the receiver with -setName: .
- - (id) valueKey
Sets a value key to describe which property of the represented object is exposed through -value and -setValue: .
- - (void) setValueKey: (NSString *)aKey
Returns a value key to describe which property of the represented object is exposed through -value and -setValue: .
- - (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: .
- - (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.
- - (id) view
Returns the view associated with the receiver.
The view is an NSView class or subclass instance. See -setView: .
- - (void) setView: (NSView *)newView
Sets the view associated with the receiver. This view is commonly a widget provided by the widget backend.
- - (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] .
-
- (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).
- - (NSImage *) image
Returns the image representation associated with the receiver.
By default this method, returns by decreasing order of priority:- the receiver image (aka ETImageProperty), if -setImage: was called previously
- the receiver value, if -value returns an NSImage object
- nil, if none of the above conditions are met
- - (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.
- - (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:- the receiver icon (aka kETIconProperty), if -setIcon: was called previously
- the receiver image (aka kETImageProperty), if -image doesn't return nil
- the represented object icon, if the represented object and the icon associated with it are not nil
- a receiver snapshot, if the item can be snapshotted
- nil, if none of the above conditions are met
-image and -icon can be considered as symetric equivalents of -name and -displayName methods.
- - (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.
- - (id) representedObject
Returns the model object which embeds the data to be displayed and represented on screen by the receiver. See also -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.
- - (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"].
- - (BOOL) isMetaItem
Returns whether the value is ETLayoutItem object or not. See also -value , -valueKey and -representedObject .
- - (BOOL) requiresKeyValueCodingForAccessingProperties
Returns YES. See -[ETPropertyValueCoding requiresKeyValueCodingForAccessingProperties] .
- - (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] ).
- - (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.
- - (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.
- - (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: .
- - (BOOL) isLayoutItem
Returns YES, see [NSObject(EtoileUI) -isLayoutItem]
- - (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.
- - (BOOL) isSelected
Returns the receiver selection state. See also -setSelected: .
- - (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 .
- - (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.
- - (BOOL) isVisible
Returns whether the receiver should be displayed or not. See also -setVisible: .
- - (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.
- - (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.
- - (ETUTI *) subtype
Returns the receiver subtype.
More explanations in -setSubtype . See also -type.
- - (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.
- - (ETLayoutItem *) ancestorItemForOpaqueLayout
Returns the topmost ancestor layout item, including itself, whose layout returns YES to -isOpaque (see ETLayout). If none is found, returns self.
- - (void) didChangeLayout: (ETLayout *)oldLayout
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.
- - (void) updateLayout
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] .
- - (void) updateLayoutIfNeeded
Updates the layouts, previously marked with -setNeedsLayoutUpdate , in the entire item tree.
For ETLayoutItemGroup, won't be limited to the item subtree.
- - (BOOL) needsLayoutUpdate
Returns whether the layout is going to be updated in the interval between the current and the next event.
- - (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 .
- - (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.
- - (void) render: (NSMutableDictionary *)inputValues dirtyRect: (NSRect)dirtyRect inContext: (id)ctxt
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.
- - (ETStyleGroup *) styleGroup
Returns the style group associated with the receiver. By default, returns a style group whose only style element is an ETBasicItemStyle object.
- - (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.
- - (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.
- - (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 .
- - (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 .
- - (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.
- - (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 .
- - (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: .
- - (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 .
- - (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.
- - (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.
- - (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.
- - (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.
- - (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.
- - (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.
- - (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.
- - (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.
- - (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:] .
- - (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.
- - (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: .
- - (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.
- - (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].
- - (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 .
- - (void) setPersistentFrame: (NSRect)frame
Sets the persistent frame associated with the receiver. See -persistentFrame .
- - (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:
- - (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] .
- - (NSPoint) origin
Returns the current origin associated with the receiver frame. See also -frame .
- - (void) setOrigin: (NSPoint)origin
Sets the current origin associated with the receiver frame. See also -setFrame: .
- - (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 .
- - (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.
- - (NSPoint) position
Returns the current position associated with the receiver frame. The position is expressed in the parent item coordinate space. See also -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.
- - (NSSize) size
Returns the current size associated with the receiver frame. See also -frame .
- - (void) setSize: (NSSize)size
Sets the current size associated with the receiver frame. See also -setFrame: .
- - (CGFloat) x
Returns the current x coordinate associated with the receiver frame origin. See also -frame .
- - (void) setX: (CGFloat)x
Sets the current x coordinate associated with the receiver frame origin. See also -setFrame: .
- - (CGFloat) y
Returns the current y coordinate associated with the receiver frame origin. See also -frame .
- - (void) setY: (CGFloat)y
Sets the current y coordinate associated with the receiver frame origin. See also -setFrame: .
- - (CGFloat) height
Returns the current height associated with the receiver frame size. See also -frame .
- - (void) setHeight: (CGFloat)height
Sets the current height associated with the receiver frame size. See also -setFrame: .
- - (CGFloat) width
Returns the current width associated with the receiver frame size. See also -frame .
- - (void) setWidth: (CGFloat)width
Sets the current width associated with the receiver frame size. See also -setFrame: .
- - (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.
- - (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 .
- - (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 .
- - (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 .
- - (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.
- - (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: .
- - (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.
- - (NSRect) defaultFrame
Returns the default frame associated with the receiver. See -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.
- - (void) restoreDefaultFrame
Modifies the frame associated with the receiver to match the current default frame.
- - (ETAutoresizing) autoresizingMask
Returns the autoresizing mask that applies to the layout item as whole.
See also -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.
- - (ETContentAspect) contentAspect
Returns that the content aspect that describes how the content looks when the receiver is resized.
See ETContentAspect enum.
- - (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.
- - (NSRect) contentRectWithRect: (NSRect)aRect contentAspect: (ETContentAspect)anAspect boundsSize: (NSSize)maxSize
- Description forthcoming.
- - (void) sizeToFit
Tries to resize the item view with -sizeToFit , then adjusts the receiver content size to match the view size.
Filtering
- - (id) actionHandler
Returns the action handler associated with the receiver. See ETTool to know more about event handling in the layout item tree.
- - (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.
-
- (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.
- - (void) setTarget: (id)aTarget
Sets the target to which actions should be sent.
The target is not retained.
- - (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.
- - (SEL) action
Returns the action that can be sent by the action handler associated with the receiver.
See also -setAction: .
- - (void) didChangeRepresentedObjectValue: (id)newValue
Updates the view 'object value' property when the represented object value changed.
- - (void) beginEditing
Invokes -beginEditingForItem: on the action handler which makes the item view the first responder or the item when there is no view.
- - (void) discardEditing
Invokes -discardEditingForItem: on the action handler which in turn invokes -discardEditing on the item view when possible.
- - (BOOL) commitEditing
Invokes -commitEditingForItem: on the action handler which in turn invokes -commitEditing on the item view when possible.
- - (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: .
- - (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: .
- - (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.
- - (void) setInspector: (id <ETInspector>)inspector
Sets the custom inspector associated with the receiver.
- - (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.
- - (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.
- - (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.
- - (BOOL) usesFlexibleLayoutFrame
This method is only exposed to be used internally by EtoileUI.
Returns NO. See -[ETLayoutItemGroup usesFlexibleLayoutFrame] .
- - (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] .
- - (ETWindowItem *) provideWindowItem
Returns a basic window item.
