30 : bounds ({ 0.0f, 0.0f, 100.0f, 100.0f })
32 setContentArea ({ 0.0f, 0.0f, 100.0f, 100.0f });
37 bounds (
other.bounds),
38 contentArea (
other.contentArea)
40 for (
auto* c :
other.getChildren())
41 if (
auto* d =
dynamic_cast<const Drawable*
> (c))
52 return std::make_unique<DrawableComposite> (*
this);
61 if (
auto* d =
dynamic_cast<const Drawable*
> (c))
62 r = r.
getUnion (d->isTransformed() ? d->getDrawableBounds().transformedBy (d->getTransform())
63 : d->getDrawableBounds());
88 if (t.isSingularity())
109 originRelativeToComponent = parent->originRelativeToComponent -
getPosition();
114 updateBoundsToFitChildren();
119 updateBoundsToFitChildren();
122void DrawableComposite::updateBoundsToFitChildren()
124 if (! updateBoundsReentrant)
138 if (! delta.isOrigin())
140 originRelativeToComponent -= delta;
157 if (
auto* d =
dynamic_cast<Drawable*
> (c))
158 p.
addPath (d->getOutlineAsPath());
The base class for all JUCE user-interface objects.
Rectangle< int > getBoundsInParent() const noexcept
Returns the area of this component's parent which this component covers.
AffineTransform getTransform() const
Returns the transform that is currently being applied to this component.
void deleteAllChildren()
Removes and deletes all of this component's children.
void setTransform(const AffineTransform &transform)
Sets a transform matrix to be applied to this component.
Point< int > getPosition() const noexcept
Returns the component's top-left position as a Point.
void addAndMakeVisible(Component *child, int zOrder=-1)
Adds a child component to this one, and also makes the child visible if it isn't already.
Rectangle< int > getBounds() const noexcept
Returns this component's bounding box.
void setBounds(int x, int y, int width, int height)
Changes the component's position and size.
const Array< Component * > & getChildren() const noexcept
Provides access to the underlying array of child components.
A drawable object which acts as a container for a set of other Drawables.
Rectangle< float > getDrawableBounds() const override
Returns the area that this drawable covers.
void setContentArea(Rectangle< float > newArea)
Changes the main content area.
~DrawableComposite() override
Destructor.
Path getOutlineAsPath() const override
Creates a path that describes the outline of this drawable.
DrawableComposite()
Creates a composite Drawable.
void resetBoundingBoxToContentArea()
Changes the bounding box transform to match the content area, so that any sub-items will be drawn at ...
void childBoundsChanged(Component *) override
Called when one of this component's children is moved or resized.
void childrenChanged() override
Subclasses can use this callback to be told when children are added or removed, or when their z-order...
void parentHierarchyChanged() override
Called to indicate that the component's parents have changed.
std::unique_ptr< Drawable > createCopy() const override
Creates a deep copy of this Drawable object.
void resetContentAreaAndBoundingBoxToFitChildren()
Resets the content area and the bounding transform to fit around the area occupied by the child compo...
void setBoundingBox(Parallelogram< float > newBoundingBox)
Sets the parallelogram that defines the target position of the content rectangle when the drawable is...
The base class for objects which can draw themselves, e.g.
DrawableComposite * getParent() const
Returns the DrawableComposite that contains this object, if there is one.
Represents a parallelogram that is defined by 3 points.
A path is a sequence of lines and curves that may either form a closed shape or be open-ended.
void addPath(const Path &pathToAppend)
Adds another path to this one.
void applyTransform(const AffineTransform &transform) noexcept
Applies a 2D transform to all the vertices in the path.
Manages a rectangle and allows geometric operations to be performed on it.
Point< ValueType > getPosition() const noexcept
Returns the rectangle's top-left position as a Point.
Point< ValueType > getBottomLeft() const noexcept
Returns the rectangle's bottom-left position as a Point.
Point< ValueType > getTopLeft() const noexcept
Returns the rectangle's top-left position as a Point.
Point< ValueType > getTopRight() const noexcept
Returns the rectangle's top-right position as a Point.
Rectangle getUnion(Rectangle other) const noexcept
Returns the smallest rectangle that contains both this one and the one passed-in.
Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...