31 wasShowing (comp->isShowing())
35 component->addComponentListener (
this);
36 registerWithParentComps();
41 if (component !=
nullptr)
42 component->removeComponentListener (
this);
50 if (component !=
nullptr && ! reentrant)
54 auto* peer = component->getPeer();
55 auto peerID = peer !=
nullptr ? peer->getUniqueID() : 0;
57 if (peerID != lastPeerID)
61 if (component ==
nullptr)
68 registerWithParentComps();
72 if (component !=
nullptr)
79 if (component !=
nullptr)
84 auto* top = component->getTopLevelComponent();
89 newPos = top->getPosition();
96 lastBounds.
setSize (component->getWidth(), component->getHeight());
105 registeredParentComps.removeFirstMatchingValue (&comp);
107 if (component == &comp)
113 if (component !=
nullptr)
125void ComponentMovementWatcher::registerWithParentComps()
127 for (
auto* p = component->getParentComponent(); p !=
nullptr; p = p->getParentComponent())
129 p->addComponentListener (
this);
130 registeredParentComps.add (p);
134void ComponentMovementWatcher::unregister()
136 for (
auto* c : registeredParentComps)
137 c->removeComponentListener (
this);
139 registeredParentComps.clear();
void componentBeingDeleted(Component &) override
Called when the component is in the process of being deleted.
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 pee...
void componentParentHierarchyChanged(Component &) override
Called to indicate that the component's parents have changed.
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 paren...
ComponentMovementWatcher(Component *componentToWatch)
Creates a ComponentMovementWatcher to watch a given target component.
~ComponentMovementWatcher() override
Destructor.
The base class for all JUCE user-interface objects.
A pair of (x, y) coordinates.
Point< ValueType > getPosition() const noexcept
Returns the rectangle's top-left position as a Point.
void setSize(ValueType newWidth, ValueType newHeight) noexcept
Changes the rectangle's size, leaving the position of its top-left corner unchanged.
ValueType getWidth() const noexcept
Returns the width of the rectangle.
void setPosition(Point< ValueType > newPos) noexcept
Changes the position of the rectangle's top-left corner (leaving its size unchanged).
ValueType getHeight() const noexcept
Returns the height of the rectangle.
Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...