qmathe@club-internet.fr)ETUIItem subclass which makes possibe to decorate any layout items, usually with a widget view.
Copyright: (C) 2009 Quentin Mathe
- Declared in:
- ETDecoratorItem.h
Decorator class which can be subclassed to turn wrapper-like widgets such as scrollers, windows, group boxes etc., provided by the widget backend (e.g. AppKit), into decorator items to be applied to the semantic items that make up the layout item tree.
ETDecoratorItem can be seen as an ETLayoutItem variant with limited abilities and whose instances don't have a semantic role, hence they remain invisible in the layout item tree. They allow EtoileUI to maintain a very tight mapping between the model graph and the layout item tree. By limiting the number of non-semantic nodes in the tree, the feeling of working with real and cohesive objects is greatly enhanced at both code and UI level.
A decorator item must currently not break the following rules (this is subject to change though):
nil.
You can write new ETDecoratorItem subclasses. However ETUIItem ivars must be considered private. If you don't present the decorated view as the wrapped view of the supervisor view, you must override -contentRect at least. You might also override -visibleRect and -visibleContentRect in some cases as ETScrollableAreaItem does.
Do not use. May be remove later.
Returns whether item can be decorated by the receiver.
You can override this method to restrict which
item kinds can be decorated by the
receiver. However you must only return
YES when the superclass
implementation returns the same.
Returns the content rect expressed in the receiver coordinate space (the area that lies inside -decorationRect).
The receiver content rect is equal to [[self decoratedItem] decorationRect].
Returns a point expressed in the receiver coordinate space equivalent to point parameter expressed in the receiver content coordinate space.
See also -convertDecoratorRectFromContent: .
Returns a point expressed in the receiver coordinate space equivalent to point parameter expressed in the receiver content coordinate space.
See also -convertDecoratorRectToContent: .
Returns a rect expressed in the receiver coordinate space equivalent to rect parameter expressed in the receiver content coordinate space.
The receiver coordinate space is the area that lies inside -decorationRect . The receiver content coordinate space is the area that lies inside -contentRect .
See also -convertDecoratorRectToContent: .
Returns a rect expressed in the receiver content coordinate space equivalent to rect parameter expressed in the receiver coordinate space.
For extra details, see -convertDecoratorRectFromContent: .
This method notifies the receiver that the decorated item has a new decoration rect. The existing implementation simply notifies the next decorator, and so on recursively. When the outermost decorator item is reached, -handleSetDecorationRect: is called. Finally rect.size is returned.
rect is in the receiver content coordinate space.
You can override this method to customize how a subclass react to an inner geometry update. A custom content size can be returned when needed. A common use case is to intercept decorated item resizes to clip or extend the requested receiver content size.
You must never call this method, but only override it.
Returns the given frame.
When -setDecoratorItem: is invoked, this method is called on the new last decorator.
Can be overriden to return an adjusted frame.
For example, ETWindowItem returns an extended rect to
include the window border.
Returns the given frame.
When -setDecoratorItem: is invoked, this method is called on the previous last decorator.
Can be overriden to return an adjusted frame.
For example, ETWindowItem returns an shrinked rect to
exclude the window border.
Overrides to customize how the receiver is set up when it is inserted with -setDecorator: .
This methods provides a basic implemention that works well when a subclass uses a supervisor view. Whether you extend this behavior or replace it, you must call the superclass implementation.
To take over the decorated item insertion
into the receiver supervisor view, pass
nil as decoratedView. To
take over the outermost decorator insertion into the
parent niew, pass nil as
parentView. This last case is only
useful when the receiver will be inserted as the
last decorator.
Take in account that parentView can be
nil.
This method updates the decoration rect associated with the receiver.
You can override this method to customize how a subclass react to a geometry update when the receiver is the outermost decorator item. A common use case is when a subclass uses a custom decoration rect (unrelated to the supervisor view extent).
You must never call this method, but only override it.
NOTE: This purpose will probably evolved a bit later on...
Overrides to customize how the receiver is torn
down when it is removed with
-setDecorator:
nil.
This methods provides a basic implemention that works well when a subclass uses a supervisor view. Whether you extend this behavior or replace it, you must call the superclass implementation.
To take over the decorated item removal
from the receiver supervisor view, pass
nil as decoratedView. To
take over the outermost decorator removal from the
parent view, pass nil as
parentView. This case is only useful
when the receiver is currently the last decorator.
Take in account that parentView can be
nil.
Initializes and returns a new decorator whose decoration border is provided by supervisorView.
If you write a subclass that uses no supervisor view, you must override this initializer.
Sets the given item autoresizing mask to match the last decorator item.
Sets the last decorator item autoresizing mask to match the given item, then overrides the given item autoresizing mask with NSViewWidthSizable and NSViewHeightSizable.
Sets the autoresizing mask of the supervisor view.
Sets the decorated item associated with the receiver.
You should never need to call this method.
Set the decoration rect associated with the receiver.
If you want to intercept a decoration rect update, see -handleSetDecorationRect: .
Returns whether the view used by the receiver is a widget.
By default, returns YES.
Returns the content rect portion that remains visible when the content is clipped. The visible content rect is expressed in the receiver coordinate space. See also -contentRect .
When the content is not clipped by the receiver, -visibleContentRect and -contentRect are equal.
With ETDecoratorItem, the content rect and the visible content rect are equal, because the content is resized rather than clipped when a decorator is resized. However subclasses can decide otherwise (e.g. ETScrollableAreaItem).
Returns the content rect portion that remains visible when the content is clipped. The visible rect is expressed in the content coordinate space unlike -visibleContentRect .