An object that watches for any movement of a component or any of its parent components. More...
#include <juce_ComponentMovementWatcher.h>
Public Member Functions | |
ComponentMovementWatcher (Component *componentToWatch) | |
Creates a ComponentMovementWatcher to watch a given target component. | |
~ComponentMovementWatcher () override | |
Destructor. | |
virtual void | componentMovedOrResized (bool wasMoved, bool wasResized)=0 |
This callback happens when the component that is being watched is moved relative to its top-level peer window, or when it is resized. | |
virtual void | componentPeerChanged ()=0 |
This callback happens when the component's top-level peer is changed. | |
virtual void | componentVisibilityChanged ()=0 |
This callback happens when the component's visibility state changes, possibly due to one of its parents being made visible or invisible. | |
Component * | getComponent () const noexcept |
Returns the component that's being watched. | |
void | componentParentHierarchyChanged (Component &) override |
Called to indicate that the component's parents have changed. | |
void | componentMovedOrResized (Component &, bool wasMoved, bool wasResized) override |
Called when the component's position or size changes. | |
void | componentBeingDeleted (Component &) override |
Called when the component is in the process of being deleted. | |
void | componentVisibilityChanged (Component &) override |
Called when the component is made visible or invisible. | |
Public Member Functions inherited from ComponentListener | |
virtual | ~ComponentListener ()=default |
Destructor. | |
virtual void | componentBroughtToFront (Component &component) |
Called when the component is brought to the top of the z-order. | |
virtual void | componentChildrenChanged (Component &component) |
Called when the component has children added or removed, or their z-order changes. | |
virtual void | componentNameChanged (Component &component) |
Called when the component's name is changed. | |
virtual void | componentEnablementChanged (Component &component) |
An object that watches for any movement of a component or any of its parent components.
This makes it easy to check when a component is moved relative to its top-level peer window. The normal Component::moved() method is only called when a component moves relative to its immediate parent, and sometimes you want to know if any of components higher up the tree have moved (which of course will affect the overall position of all their sub-components).
It also includes a callback that lets you know when the top-level peer is changed.
This class is used by specialised components like WebBrowserComponent because they need to keep their custom windows in the right place and respond to changes in the peer.
ComponentMovementWatcher::ComponentMovementWatcher | ( | Component * | componentToWatch | ) |
Creates a ComponentMovementWatcher to watch a given target component.
|
override |
Destructor.
|
pure virtual |
This callback happens when the component that is being watched is moved relative to its top-level peer window, or when it is resized.
|
pure virtual |
This callback happens when the component's top-level peer is changed.
|
pure virtual |
This callback happens when the component's visibility state changes, possibly due to one of its parents being made visible or invisible.
|
noexcept |
Returns the component that's being watched.
|
overridevirtual |
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).
component | the component that this listener is registered with |
Reimplemented from ComponentListener.
|
overridevirtual |
Called when the component's position or size changes.
component | the component that was moved or resized |
wasMoved | true if the component's top-left corner has just moved |
wasResized | true if the component's width or height has just changed |
Reimplemented from ComponentListener.
|
overridevirtual |
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!
component | the component that was deleted |
Reimplemented from ComponentListener.
|
overridevirtual |
Called when the component is made visible or invisible.
component | the component that changed |
Reimplemented from ComponentListener.