mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-04 03:40:07 +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
|
|
@ -193,13 +193,8 @@ void MenuBarComponent::showMenu (int index)
|
|||
currentPopup = 0;
|
||||
menuBarItemsChanged (0);
|
||||
|
||||
Component* const prevFocused = getCurrentlyFocusedComponent();
|
||||
|
||||
ScopedPointer <ComponentDeletionWatcher> prevCompDeletionChecker;
|
||||
if (prevFocused != 0)
|
||||
prevCompDeletionChecker = new ComponentDeletionWatcher (prevFocused);
|
||||
|
||||
ComponentDeletionWatcher deletionChecker (this);
|
||||
Component::SafePointer<Component> prevFocused (getCurrentlyFocusedComponent());
|
||||
Component::SafePointer<Component> deletionChecker (this);
|
||||
|
||||
enterModalState (false);
|
||||
inModalState = true;
|
||||
|
|
@ -244,7 +239,7 @@ void MenuBarComponent::showMenu (int index)
|
|||
// be stuck behind other comps that are already modal..
|
||||
result = currentPopup->runModalLoop();
|
||||
|
||||
if (deletionChecker.hasBeenDeleted())
|
||||
if (deletionChecker == 0)
|
||||
return;
|
||||
|
||||
const int lastPopupIndex = currentPopupIndex;
|
||||
|
|
@ -276,7 +271,7 @@ void MenuBarComponent::showMenu (int index)
|
|||
inModalState = false;
|
||||
exitModalState (0);
|
||||
|
||||
if (prevCompDeletionChecker != 0 && ! prevCompDeletionChecker->hasBeenDeleted())
|
||||
if (prevFocused != 0)
|
||||
prevFocused->grabKeyboardFocus();
|
||||
|
||||
const Point<int> mousePos (getMouseXYRelative());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue