JUCE  v5.1.1-3-g1a0b28c73
JUCE API
DropShadower Class Reference

Adds a drop-shadow to a component. More...

#include <juce_DropShadower.h>

Inheritance diagram for DropShadower:
Collaboration diagram for DropShadower:

Public Member Functions

 DropShadower (const DropShadow &shadowType)
 Creates a DropShadower. More...
 
 ~DropShadower ()
 Destructor. More...
 
void setOwner (Component *componentToFollow)
 Attaches the DropShadower to the component you want to shadow. More...
 

Private Member Functions

virtual void componentBeingDeleted (Component &component)
 Called when the component is in the process of being deleted. More...
 
void componentBroughtToFront (Component &) override
 Called when the component is brought to the top of the z-order. More...
 
void componentChildrenChanged (Component &) override
 Called when the component has children added or removed, or their z-order changes. More...
 
void componentMovedOrResized (Component &, bool, bool) override
 Called when the component's position or size changes. More...
 
virtual void componentNameChanged (Component &component)
 Called when the component's name is changed. More...
 
void componentParentHierarchyChanged (Component &) override
 Called to indicate that the component's parents have changed. More...
 
void componentVisibilityChanged (Component &) override
 Called when the component is made visible or invisible. More...
 
void updateParent ()
 
void updateShadows ()
 

Private Attributes

WeakReference< ComponentlastParentComp
 
Componentowner
 
bool reentrant
 
DropShadow shadow
 
OwnedArray< ComponentshadowWindows
 

Detailed Description

Adds a drop-shadow to a component.

This object creates and manages a set of components which sit around a component, creating a gaussian shadow around it. The components will track the position of the component and if it's brought to the front they'll also follow this.

For desktop windows you don't need to use this class directly - just set the Component::windowHasDropShadow flag when calling Component::addToDesktop(), and the system will create one of these if it's needed (which it obviously isn't on the Mac, for example).

Constructor & Destructor Documentation

◆ DropShadower()

DropShadower::DropShadower ( const DropShadow shadowType)

Creates a DropShadower.

◆ ~DropShadower()

DropShadower::~DropShadower ( )

Destructor.

Member Function Documentation

◆ componentBeingDeleted()

virtual void ComponentListener::componentBeingDeleted ( Component component)
virtualinherited

Called when the component is in the process of being deleted.

This callback is made from inside the destructor, so be very, very cautious about what you do in here.

In particular, bear in mind that it's the Component base class's destructor that calls this - so if the object that's being deleted is a subclass of Component, then the subclass layers of the object will already have been destructed when it gets to this point!

Reimplemented in ComponentMovementWatcher, and RelativeCoordinatePositionerBase.

Referenced by ComponentMovementWatcher::getComponent().

◆ componentBroughtToFront()

void DropShadower::componentBroughtToFront ( Component component)
overrideprivatevirtual

Called when the component is brought to the top of the z-order.

Parameters
componentthe component that was moved
See also
Component::toFront, Component::broughtToFront

Reimplemented from ComponentListener.

◆ componentChildrenChanged()

void DropShadower::componentChildrenChanged ( Component component)
overrideprivatevirtual

Called when the component has children added or removed, or their z-order changes.

Parameters
componentthe component whose children have changed
See also
Component::childrenChanged, Component::addChildComponent, Component::removeChildComponent

Reimplemented from ComponentListener.

◆ componentMovedOrResized()

void DropShadower::componentMovedOrResized ( Component component,
bool  wasMoved,
bool  wasResized 
)
overrideprivatevirtual

Called when the component's position or size changes.

Parameters
componentthe component that was moved or resized
wasMovedtrue if the component's top-left corner has just moved
wasResizedtrue if the component's width or height has just changed
See also
Component::setBounds, Component::resized, Component::moved

Reimplemented from ComponentListener.

◆ componentNameChanged()

virtual void ComponentListener::componentNameChanged ( Component component)
virtualinherited

Called when the component's name is changed.

See also
Component::setName, Component::getName

Reimplemented in MultiDocumentPanel.

Referenced by MultiDocumentPanel::getCurrentTabbedComponent().

◆ componentParentHierarchyChanged()

void DropShadower::componentParentHierarchyChanged ( Component component)
overrideprivatevirtual

Called to indicate that the component's parents have changed.

When a component is added or removed from its parent, all of its children will produce this notification (recursively - so all children of its children will also be called as well).

Parameters
componentthe component that this listener is registered with
See also
Component::parentHierarchyChanged

Reimplemented from ComponentListener.

◆ componentVisibilityChanged()

void DropShadower::componentVisibilityChanged ( Component component)
overrideprivatevirtual

Called when the component is made visible or invisible.

Parameters
componentthe component that changed
See also
Component::setVisible

Reimplemented from ComponentListener.

◆ setOwner()

void DropShadower::setOwner ( Component componentToFollow)

Attaches the DropShadower to the component you want to shadow.

◆ updateParent()

void DropShadower::updateParent ( )
private

◆ updateShadows()

void DropShadower::updateShadows ( )
private

Member Data Documentation

◆ lastParentComp

WeakReference<Component> DropShadower::lastParentComp
private

◆ owner

Component* DropShadower::owner
private

◆ reentrant

bool DropShadower::reentrant
private

◆ shadow

DropShadow DropShadower::shadow
private

◆ shadowWindows

OwnedArray<Component> DropShadower::shadowWindows
private

The documentation for this class was generated from the following file: