juce_DragAndDropContainer.h

Go to the documentation of this file.
00001 /*
00002   ==============================================================================
00003 
00004    This file is part of the JUCE library - "Jules' Utility Class Extensions"
00005    Copyright 2004-7 by Raw Material Software ltd.
00006 
00007   ------------------------------------------------------------------------------
00008 
00009    JUCE can be redistributed and/or modified under the terms of the
00010    GNU General Public License, as published by the Free Software Foundation;
00011    either version 2 of the License, or (at your option) any later version.
00012 
00013    JUCE is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with JUCE; if not, visit www.gnu.org/licenses or write to the
00020    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00021    Boston, MA 02111-1307 USA
00022 
00023   ------------------------------------------------------------------------------
00024 
00025    If you'd like to release a closed-source product which uses JUCE, commercial
00026    licenses are also available: visit www.rawmaterialsoftware.com/juce for
00027    more information.
00028 
00029   ==============================================================================
00030 */
00031 
00032 #ifndef __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
00033 #define __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__
00034 
00035 #include "juce_DragAndDropTarget.h"
00036 
00037 
00038 //==============================================================================
00057 class JUCE_API  DragAndDropContainer
00058 {
00059 public:
00060     //==============================================================================
00065     DragAndDropContainer();
00066 
00068     virtual ~DragAndDropContainer();
00069 
00070     //==============================================================================
00095     void startDragging (const String& sourceDescription,
00096                         Component* sourceComponent,
00097                         Image* dragImage = 0,
00098                         const bool allowDraggingToOtherJuceWindows = false);
00099 
00101     bool isDragAndDropActive() const;
00102 
00110     const String getCurrentDragDescription() const;
00111 
00122     static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
00123 
00124 
00125     //==============================================================================
00141     static bool performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles);
00142 
00156     static bool performExternalDragDropOfText (const String& text);
00157 
00158     //==============================================================================
00159     juce_UseDebuggingNewOperator
00160 
00161 protected:
00177     virtual bool shouldDropFilesWhenDraggedExternally (const String& dragSourceDescription,
00178                                                        Component* dragSourceComponent,
00179                                                        StringArray& files,
00180                                                        bool& canMoveFiles);
00181 
00182 private:
00183     friend class DragImageComponent;
00184     Component* dragImageComponent;
00185     String currentDragDesc;
00186 };
00187 
00188 
00189 #endif   // __JUCE_DRAGANDDROPCONTAINER_JUCEHEADER__