JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_DragAndDropContainer.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
51{
52public:
53 //==============================================================================
59
62
63 //==============================================================================
95 void startDragging (const var& sourceDescription,
96 Component* sourceComponent,
97 const ScaledImage& dragImage = ScaledImage(),
98 bool allowDraggingToOtherJuceWindows = false,
99 const Point<int>* imageOffsetFromMouse = nullptr,
100 const MouseInputSource* inputSourceCausingDrag = nullptr);
101
102 [[deprecated ("This overload does not allow the image's scale to be specified. Use the other overload of startDragging instead.")]]
103 void startDragging (const var& sourceDescription,
104 Component* sourceComponent,
105 Image dragImage,
106 bool allowDraggingToOtherJuceWindows = false,
107 const Point<int>* imageOffsetFromMouse = nullptr,
108 const MouseInputSource* inputSourceCausingDrag = nullptr)
109 {
110 startDragging (sourceDescription,
111 sourceComponent,
112 ScaledImage (dragImage),
113 allowDraggingToOtherJuceWindows,
114 imageOffsetFromMouse,
115 inputSourceCausingDrag);
116 }
117
119 bool isDragAndDropActive() const;
120
122 int getNumCurrentDrags() const;
123
134 var getCurrentDragDescription() const;
135
140 var getDragDescriptionForIndex (int index) const;
141
149 void setCurrentDragImage (const ScaledImage& newImage);
150
151 [[deprecated ("This overload does not allow the image's scale to be specified. Use the other overload of setCurrentDragImage instead.")]]
152 void setCurrentDragImage (const Image& newImage) { setCurrentDragImage (ScaledImage (newImage)); }
153
158 void setDragImageForIndex (int index, const ScaledImage& newImage);
159
160 [[deprecated ("This overload does not allow the image's scale to be specified. Use the other overload of setDragImageForIndex instead.")]]
161 void setDragImageForIndex (int index, const Image& newImage) { setDragImageForIndex (index, ScaledImage (newImage)); }
162
173 static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);
174
175
176 //==============================================================================
195 static bool performExternalDragDropOfFiles (const StringArray& files, bool canMoveFiles,
196 Component* sourceComponent = nullptr,
197 std::function<void()> callback = nullptr);
198
215 static bool performExternalDragDropOfText (const String& text, Component* sourceComponent = nullptr,
216 std::function<void()> callback = nullptr);
217
218protected:
232 virtual bool shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails,
233 StringArray& files, bool& canMoveFiles);
234
246 virtual bool shouldDropTextWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails,
247 String& text);
248
250 virtual void dragOperationStarted (const DragAndDropTarget::SourceDetails&);
251
253 virtual void dragOperationEnded (const DragAndDropTarget::SourceDetails&);
254
255private:
256 //==============================================================================
257 class DragImageComponent;
258 OwnedArray<DragImageComponent> dragImageComponents;
259
260 const MouseInputSource* getMouseInputSourceForDrag (Component* sourceComponent, const MouseInputSource* inputSourceCausingDrag);
261 bool isAlreadyDragging (Component* sourceComponent) const noexcept;
262
264};
265
266} // namespace juce
The base class for all JUCE user-interface objects.
Enables drag-and-drop behaviour for a component and all its sub-components.
DragAndDropContainer()
Creates a DragAndDropContainer.
virtual ~DragAndDropContainer()
Destructor.
Holds a fixed-size bitmap.
Definition juce_Image.h:58
Represents a linear source of mouse events from a mouse device or individual finger in a multi-touch ...
A pair of (x, y) coordinates.
Definition juce_Point.h:42
An image that will be resampled before it is drawn.
A variant class, that can be used to hold a range of primitive values.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.