@@ -26,6 +26,8 @@ | |||||
#include "juce_IncludeCharacteristics.h" | #include "juce_IncludeCharacteristics.h" | ||||
#include "../../../juce_amalgamated.h" | #include "../../../juce_amalgamated.h" | ||||
#ifndef __JUCE_PLUGINHEADERS_JUCEHEADER__ | |||||
#define __JUCE_PLUGINHEADERS_JUCEHEADER__ | |||||
#if JUCE_MAC && JUCE_SUPPORT_CARBON | #if JUCE_MAC && JUCE_SUPPORT_CARBON | ||||
@@ -70,3 +72,5 @@ private: | |||||
#else | #else | ||||
struct FakeMouseMoveGenerator {}; | struct FakeMouseMoveGenerator {}; | ||||
#endif | #endif | ||||
#endif |
@@ -163,7 +163,7 @@ private: | |||||
}; | }; | ||||
//============================================================================== | //============================================================================== | ||||
class CustomMenuComponent : public PopupMenuCustomComponent, | |||||
class CustomMenuComponent : public PopupMenu::CustomComponent, | |||||
public Timer | public Timer | ||||
{ | { | ||||
public: | public: | ||||
@@ -48483,10 +48483,6 @@ public: | |||||
content->setWantsKeyboardFocus (false); | content->setWantsKeyboardFocus (false); | ||||
} | } | ||||
~ListViewport() | |||||
{ | |||||
} | |||||
ListBoxRowComponent* getComponentForRow (const int row) const throw() | ListBoxRowComponent* getComponentForRow (const int row) const throw() | ||||
{ | { | ||||
return rows [row % jmax (1, rows.size())]; | return rows [row % jmax (1, rows.size())]; | ||||
@@ -48510,7 +48506,7 @@ public: | |||||
return -1; | return -1; | ||||
} | } | ||||
void visibleAreaChanged (int, int, int, int) | |||||
void visibleAreaChanged (const Rectangle<int>&) | |||||
{ | { | ||||
updateVisibleArea (true); | updateVisibleArea (true); | ||||
@@ -52428,10 +52424,6 @@ public: | |||||
{ | { | ||||
} | } | ||||
~Iterator() | |||||
{ | |||||
} | |||||
bool next() | bool next() | ||||
{ | { | ||||
if (atom == &tempAtom) | if (atom == &tempAtom) | ||||
@@ -52948,35 +52940,31 @@ private: | |||||
class TextEditorViewport : public Viewport | class TextEditorViewport : public Viewport | ||||
{ | { | ||||
public: | public: | ||||
TextEditorViewport (TextEditor* const owner_) | |||||
TextEditorViewport (TextEditor& owner_) | |||||
: owner (owner_), lastWordWrapWidth (0), rentrant (false) | : owner (owner_), lastWordWrapWidth (0), rentrant (false) | ||||
{ | { | ||||
} | } | ||||
~TextEditorViewport() | |||||
{ | |||||
} | |||||
void visibleAreaChanged (int, int, int, int) | |||||
void visibleAreaChanged (const Rectangle<int>&) | |||||
{ | { | ||||
if (! rentrant) // it's rare, but possible to get into a feedback loop as the viewport's scrollbars | if (! rentrant) // it's rare, but possible to get into a feedback loop as the viewport's scrollbars | ||||
// appear and disappear, causing the wrap width to change. | // appear and disappear, causing the wrap width to change. | ||||
{ | { | ||||
const float wordWrapWidth = owner->getWordWrapWidth(); | |||||
const float wordWrapWidth = owner.getWordWrapWidth(); | |||||
if (wordWrapWidth != lastWordWrapWidth) | if (wordWrapWidth != lastWordWrapWidth) | ||||
{ | { | ||||
lastWordWrapWidth = wordWrapWidth; | lastWordWrapWidth = wordWrapWidth; | ||||
rentrant = true; | rentrant = true; | ||||
owner->updateTextHolderSize(); | |||||
owner.updateTextHolderSize(); | |||||
rentrant = false; | rentrant = false; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
private: | private: | ||||
TextEditor* const owner; | |||||
TextEditor& owner; | |||||
float lastWordWrapWidth; | float lastWordWrapWidth; | ||||
bool rentrant; | bool rentrant; | ||||
@@ -53034,7 +53022,7 @@ TextEditor::TextEditor (const String& name, | |||||
{ | { | ||||
setOpaque (true); | setOpaque (true); | ||||
addAndMakeVisible (viewport = new TextEditorViewport (this)); | |||||
addAndMakeVisible (viewport = new TextEditorViewport (*this)); | |||||
viewport->setViewedComponent (textHolder = new TextHolderComponent (*this)); | viewport->setViewedComponent (textHolder = new TextHolderComponent (*this)); | ||||
viewport->setWantsKeyboardFocus (false); | viewport->setWantsKeyboardFocus (false); | ||||
viewport->setScrollBarsShown (false, false); | viewport->setScrollBarsShown (false, false); | ||||
@@ -55784,10 +55772,6 @@ public: | |||||
{ | { | ||||
} | } | ||||
~TreeViewContentComponent() | |||||
{ | |||||
} | |||||
void mouseDown (const MouseEvent& e) | void mouseDown (const MouseEvent& e) | ||||
{ | { | ||||
updateButtonUnderMouse (e); | updateButtonUnderMouse (e); | ||||
@@ -56168,7 +56152,6 @@ class TreeView::TreeViewport : public Viewport | |||||
{ | { | ||||
public: | public: | ||||
TreeViewport() throw() : lastX (-1) {} | TreeViewport() throw() : lastX (-1) {} | ||||
~TreeViewport() throw() {} | |||||
void updateComponents (const bool triggerResize = false) | void updateComponents (const bool triggerResize = false) | ||||
{ | { | ||||
@@ -56184,10 +56167,10 @@ public: | |||||
repaint(); | repaint(); | ||||
} | } | ||||
void visibleAreaChanged (int x, int, int, int) | |||||
void visibleAreaChanged (const Rectangle<int>& newVisibleArea) | |||||
{ | { | ||||
const bool hasScrolledSideways = (x != lastX); | |||||
lastX = x; | |||||
const bool hasScrolledSideways = (newVisibleArea.getX() != lastX); | |||||
lastX = newVisibleArea.getX(); | |||||
updateComponents (hasScrolledSideways); | updateComponents (hasScrolledSideways); | ||||
} | } | ||||
@@ -64508,7 +64491,7 @@ Viewport::~Viewport() | |||||
deleteContentComp(); | deleteContentComp(); | ||||
} | } | ||||
void Viewport::visibleAreaChanged (int, int, int, int) | |||||
void Viewport::visibleAreaChanged (const Rectangle<int>&) | |||||
{ | { | ||||
} | } | ||||
@@ -64529,8 +64512,8 @@ void Viewport::setViewedComponent (Component* const newViewedComponent) | |||||
if (contentComp != 0) | if (contentComp != 0) | ||||
{ | { | ||||
contentComp->setTopLeftPosition (0, 0); | |||||
contentHolder.addAndMakeVisible (contentComp); | contentHolder.addAndMakeVisible (contentComp); | ||||
setViewPosition (0, 0); | |||||
contentComp->addComponentListener (this); | contentComp->addComponentListener (this); | ||||
} | } | ||||
@@ -64654,9 +64637,9 @@ void Viewport::updateVisibleArea() | |||||
Rectangle<int> contentBounds; | Rectangle<int> contentBounds; | ||||
if (contentComp != 0) | if (contentComp != 0) | ||||
contentBounds = contentComp->getBounds(); | |||||
contentBounds = contentHolder.getLocalArea (contentComp, contentComp->getLocalBounds()); | |||||
const Point<int> visibleOrigin (-contentBounds.getPosition()); | |||||
Point<int> visibleOrigin (-contentBounds.getPosition()); | |||||
if (hBarVisible) | if (hBarVisible) | ||||
{ | { | ||||
@@ -64666,6 +64649,10 @@ void Viewport::updateVisibleArea() | |||||
horizontalScrollBar.setSingleStepSize (singleStepX); | horizontalScrollBar.setSingleStepSize (singleStepX); | ||||
horizontalScrollBar.cancelPendingUpdate(); | horizontalScrollBar.cancelPendingUpdate(); | ||||
} | } | ||||
else | |||||
{ | |||||
visibleOrigin.setX (0); | |||||
} | |||||
if (vBarVisible) | if (vBarVisible) | ||||
{ | { | ||||
@@ -64675,11 +64662,17 @@ void Viewport::updateVisibleArea() | |||||
verticalScrollBar.setSingleStepSize (singleStepY); | verticalScrollBar.setSingleStepSize (singleStepY); | ||||
verticalScrollBar.cancelPendingUpdate(); | verticalScrollBar.cancelPendingUpdate(); | ||||
} | } | ||||
else | |||||
{ | |||||
visibleOrigin.setY (0); | |||||
} | |||||
// Force the visibility *after* setting the ranges to avoid flicker caused by edge conditions in the numbers. | // Force the visibility *after* setting the ranges to avoid flicker caused by edge conditions in the numbers. | ||||
horizontalScrollBar.setVisible (hBarVisible); | horizontalScrollBar.setVisible (hBarVisible); | ||||
verticalScrollBar.setVisible (vBarVisible); | verticalScrollBar.setVisible (vBarVisible); | ||||
setViewPosition (visibleOrigin); | |||||
const Rectangle<int> visibleArea (visibleOrigin.getX(), visibleOrigin.getY(), | const Rectangle<int> visibleArea (visibleOrigin.getX(), visibleOrigin.getY(), | ||||
jmin (contentBounds.getWidth() - visibleOrigin.getX(), contentArea.getWidth()), | jmin (contentBounds.getWidth() - visibleOrigin.getX(), contentArea.getWidth()), | ||||
jmin (contentBounds.getHeight() - visibleOrigin.getY(), contentArea.getHeight())); | jmin (contentBounds.getHeight() - visibleOrigin.getY(), contentArea.getHeight())); | ||||
@@ -64687,7 +64680,7 @@ void Viewport::updateVisibleArea() | |||||
if (lastVisibleArea != visibleArea) | if (lastVisibleArea != visibleArea) | ||||
{ | { | ||||
lastVisibleArea = visibleArea; | lastVisibleArea = visibleArea; | ||||
visibleAreaChanged (visibleArea.getX(), visibleArea.getY(), visibleArea.getWidth(), visibleArea.getHeight()); | |||||
visibleAreaChanged (visibleArea); | |||||
} | } | ||||
horizontalScrollBar.handleUpdateNowIfNeeded(); | horizontalScrollBar.handleUpdateNowIfNeeded(); | ||||
@@ -77287,6 +77280,32 @@ void ComponentPeer::handleFileDragExit (const StringArray& files) | |||||
lastDragAndDropCompUnderMouse = 0; | lastDragAndDropCompUnderMouse = 0; | ||||
} | } | ||||
// We'll use an async message to deliver the drop, because if the target decides | |||||
// to run a modal loop, it can gum-up the operating system.. | |||||
class AsyncFileDropMessage : public CallbackMessage | |||||
{ | |||||
public: | |||||
AsyncFileDropMessage (Component* target_, FileDragAndDropTarget* dropTarget_, | |||||
const Point<int>& position_, const StringArray& files_) | |||||
: target (target_), dropTarget (dropTarget_), position (position_), files (files_) | |||||
{ | |||||
} | |||||
void messageCallback() | |||||
{ | |||||
if (target != 0) | |||||
dropTarget->filesDropped (files, position.getX(), position.getY()); | |||||
} | |||||
private: | |||||
WeakReference<Component> target; | |||||
FileDragAndDropTarget* const dropTarget; | |||||
const Point<int> position; | |||||
const StringArray files; | |||||
JUCE_DECLARE_NON_COPYABLE (AsyncFileDropMessage); | |||||
}; | |||||
void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position) | void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position) | ||||
{ | { | ||||
handleFileDragMove (files, position); | handleFileDragMove (files, position); | ||||
@@ -77311,32 +77330,6 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in | |||||
return; | return; | ||||
} | } | ||||
// We'll use an async message to deliver the drop, because if the target decides | |||||
// to run a modal loop, it can gum-up the operating system.. | |||||
class AsyncFileDropMessage : public CallbackMessage | |||||
{ | |||||
public: | |||||
AsyncFileDropMessage (Component* target_, FileDragAndDropTarget* dropTarget_, | |||||
const Point<int>& position_, const StringArray& files_) | |||||
: target (target_), dropTarget (dropTarget_), position (position_), files (files_) | |||||
{ | |||||
} | |||||
void messageCallback() | |||||
{ | |||||
if (target != 0) | |||||
dropTarget->filesDropped (files, position.getX(), position.getY()); | |||||
} | |||||
private: | |||||
WeakReference<Component> target; | |||||
FileDragAndDropTarget* dropTarget; | |||||
Point<int> position; | |||||
StringArray files; | |||||
// (NB: don't make this non-copyable, which messes up in VC) | |||||
}; | |||||
(new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post(); | (new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post(); | ||||
} | } | ||||
} | } | ||||
@@ -37855,8 +37855,7 @@ public: | |||||
This will be called when the visible area is moved either be scrolling or | This will be called when the visible area is moved either be scrolling or | ||||
by calls to setViewPosition(), etc. | by calls to setViewPosition(), etc. | ||||
*/ | */ | ||||
virtual void visibleAreaChanged (int visibleX, int visibleY, | |||||
int visibleW, int visibleH); | |||||
virtual void visibleAreaChanged (const Rectangle<int>& newVisibleArea); | |||||
/** Turns scrollbars on or off. | /** Turns scrollbars on or off. | ||||
@@ -37938,6 +37937,11 @@ private: | |||||
void updateVisibleArea(); | void updateVisibleArea(); | ||||
void deleteContentComp(); | void deleteContentComp(); | ||||
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE | |||||
// If you get an error here, it's because this method's parameters have changed! See the new definition above.. | |||||
virtual int visibleAreaChanged (int, int, int, int) { return 0; } | |||||
#endif | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Viewport); | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Viewport); | ||||
}; | }; | ||||
@@ -169,10 +169,6 @@ public: | |||||
content->setWantsKeyboardFocus (false); | content->setWantsKeyboardFocus (false); | ||||
} | } | ||||
~ListViewport() | |||||
{ | |||||
} | |||||
ListBoxRowComponent* getComponentForRow (const int row) const throw() | ListBoxRowComponent* getComponentForRow (const int row) const throw() | ||||
{ | { | ||||
return rows [row % jmax (1, rows.size())]; | return rows [row % jmax (1, rows.size())]; | ||||
@@ -196,7 +192,7 @@ public: | |||||
return -1; | return -1; | ||||
} | } | ||||
void visibleAreaChanged (int, int, int, int) | |||||
void visibleAreaChanged (const Rectangle<int>&) | |||||
{ | { | ||||
updateVisibleArea (true); | updateVisibleArea (true); | ||||
@@ -382,10 +382,6 @@ public: | |||||
{ | { | ||||
} | } | ||||
~Iterator() | |||||
{ | |||||
} | |||||
//============================================================================== | //============================================================================== | ||||
bool next() | bool next() | ||||
{ | { | ||||
@@ -912,35 +908,31 @@ private: | |||||
class TextEditorViewport : public Viewport | class TextEditorViewport : public Viewport | ||||
{ | { | ||||
public: | public: | ||||
TextEditorViewport (TextEditor* const owner_) | |||||
TextEditorViewport (TextEditor& owner_) | |||||
: owner (owner_), lastWordWrapWidth (0), rentrant (false) | : owner (owner_), lastWordWrapWidth (0), rentrant (false) | ||||
{ | { | ||||
} | } | ||||
~TextEditorViewport() | |||||
{ | |||||
} | |||||
void visibleAreaChanged (int, int, int, int) | |||||
void visibleAreaChanged (const Rectangle<int>&) | |||||
{ | { | ||||
if (! rentrant) // it's rare, but possible to get into a feedback loop as the viewport's scrollbars | if (! rentrant) // it's rare, but possible to get into a feedback loop as the viewport's scrollbars | ||||
// appear and disappear, causing the wrap width to change. | // appear and disappear, causing the wrap width to change. | ||||
{ | { | ||||
const float wordWrapWidth = owner->getWordWrapWidth(); | |||||
const float wordWrapWidth = owner.getWordWrapWidth(); | |||||
if (wordWrapWidth != lastWordWrapWidth) | if (wordWrapWidth != lastWordWrapWidth) | ||||
{ | { | ||||
lastWordWrapWidth = wordWrapWidth; | lastWordWrapWidth = wordWrapWidth; | ||||
rentrant = true; | rentrant = true; | ||||
owner->updateTextHolderSize(); | |||||
owner.updateTextHolderSize(); | |||||
rentrant = false; | rentrant = false; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
private: | private: | ||||
TextEditor* const owner; | |||||
TextEditor& owner; | |||||
float lastWordWrapWidth; | float lastWordWrapWidth; | ||||
bool rentrant; | bool rentrant; | ||||
@@ -1000,7 +992,7 @@ TextEditor::TextEditor (const String& name, | |||||
{ | { | ||||
setOpaque (true); | setOpaque (true); | ||||
addAndMakeVisible (viewport = new TextEditorViewport (this)); | |||||
addAndMakeVisible (viewport = new TextEditorViewport (*this)); | |||||
viewport->setViewedComponent (textHolder = new TextHolderComponent (*this)); | viewport->setViewedComponent (textHolder = new TextHolderComponent (*this)); | ||||
viewport->setWantsKeyboardFocus (false); | viewport->setWantsKeyboardFocus (false); | ||||
viewport->setScrollBarsShown (false, false); | viewport->setScrollBarsShown (false, false); | ||||
@@ -47,10 +47,6 @@ public: | |||||
{ | { | ||||
} | } | ||||
~TreeViewContentComponent() | |||||
{ | |||||
} | |||||
void mouseDown (const MouseEvent& e) | void mouseDown (const MouseEvent& e) | ||||
{ | { | ||||
updateButtonUnderMouse (e); | updateButtonUnderMouse (e); | ||||
@@ -432,7 +428,6 @@ class TreeView::TreeViewport : public Viewport | |||||
{ | { | ||||
public: | public: | ||||
TreeViewport() throw() : lastX (-1) {} | TreeViewport() throw() : lastX (-1) {} | ||||
~TreeViewport() throw() {} | |||||
void updateComponents (const bool triggerResize = false) | void updateComponents (const bool triggerResize = false) | ||||
{ | { | ||||
@@ -448,10 +443,10 @@ public: | |||||
repaint(); | repaint(); | ||||
} | } | ||||
void visibleAreaChanged (int x, int, int, int) | |||||
void visibleAreaChanged (const Rectangle<int>& newVisibleArea) | |||||
{ | { | ||||
const bool hasScrolledSideways = (x != lastX); | |||||
lastX = x; | |||||
const bool hasScrolledSideways = (newVisibleArea.getX() != lastX); | |||||
lastX = newVisibleArea.getX(); | |||||
updateComponents (hasScrolledSideways); | updateComponents (hasScrolledSideways); | ||||
} | } | ||||
@@ -62,7 +62,7 @@ Viewport::~Viewport() | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
void Viewport::visibleAreaChanged (int, int, int, int) | |||||
void Viewport::visibleAreaChanged (const Rectangle<int>&) | |||||
{ | { | ||||
} | } | ||||
@@ -84,8 +84,8 @@ void Viewport::setViewedComponent (Component* const newViewedComponent) | |||||
if (contentComp != 0) | if (contentComp != 0) | ||||
{ | { | ||||
contentComp->setTopLeftPosition (0, 0); | |||||
contentHolder.addAndMakeVisible (contentComp); | contentHolder.addAndMakeVisible (contentComp); | ||||
setViewPosition (0, 0); | |||||
contentComp->addComponentListener (this); | contentComp->addComponentListener (this); | ||||
} | } | ||||
@@ -210,9 +210,9 @@ void Viewport::updateVisibleArea() | |||||
Rectangle<int> contentBounds; | Rectangle<int> contentBounds; | ||||
if (contentComp != 0) | if (contentComp != 0) | ||||
contentBounds = contentComp->getBounds(); | |||||
contentBounds = contentHolder.getLocalArea (contentComp, contentComp->getLocalBounds()); | |||||
const Point<int> visibleOrigin (-contentBounds.getPosition()); | |||||
Point<int> visibleOrigin (-contentBounds.getPosition()); | |||||
if (hBarVisible) | if (hBarVisible) | ||||
{ | { | ||||
@@ -222,6 +222,10 @@ void Viewport::updateVisibleArea() | |||||
horizontalScrollBar.setSingleStepSize (singleStepX); | horizontalScrollBar.setSingleStepSize (singleStepX); | ||||
horizontalScrollBar.cancelPendingUpdate(); | horizontalScrollBar.cancelPendingUpdate(); | ||||
} | } | ||||
else | |||||
{ | |||||
visibleOrigin.setX (0); | |||||
} | |||||
if (vBarVisible) | if (vBarVisible) | ||||
{ | { | ||||
@@ -231,11 +235,17 @@ void Viewport::updateVisibleArea() | |||||
verticalScrollBar.setSingleStepSize (singleStepY); | verticalScrollBar.setSingleStepSize (singleStepY); | ||||
verticalScrollBar.cancelPendingUpdate(); | verticalScrollBar.cancelPendingUpdate(); | ||||
} | } | ||||
else | |||||
{ | |||||
visibleOrigin.setY (0); | |||||
} | |||||
// Force the visibility *after* setting the ranges to avoid flicker caused by edge conditions in the numbers. | // Force the visibility *after* setting the ranges to avoid flicker caused by edge conditions in the numbers. | ||||
horizontalScrollBar.setVisible (hBarVisible); | horizontalScrollBar.setVisible (hBarVisible); | ||||
verticalScrollBar.setVisible (vBarVisible); | verticalScrollBar.setVisible (vBarVisible); | ||||
setViewPosition (visibleOrigin); | |||||
const Rectangle<int> visibleArea (visibleOrigin.getX(), visibleOrigin.getY(), | const Rectangle<int> visibleArea (visibleOrigin.getX(), visibleOrigin.getY(), | ||||
jmin (contentBounds.getWidth() - visibleOrigin.getX(), contentArea.getWidth()), | jmin (contentBounds.getWidth() - visibleOrigin.getX(), contentArea.getWidth()), | ||||
jmin (contentBounds.getHeight() - visibleOrigin.getY(), contentArea.getHeight())); | jmin (contentBounds.getHeight() - visibleOrigin.getY(), contentArea.getHeight())); | ||||
@@ -243,7 +253,7 @@ void Viewport::updateVisibleArea() | |||||
if (lastVisibleArea != visibleArea) | if (lastVisibleArea != visibleArea) | ||||
{ | { | ||||
lastVisibleArea = visibleArea; | lastVisibleArea = visibleArea; | ||||
visibleAreaChanged (visibleArea.getX(), visibleArea.getY(), visibleArea.getWidth(), visibleArea.getHeight()); | |||||
visibleAreaChanged (visibleArea); | |||||
} | } | ||||
horizontalScrollBar.handleUpdateNowIfNeeded(); | horizontalScrollBar.handleUpdateNowIfNeeded(); | ||||
@@ -179,8 +179,7 @@ public: | |||||
This will be called when the visible area is moved either be scrolling or | This will be called when the visible area is moved either be scrolling or | ||||
by calls to setViewPosition(), etc. | by calls to setViewPosition(), etc. | ||||
*/ | */ | ||||
virtual void visibleAreaChanged (int visibleX, int visibleY, | |||||
int visibleW, int visibleH); | |||||
virtual void visibleAreaChanged (const Rectangle<int>& newVisibleArea); | |||||
//============================================================================== | //============================================================================== | ||||
/** Turns scrollbars on or off. | /** Turns scrollbars on or off. | ||||
@@ -265,6 +264,11 @@ private: | |||||
void updateVisibleArea(); | void updateVisibleArea(); | ||||
void deleteContentComp(); | void deleteContentComp(); | ||||
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE | |||||
// If you get an error here, it's because this method's parameters have changed! See the new definition above.. | |||||
virtual int visibleAreaChanged (int, int, int, int) { return 0; } | |||||
#endif | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Viewport); | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Viewport); | ||||
}; | }; | ||||
@@ -484,6 +484,32 @@ void ComponentPeer::handleFileDragExit (const StringArray& files) | |||||
lastDragAndDropCompUnderMouse = 0; | lastDragAndDropCompUnderMouse = 0; | ||||
} | } | ||||
// We'll use an async message to deliver the drop, because if the target decides | |||||
// to run a modal loop, it can gum-up the operating system.. | |||||
class AsyncFileDropMessage : public CallbackMessage | |||||
{ | |||||
public: | |||||
AsyncFileDropMessage (Component* target_, FileDragAndDropTarget* dropTarget_, | |||||
const Point<int>& position_, const StringArray& files_) | |||||
: target (target_), dropTarget (dropTarget_), position (position_), files (files_) | |||||
{ | |||||
} | |||||
void messageCallback() | |||||
{ | |||||
if (target != 0) | |||||
dropTarget->filesDropped (files, position.getX(), position.getY()); | |||||
} | |||||
private: | |||||
WeakReference<Component> target; | |||||
FileDragAndDropTarget* const dropTarget; | |||||
const Point<int> position; | |||||
const StringArray files; | |||||
JUCE_DECLARE_NON_COPYABLE (AsyncFileDropMessage); | |||||
}; | |||||
void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position) | void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position) | ||||
{ | { | ||||
handleFileDragMove (files, position); | handleFileDragMove (files, position); | ||||
@@ -508,32 +534,6 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in | |||||
return; | return; | ||||
} | } | ||||
// We'll use an async message to deliver the drop, because if the target decides | |||||
// to run a modal loop, it can gum-up the operating system.. | |||||
class AsyncFileDropMessage : public CallbackMessage | |||||
{ | |||||
public: | |||||
AsyncFileDropMessage (Component* target_, FileDragAndDropTarget* dropTarget_, | |||||
const Point<int>& position_, const StringArray& files_) | |||||
: target (target_), dropTarget (dropTarget_), position (position_), files (files_) | |||||
{ | |||||
} | |||||
void messageCallback() | |||||
{ | |||||
if (target != 0) | |||||
dropTarget->filesDropped (files, position.getX(), position.getY()); | |||||
} | |||||
private: | |||||
WeakReference<Component> target; | |||||
FileDragAndDropTarget* dropTarget; | |||||
Point<int> position; | |||||
StringArray files; | |||||
// (NB: don't make this non-copyable, which messes up in VC) | |||||
}; | |||||
(new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post(); | (new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post(); | ||||
} | } | ||||
} | } | ||||