LMMS
Loading...
Searching...
No Matches
juce::ComponentMovementWatcher Class Referenceabstract

#include <juce_ComponentMovementWatcher.h>

Inheritance diagram for juce::ComponentMovementWatcher:
juce::ComponentListener juce::ActiveXControlComponent::Pimpl juce::AndroidViewComponent::Pimpl juce::HWNDComponent::Pimpl juce::ModalComponentManager::ModalItem juce::NativeScaleFactorNotifier juce::Win32WebView::EventHandler

Public Member Functions

 ComponentMovementWatcher (Component *componentToWatch)
 ~ComponentMovementWatcher () override
virtual void componentMovedOrResized (bool wasMoved, bool wasResized)=0
virtual void componentPeerChanged ()=0
virtual void componentVisibilityChanged ()=0
ComponentgetComponent () const noexcept
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 juce::ComponentListener
virtual ~ComponentListener ()=default
virtual void componentBroughtToFront (Component &component)
virtual void componentChildrenChanged (Component &component)
virtual void componentNameChanged (Component &component)
virtual void componentEnablementChanged (Component &component)

Private Member Functions

void unregister ()
void registerWithParentComps ()

Private Attributes

WeakReference< Componentcomponent
uint32 lastPeerID = 0
Array< Component * > registeredParentComps
bool reentrant = false
bool wasShowing
Rectangle< intlastBounds

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.

@tags{GUI}

Constructor & Destructor Documentation

◆ ComponentMovementWatcher()

juce::ComponentMovementWatcher::ComponentMovementWatcher ( Component * componentToWatch)

Creates a ComponentMovementWatcher to watch a given target component.

◆ ~ComponentMovementWatcher()

juce::ComponentMovementWatcher::~ComponentMovementWatcher ( )
override

Destructor.

Member Function Documentation

◆ componentBeingDeleted()

void juce::ComponentMovementWatcher::componentBeingDeleted ( Component & component)
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!

Parameters
componentthe component that was deleted

Reimplemented from juce::ComponentListener.

Reimplemented in juce::ModalComponentManager::ModalItem.

◆ componentMovedOrResized() [1/2]

virtual void juce::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.

Implemented in juce::ActiveXControlComponent::Pimpl, juce::AndroidViewComponent::Pimpl, juce::HWNDComponent::Pimpl, juce::ModalComponentManager::ModalItem, juce::NativeScaleFactorNotifier, and juce::Win32WebView::EventHandler.

◆ componentMovedOrResized() [2/2]

void juce::ComponentMovementWatcher::componentMovedOrResized ( Component & component,
bool wasMoved,
bool wasResized )
overridevirtual

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 juce::ComponentListener.

Reimplemented in juce::ActiveXControlComponent::Pimpl, juce::HWNDComponent::Pimpl, juce::ModalComponentManager::ModalItem, juce::NativeScaleFactorNotifier, and juce::Win32WebView::EventHandler.

◆ componentParentHierarchyChanged()

void juce::ComponentMovementWatcher::componentParentHierarchyChanged ( Component & component)
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).

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

Reimplemented from juce::ComponentListener.

◆ componentPeerChanged()

virtual void juce::ComponentMovementWatcher::componentPeerChanged ( )
pure virtual

◆ componentVisibilityChanged() [1/2]

virtual void juce::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.

Implemented in juce::ActiveXControlComponent::Pimpl, juce::AndroidViewComponent::Pimpl, juce::HWNDComponent::Pimpl, juce::ModalComponentManager::ModalItem, juce::NativeScaleFactorNotifier, and juce::Win32WebView::EventHandler.

◆ componentVisibilityChanged() [2/2]

void juce::ComponentMovementWatcher::componentVisibilityChanged ( Component & component)
overridevirtual

Called when the component is made visible or invisible.

Parameters
componentthe component that changed
See also
Component::setVisible

Reimplemented from juce::ComponentListener.

Reimplemented in juce::ActiveXControlComponent::Pimpl, juce::HWNDComponent::Pimpl, juce::ModalComponentManager::ModalItem, juce::NativeScaleFactorNotifier, and juce::Win32WebView::EventHandler.

◆ getComponent()

Component * juce::ComponentMovementWatcher::getComponent ( ) const
inlinenoexcept

Returns the component that's being watched.

◆ registerWithParentComps()

void juce::ComponentMovementWatcher::registerWithParentComps ( )
private

◆ unregister()

void juce::ComponentMovementWatcher::unregister ( )
private

Member Data Documentation

◆ component

WeakReference<Component> juce::ComponentMovementWatcher::component
private

◆ lastBounds

Rectangle<int> juce::ComponentMovementWatcher::lastBounds
private

◆ lastPeerID

uint32 juce::ComponentMovementWatcher::lastPeerID = 0
private

◆ reentrant

bool juce::ComponentMovementWatcher::reentrant = false
private

◆ registeredParentComps

Array<Component*> juce::ComponentMovementWatcher::registeredParentComps
private

◆ wasShowing

bool juce::ComponentMovementWatcher::wasShowing
private

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