mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-29 02:40:05 +00:00
Created a new class Component::SafePointer that keeps a pointer to a component and automatically nulls it if the component is deleted - this makes it a much more elegant replacement for the old ComponentDeletionWatcher class. Removed Component::getComponentUnderMouse(), which doesn't fit with multi-touch interfaces - for similar functionality, use the Desktop::getMouseInputSource() methods to find out what MouseInputSources are available, and ask them about the component they are over or dragging.
This commit is contained in:
parent
bc5a7a6b7e
commit
5fecb8a353
49 changed files with 1251 additions and 1152 deletions
|
|
@ -38,10 +38,6 @@ ComponentMovementWatcher::ComponentMovementWatcher (Component* const component_)
|
|||
{
|
||||
jassert (component != 0); // can't use this with a null pointer..
|
||||
|
||||
#ifdef JUCE_DEBUG
|
||||
deletionWatcher = new ComponentDeletionWatcher (component_);
|
||||
#endif
|
||||
|
||||
component->addComponentListener (this);
|
||||
|
||||
registerWithParentComps();
|
||||
|
|
@ -57,10 +53,8 @@ ComponentMovementWatcher::~ComponentMovementWatcher()
|
|||
//==============================================================================
|
||||
void ComponentMovementWatcher::componentParentHierarchyChanged (Component&)
|
||||
{
|
||||
#ifdef JUCE_DEBUG
|
||||
// agh! don't delete the target component without deleting this object first!
|
||||
jassert (! deletionWatcher->hasBeenDeleted());
|
||||
#endif
|
||||
jassert (component != 0);
|
||||
|
||||
if (! reentrant)
|
||||
{
|
||||
|
|
@ -70,11 +64,9 @@ void ComponentMovementWatcher::componentParentHierarchyChanged (Component&)
|
|||
|
||||
if (peer != lastPeer)
|
||||
{
|
||||
ComponentDeletionWatcher watcher (component);
|
||||
|
||||
componentPeerChanged();
|
||||
|
||||
if (watcher.hasBeenDeleted())
|
||||
if (component == 0)
|
||||
return;
|
||||
|
||||
lastPeer = peer;
|
||||
|
|
@ -91,10 +83,8 @@ void ComponentMovementWatcher::componentParentHierarchyChanged (Component&)
|
|||
|
||||
void ComponentMovementWatcher::componentMovedOrResized (Component&, bool wasMoved, bool wasResized)
|
||||
{
|
||||
#ifdef JUCE_DEBUG
|
||||
// agh! don't delete the target component without deleting this object first!
|
||||
jassert (! deletionWatcher->hasBeenDeleted());
|
||||
#endif
|
||||
jassert (component != 0);
|
||||
|
||||
if (wasMoved)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue