mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added support for drag and drop of text on OSX, via DragAndDropContainer::shouldDropTextWhenDraggedExternally
This commit is contained in:
parent
b1d3069464
commit
dd13702684
3 changed files with 135 additions and 42 deletions
|
|
@ -300,12 +300,17 @@ private:
|
|||
: files (f), canMoveFiles (canMove)
|
||||
{}
|
||||
|
||||
ExternalDragAndDropMessage (const String& t) : text (t), canMoveFiles() {}
|
||||
|
||||
void messageCallback() override
|
||||
{
|
||||
DragAndDropContainer::performExternalDragDropOfFiles (files, canMoveFiles);
|
||||
if (text.isEmpty())
|
||||
DragAndDropContainer::performExternalDragDropOfFiles (files, canMoveFiles);
|
||||
else
|
||||
DragAndDropContainer::performExternalDragDropOfText (text);
|
||||
}
|
||||
|
||||
private:
|
||||
String text;
|
||||
StringArray files;
|
||||
bool canMoveFiles;
|
||||
};
|
||||
|
|
@ -318,14 +323,21 @@ private:
|
|||
{
|
||||
hasCheckedForExternalDrag = true;
|
||||
StringArray files;
|
||||
String text;
|
||||
bool canMoveFiles = false;
|
||||
|
||||
if (owner.shouldDropFilesWhenDraggedExternally (details, files, canMoveFiles)
|
||||
&& files.size() > 0
|
||||
&& ModifierKeys::getCurrentModifiersRealtime().isAnyMouseButtonDown())
|
||||
if (ModifierKeys::getCurrentModifiersRealtime().isAnyMouseButtonDown())
|
||||
{
|
||||
(new ExternalDragAndDropMessage (files, canMoveFiles))->post();
|
||||
deleteSelf();
|
||||
if (owner.shouldDropFilesWhenDraggedExternally (details, files, canMoveFiles) && ! files.isEmpty())
|
||||
{
|
||||
(new ExternalDragAndDropMessage (files, canMoveFiles))->post();
|
||||
deleteSelf();
|
||||
}
|
||||
else if (owner.shouldDropTextWhenDraggedExternally (details, text) && text.isNotEmpty())
|
||||
{
|
||||
(new ExternalDragAndDropMessage (text))->post();
|
||||
deleteSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -500,6 +512,11 @@ bool DragAndDropContainer::shouldDropFilesWhenDraggedExternally (const DragAndDr
|
|||
return false;
|
||||
}
|
||||
|
||||
bool DragAndDropContainer::shouldDropTextWhenDraggedExternally (const DragAndDropTarget::SourceDetails&, String&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void DragAndDropContainer::dragOperationStarted (const DragAndDropTarget::SourceDetails&) {}
|
||||
void DragAndDropContainer::dragOperationEnded (const DragAndDropTarget::SourceDetails&) {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue