ComponentMovementWatcher Class Referenceabstract
juce_gui_basics » layout

An object that watches for any movement of a component or any of its parent components. More...

Inheritance diagram for ComponentMovementWatcher:

## Public Member Functions

| ComponentMovementWatcher (Component *componentToWatch)
| Creates a ComponentMovementWatcher to watch a given target component. More...
| ~ComponentMovementWatcher () override
| Destructor. More...
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...
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...
Component * | getComponent () const noexcept
| Returns the component that's being watched. More...
void | componentParentHierarchyChanged (Component &) override
void | componentMovedOrResized (Component &, bool wasMoved, bool wasResized) override
void | componentBeingDeleted (Component &) override
void | componentVisibilityChanged (Component &) override
Public Member Functions inherited from ComponentListener
virtual | ~ComponentListener ()=default
| Destructor. More...
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 | componentNameChanged (Component &component)
| Called when the component's name is changed. More...
virtual void | componentEnablementChanged (Component &component)

## Detailed Description

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.

## Constructor & Destructor Documentation

## ComponentMovementWatcher()

ComponentMovementWatcher::ComponentMovementWatcher | ( | Component * | componentToWatch | ) |

Creates a ComponentMovementWatcher to watch a given target component.

## ~ComponentMovementWatcher()

ComponentMovementWatcher::~ComponentMovementWatcher | ( |  | ) |

override

Destructor.

## Member Function Documentation

## componentMovedOrResized() [1/2]

virtual void ComponentMovementWatcher::componentMovedOrResized | ( | bool | wasMoved,
|  | bool | wasResized
| ) |  |

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.

## componentPeerChanged()

virtual void ComponentMovementWatcher::componentPeerChanged | ( |  | ) |

pure virtual

This callback happens when the component's top-level peer is changed.

## componentVisibilityChanged() [1/2]

virtual void ComponentMovementWatcher::componentVisibilityChanged | ( |  | ) |

pure virtual

This callback happens when the component's visibility state changes, possibly due to one of its parents being made visible or invisible.

## getComponent()

Component* ComponentMovementWatcher::getComponent | ( |  | ) | const

noexcept

Returns the component that's being watched.

## componentParentHierarchyChanged()

void ComponentMovementWatcher::componentParentHierarchyChanged | ( | Component & |  | ) |

override virtual

Reimplemented from ComponentListener.

## componentMovedOrResized() [2/2]

void ComponentMovementWatcher::componentMovedOrResized | ( | Component & | ,
|  | bool | wasMoved,
|  | bool | wasResized
| ) |  |

override virtual

Reimplemented from ComponentListener.

## componentBeingDeleted()

void ComponentMovementWatcher::componentBeingDeleted | ( | Component & |  | ) |

override virtual

Reimplemented from ComponentListener.

## componentVisibilityChanged() [2/2]

void ComponentMovementWatcher::componentVisibilityChanged | ( | Component & |  | ) |

override virtual

Reimplemented from ComponentListener.

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

- juce_ComponentMovementWatcher.h