Class
RenderableEntityContainer
open class RenderableEntityContainer : ContainableRenderableEntity
A RenderableEntityContainer
is used for containing zero or more
ContainableRenderableEntity
s. Because the container itself is
a ContainableRenderableEntity
, building a hierarchy of such
containers is possible.
Relationships
Superclass
ContainableRenderableEntity
A
ContainableRenderableEntity
is used for subclassing entities which may be contained in aRenderableEntityContainer
. Descendant classes must:
Initializers
init(name:topLeft:fixedSize:)
public override init(name:String?=nil,
topLeft:Point=Point.zero, fixedSize:Size?)
Properties
children
public private(set) var children : [ContainableRenderableEntity]
childRects
public var childRects : [Rect]?
Provides or sets the childRect for all children In order to get, all children must have a currentCalculatedSize, otherwise nil is returned. In order to set, the count of childRects must exactly match the count of children, The childRects are applied in order. NB: A get reads the currentCaclulcatedSize, a set writes the externalSize
Methods
insert(owningLayer:entity:)
public func insert(owningLayer:Layer, entity:ContainableRenderableEntity)
Inserts the specified ContainableRenderableEntity
into this container AND
into the specified Layer
immediately above this container.
The entity's owningContainer is set to this container.
The entity is repositioned relative to this container
recalculateSize()
open func recalculateSize()
This method is invoked when all children have either calculated their size This container should then query the children and determine the size of itself. It may also optionally resize the children (setting their specifiedSize) and/or reposition them (setting their topLeft). In the case where this container relies on information which is not yet available, it's OK to simply set a flag and complete the calculation later in the calculate() method.