diff --git a/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.cpp b/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.cpp index 1491e0fe70..51cb72d860 100644 --- a/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.cpp +++ b/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.cpp @@ -90,9 +90,11 @@ public: } //============================================================================== - bool mightContainSubItems() { return isDirectory; } - const String getUniqueName() const { return file.getFullPathName(); } - int getItemHeight() const { return 22; } + bool mightContainSubItems() { return isDirectory; } + const String getUniqueName() const { return file.getFullPathName(); } + int getItemHeight() const { return 22; } + + const String getDragSourceDescription() { return owner.getDragAndDropDescription(); } void itemOpennessChanged (bool isNowOpen) { @@ -271,5 +273,9 @@ void FileTreeComponent::scrollToTop() getViewport()->getVerticalScrollBar()->setCurrentRangeStart (0); } +void FileTreeComponent::setDragAndDropDescription (const String& description) throw() +{ + dragAndDropDescription = description; +} END_JUCE_NAMESPACE diff --git a/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h b/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h index 813909c0c5..7abca4b5f5 100644 --- a/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h +++ b/src/juce_appframework/gui/components/filebrowser/juce_FileTreeComponent.h @@ -80,10 +80,23 @@ public: /** Scrolls the list to the top. */ void scrollToTop(); + /** Setting a name for this allows tree items to be dragged. + + The string that you pass in here will be returned by the getDragSourceDescription() + of the items in the tree. For more info, see TreeViewItem::getDragSourceDescription(). + */ + void setDragAndDropDescription (const String& description) throw(); + + /** Returns the last value that was set by setDragAndDropDescription(). + */ + const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; } + //============================================================================== juce_UseDebuggingNewOperator private: + String dragAndDropDescription; + FileTreeComponent (const FileTreeComponent&); const FileTreeComponent& operator= (const FileTreeComponent&); };