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. More... | |
~ComponentMovementWatcher () override | |
Destructor. More... | |
void | componentBeingDeleted (Component &) override |
virtual void | componentBroughtToFront (Component &component) |
Called when the component is brought to the top of the z-order. More... | |
virtual void | componentChildrenChanged (Component &component) |
Called when the component has children added or removed, or their z-order changes. More... | |
virtual void | componentEnablementChanged (Component &component) |
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. More... | |
void | componentMovedOrResized (Component &, bool wasMoved, bool wasResized) override |
virtual void | componentNameChanged (Component &component) |
Called when the component's name is changed. More... | |
void | componentParentHierarchyChanged (Component &) override |
virtual void | componentPeerChanged ()=0 |
This callback happens when the component's top-level peer is changed. More... | |
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. More... | |
void | componentVisibilityChanged (Component &) override |
Component * | getComponent () const noexcept |
Returns the component that's being watched. More... | |
Private Member Functions | |
void | registerWithParentComps () |
void | unregister () |
Private Attributes | |
WeakReference< Component > | component |
Rectangle< int > | lastBounds |
uint32 | lastPeerID = 0 |
bool | reentrant = false |
Array< Component * > | registeredParentComps |
bool | wasShowing |
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.
@tags{GUI}
juce::ComponentMovementWatcher::ComponentMovementWatcher | ( | Component * | componentToWatch | ) |
Creates a ComponentMovementWatcher to watch a given target component.
|
override |
Destructor.
|
overridevirtual |
Reimplemented from juce::ComponentListener.
|
virtualinherited |
Called when the component is brought to the top of the z-order.
component | the component that was moved |
Reimplemented in juce::FocusOutline, and juce::DropShadower.
|
virtualinherited |
Called when the component has children added or removed, or their z-order changes.
component | the component whose children have changed |
Reimplemented in juce::DropShadower, and juce::RelativeCoordinatePositionerBase.
|
virtualinherited |
|
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.
Implemented in juce::CarbonViewWrapperComponent.
Referenced by juce::CarbonViewWrapperComponent::componentMovedOrResized().
|
overridevirtual |
Reimplemented from juce::ComponentListener.
Reimplemented in juce::CarbonViewWrapperComponent.
|
virtualinherited |
Called when the component's name is changed.
component | the component that had its name changed |
Reimplemented in juce::MultiDocumentPanel.
|
overridevirtual |
Reimplemented from juce::ComponentListener.
|
pure virtual |
This callback happens when the component's top-level peer is changed.
Implemented in juce::CarbonViewWrapperComponent.
|
pure virtual |
This callback happens when the component's visibility state changes, possibly due to one of its parents being made visible or invisible.
Implemented in juce::CarbonViewWrapperComponent.
|
overridevirtual |
Reimplemented from juce::ComponentListener.
|
inlinenoexcept |
Returns the component that's being watched.
|
private |
|
private |
|
private |
Referenced by juce::CarbonViewWrapperComponent::componentMovedOrResized().
|
private |
|
private |
|
private |