Loading...
Searching...
No Matches
juce::DrawableComposite Class Reference

Detailed Description

A drawable object which acts as a container for a set of other Drawables.

Note that although this is a Component, it takes ownership of its child components and will delete them, so that you can use it as a self-contained graphic object. The intention is that you should not add your own components to it, only add other Drawable objects.

See also
Drawable

The documentation for this class was generated from the following file:
Inheritance diagram for juce::DrawableComposite:

Public Member Functions

 DrawableComposite ()=default
 Creates a composite Drawable.
 DrawableComposite (const DrawableComposite &)
 Creates a copy of a DrawableComposite.
void setBoundingBox (Parallelogram< float > newBoundingBox)
 Sets the parallelogram that defines the target position of the content rectangle when the drawable is rendered.
void setBoundingBox (Rectangle< float > newBoundingBox)
 Sets the rectangle that defines the target position of the content rectangle when the drawable is rendered.
Parallelogram< float > getBoundingBox () const noexcept
 Returns the parallelogram that defines the target position of the content rectangle when the drawable is rendered.
void resetBoundingBoxToContentArea ()
 Changes the bounding box transform to match the content area, so that any sub-items will be drawn at their untransformed positions.
Rectangle< float > getContentArea () const noexcept
 Returns the main content rectangle.
void setContentArea (Rectangle< float > newArea)
 Changes the main content area.
void resetContentAreaAndBoundingBoxToFitChildren ()
 Resets the content area and the bounding transform to fit around the area occupied by the child components.
bool replaceColour (Colour originalColour, Colour replacementColour) override
 Recursively replaces a colour that might be used for filling or stroking.
bool hitTest (Point< float > p) const override
 Tests whether a given point is inside the Drawable.
void addChild (std::unique_ptr< Drawable > newChild)
 Adds a child Drawable to this one.
int getNumChildren () const
 Returns the number of child Drawables that this composite contains.
DrawablegetChild (int index)
const DrawablegetChild (int index) const
 Returns a child Drawable by its index.
void setBlendMode (BlendMode newBlendMode)
void setLuminanceMask (bool isMask)
void setOpacity (float newOpacity)
std::unique_ptr< DrawablecreateCopy () const override
 Creates a deep copy of this Drawable object.
Rectangle< float > getDrawableBoundsUntransformed () const override
 Returns the area that this drawable covers in its original coordinate system.
Path getOutlineAsPath () const override
 Creates a path that describes the outline of this drawable.
Public Member Functions inherited from juce::Drawable
 Drawable ()=default
 Constructor.
 Drawable (const Drawable &other)
 Copy constructor.
virtual ~Drawable ()=default
 Destructor.
void draw (Graphics &g, float opacity, const AffineTransform &transform=AffineTransform()) const
 Renders this Drawable object.
void drawAt (Graphics &g, float x, float y, float opacity) const
 Renders the Drawable at a given offset within the Graphics context.
void drawWithin (Graphics &g, Rectangle< float > destArea, RectanglePlacement placement, float opacity) const
 Renders the Drawable within a rectangle, scaling it to fit neatly inside without changing its aspect-ratio.
void setClipPath (std::unique_ptr< Drawable > drawableClipPath)
 Sets a the clipping region of this drawable using another drawable.
Rectangle< float > getDrawableBounds () const
 Returns the area that this drawable covers.
int getWidth () const
 Returns the width of the drawable bounds rounded up to the nearest integer.
int getHeight () const
 Returns the height of the drawable bounds rounded up to the nearest integer.
void setDrawableTransform (const AffineTransform &transform)
 Sets a transformation that applies to the same coordinate system in which the rest of the draw calls are made.
void setDrawableTransformToFit (const Rectangle< float > &area, RectanglePlacement placement)
 Calls setDrawableTransform() with a transform that will position this Drawable within the specified area in the untransformed coordinate system of the Drawable.
AffineTransform getDrawableTransform () const
 Returns the transform that is currently being applied to this drawable.
const StringgetName () const
 Returns the name of this Drawable object.
void setName (const String &newName)
 Sets the name of this drawable object.
void addListener (Listener *newListener)
 Adds a listener.
void removeListener (Listener *listenerToRemove)
 Removes a listener.
virtual bool isImage () const
virtual std::optional< StringgetContainedText () const

Additional Inherited Members

Static Public Member Functions inherited from juce::Drawable
static std::unique_ptr< DrawablecreateFromImageData (const void *data, size_t numBytes)
 Tries to turn some kind of image file into a drawable.
static std::unique_ptr< DrawablecreateFromImageDataStream (InputStream &dataSource)
 Tries to turn a stream containing some kind of image data into a drawable.
static std::unique_ptr< DrawablecreateFromImageFile (const File &file)
 Tries to turn a file containing some kind of image data into a drawable.
static std::unique_ptr< DrawablecreateFromSVGFile (const File &svgFile)
 Attempts to parse an SVG (Scalable Vector Graphics) document from a file, and to turn this into a Drawable tree.
static std::unique_ptr< DrawableCompositecreateFromSVGString (const String &svgString)
 Attempts to parse an SVG (Scalable Vector Graphics) document from a string, and to turn this into a Drawable tree.
static Path parseSVGPath (const String &svgPath)
 Parses an SVG path string and returns it.
Protected Member Functions inherited from juce::Drawable
virtual AffineTransform getTransform () const
void callListeners ()

Constructors and Destructors

◆ DrawableComposite() [1/2]

juce::DrawableComposite::DrawableComposite ( )
default

Creates a composite Drawable.

Referenced by DrawableComposite().

◆ DrawableComposite() [2/2]

juce::DrawableComposite::DrawableComposite ( const DrawableComposite & )

Creates a copy of a DrawableComposite.

References DrawableComposite().

Member Functions

◆ setBoundingBox() [1/2]

void juce::DrawableComposite::setBoundingBox ( Parallelogram< float > newBoundingBox)

Sets the parallelogram that defines the target position of the content rectangle when the drawable is rendered.

See also
setContentArea

◆ setBoundingBox() [2/2]

void juce::DrawableComposite::setBoundingBox ( Rectangle< float > newBoundingBox)

Sets the rectangle that defines the target position of the content rectangle when the drawable is rendered.

See also
setContentArea

◆ getBoundingBox()

Parallelogram< float > juce::DrawableComposite::getBoundingBox ( ) const
inlinenoexcept

Returns the parallelogram that defines the target position of the content rectangle when the drawable is rendered.

See also
setBoundingBox

◆ resetBoundingBoxToContentArea()

void juce::DrawableComposite::resetBoundingBoxToContentArea ( )

Changes the bounding box transform to match the content area, so that any sub-items will be drawn at their untransformed positions.

◆ getContentArea()

Rectangle< float > juce::DrawableComposite::getContentArea ( ) const
inlinenoexcept

Returns the main content rectangle.

See also
contentLeftMarkerName, contentRightMarkerName, contentTopMarkerName, contentBottomMarkerName

◆ setContentArea()

void juce::DrawableComposite::setContentArea ( Rectangle< float > newArea)

Changes the main content area.

See also
setBoundingBox, contentLeftMarkerName, contentRightMarkerName, contentTopMarkerName, contentBottomMarkerName

◆ resetContentAreaAndBoundingBoxToFitChildren()

void juce::DrawableComposite::resetContentAreaAndBoundingBoxToFitChildren ( )

Resets the content area and the bounding transform to fit around the area occupied by the child components.

◆ replaceColour()

bool juce::DrawableComposite::replaceColour ( Colour originalColour,
Colour replacementColour )
overridevirtual

Recursively replaces a colour that might be used for filling or stroking.

return true if any instances of this colour were found.

Reimplemented from juce::Drawable.

◆ hitTest()

bool juce::DrawableComposite::hitTest ( Point< float > p) const
overridevirtual

Tests whether a given point is inside the Drawable.

Implements juce::Drawable.

◆ addChild()

void juce::DrawableComposite::addChild ( std::unique_ptr< Drawable > newChild)

Adds a child Drawable to this one.

◆ getNumChildren()

int juce::DrawableComposite::getNumChildren ( ) const
inline

Returns the number of child Drawables that this composite contains.

◆ getChild() [1/2]

Drawable & juce::DrawableComposite::getChild ( int index)
inline

◆ getChild() [2/2]

const Drawable & juce::DrawableComposite::getChild ( int index) const
inline

Returns a child Drawable by its index.

References juce::Drawable::Drawable(), juce::isPositiveAndBelow(), and jassert.

◆ setBlendMode()

void juce::DrawableComposite::setBlendMode ( BlendMode newBlendMode)
inline

◆ setLuminanceMask()

void juce::DrawableComposite::setLuminanceMask ( bool isMask)
inline

◆ setOpacity()

void juce::DrawableComposite::setOpacity ( float newOpacity)
inline

◆ createCopy()

std::unique_ptr< Drawable > juce::DrawableComposite::createCopy ( ) const
overridevirtual

Creates a deep copy of this Drawable object.

Use this to create a new copy of this and any sub-objects in the tree.

Implements juce::Drawable.

◆ getDrawableBoundsUntransformed()

Rectangle< float > juce::DrawableComposite::getDrawableBoundsUntransformed ( ) const
overridevirtual

Returns the area that this drawable covers in its original coordinate system.

These bounds are not affected by setDrawableTransform().

See also
getDrawableBounds

Implements juce::Drawable.

◆ getOutlineAsPath()

Path juce::DrawableComposite::getOutlineAsPath ( ) const
overridevirtual

Creates a path that describes the outline of this drawable.

Implements juce::Drawable.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram