LMMS
Loading...
Searching...
No Matches
juce_DragAndDropContainer.cpp
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
29bool juce_performDragDropFiles (const StringArray&, const bool copyFiles, bool& shouldStop);
30bool juce_performDragDropText (const String&, bool& shouldStop);
31
32
33//==============================================================================
35 private Timer
36{
37public:
39 const var& desc,
40 Component* const sourceComponent,
41 const MouseInputSource* draggingSource,
43 Point<int> offset)
44 : sourceDetails (desc, sourceComponent, Point<int>()),
45 image (im),
46 owner (ddc),
47 mouseDragSource (draggingSource->getComponentUnderMouse()),
48 imageOffset (transformOffsetCoordinates (sourceComponent, offset)),
49 originalInputSourceIndex (draggingSource->getIndex()),
50 originalInputSourceType (draggingSource->getType())
51 {
52 updateSize();
53
54 if (mouseDragSource == nullptr)
55 mouseDragSource = sourceComponent;
56
57 mouseDragSource->addMouseListener (this, false);
58
59 startTimer (200);
60
61 setInterceptsMouseClicks (false, false);
63 setAlwaysOnTop (true);
64 }
65
67 {
68 owner.dragImageComponents.remove (owner.dragImageComponents.indexOf (this), false);
69
70 if (mouseDragSource != nullptr)
71 {
72 mouseDragSource->removeMouseListener (this);
73
74 if (auto* current = getCurrentlyOver())
75 if (current->isInterestedInDragSource (sourceDetails))
76 current->itemDragExit (sourceDetails);
77 }
78
79 owner.dragOperationEnded (sourceDetails);
80 }
81
82 void paint (Graphics& g) override
83 {
84 if (isOpaque())
85 g.fillAll (Colours::white);
86
87 g.setOpacity (1.0f);
88 g.drawImage (image.getImage(), getLocalBounds().toFloat());
89 }
90
91 void mouseUp (const MouseEvent& e) override
92 {
93 if (e.originalComponent != this && isOriginalInputSource (e.source))
94 {
95 if (mouseDragSource != nullptr)
96 mouseDragSource->removeMouseListener (this);
97
98 // (note: use a local copy of this in case the callback runs
99 // a modal loop and deletes this object before the method completes)
100 auto details = sourceDetails;
101 DragAndDropTarget* finalTarget = nullptr;
102
103 auto wasVisible = isVisible();
104 setVisible (false);
105 Component* unused;
106 finalTarget = findTarget (e.getScreenPosition(), details.localPosition, unused);
107
108 if (wasVisible) // fade the component and remove it - it'll be deleted later by the timer callback
109 dismissWithAnimation (finalTarget == nullptr);
110
111 if (auto* parent = getParentComponent())
112 parent->removeChildComponent (this);
113
114 if (finalTarget != nullptr)
115 {
116 currentlyOverComp = nullptr;
117 finalTarget->itemDropped (details);
118 }
119
120 // careful - this object could now be deleted..
121 }
122 }
123
124 void mouseDrag (const MouseEvent& e) override
125 {
126 if (e.originalComponent != this && isOriginalInputSource (e.source))
127 updateLocation (true, e.getScreenPosition());
128 }
129
130 void updateLocation (const bool canDoExternalDrag, Point<int> screenPos)
131 {
132 auto details = sourceDetails;
133
134 setNewScreenPos (screenPos);
135
136 Component* newTargetComp;
137 auto* newTarget = findTarget (screenPos, details.localPosition, newTargetComp);
138
139 setVisible (newTarget == nullptr || newTarget->shouldDrawDragImageWhenOver());
140
141 if (newTargetComp != currentlyOverComp)
142 {
143 if (auto* lastTarget = getCurrentlyOver())
144 if (details.sourceComponent != nullptr && lastTarget->isInterestedInDragSource (details))
145 lastTarget->itemDragExit (details);
146
147 currentlyOverComp = newTargetComp;
148
149 if (newTarget != nullptr
150 && newTarget->isInterestedInDragSource (details))
151 newTarget->itemDragEnter (details);
152 }
153
154 sendDragMove (details);
155
156 if (canDoExternalDrag)
157 {
158 auto now = Time::getCurrentTime();
159
160 if (getCurrentlyOver() != nullptr)
161 lastTimeOverTarget = now;
162 else if (now > lastTimeOverTarget + RelativeTime::milliseconds (700))
163 checkForExternalDrag (details, screenPos);
164 }
165
167 }
168
169 void updateImage (const ScaledImage& newImage)
170 {
171 image = newImage;
172 updateSize();
173 repaint();
174 }
175
176 void timerCallback() override
177 {
179
180 if (sourceDetails.sourceComponent == nullptr)
181 {
182 deleteSelf();
183 }
184 else
185 {
186 for (auto& s : Desktop::getInstance().getMouseSources())
187 {
188 if (isOriginalInputSource (s) && ! s.isDragging())
189 {
190 if (mouseDragSource != nullptr)
191 mouseDragSource->removeMouseListener (this);
192
193 deleteSelf();
194 break;
195 }
196 }
197 }
198 }
199
200 bool keyPressed (const KeyPress& key) override
201 {
203 {
204 const auto wasVisible = isVisible();
205 setVisible (false);
206
207 if (wasVisible)
209
210 deleteSelf();
211 return true;
212 }
213
214 return false;
215 }
216
217 bool canModalEventBeSentToComponent (const Component* targetComponent) override
218 {
219 return targetComponent == mouseDragSource;
220 }
221
222 // (overridden to avoid beeps when dragging)
223 void inputAttemptWhenModal() override {}
224
226
227private:
236
238 {
239 const auto bounds = image.getScaledBounds().toNearestInt();
240 setSize (bounds.getWidth(), bounds.getHeight());
241 }
242
244 {
245 Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate();
246 }
247
249 {
250 return dynamic_cast<DragAndDropTarget*> (currentlyOverComp.get());
251 }
252
254 {
255 auto& desktop = Desktop::getInstance();
256
257 for (auto i = desktop.getNumComponents(); --i >= 0;)
258 {
259 auto* desktopComponent = desktop.getComponent (i);
260 auto dPoint = desktopComponent->getLocalPoint (nullptr, screenPos);
261
262 if (auto* c = desktopComponent->getComponentAt (dPoint))
263 {
264 auto cPoint = c->getLocalPoint (desktopComponent, dPoint);
265
266 if (c->hitTest (cPoint.getX(), cPoint.getY()))
267 return c;
268 }
269 }
270
271 return nullptr;
272 }
273
274 Point<int> transformOffsetCoordinates (const Component* const sourceComponent, Point<int> offsetInSource) const
275 {
276 return getLocalPoint (sourceComponent, offsetInSource) - getLocalPoint (sourceComponent, Point<int>());
277 }
278
280 Component*& resultComponent) const
281 {
282 auto* hit = getParentComponent();
283
284 if (hit == nullptr)
285 hit = findDesktopComponentBelow (screenPos);
286 else
287 hit = hit->getComponentAt (hit->getLocalPoint (nullptr, screenPos));
288
289 // (note: use a local copy of this in case the callback runs
290 // a modal loop and deletes this object before the method completes)
291 auto details = sourceDetails;
292
293 while (hit != nullptr)
294 {
295 if (auto* ddt = dynamic_cast<DragAndDropTarget*> (hit))
296 {
297 if (ddt->isInterestedInDragSource (details))
298 {
299 relativePos = hit->getLocalPoint (nullptr, screenPos);
300 resultComponent = hit;
301 return ddt;
302 }
303 }
304
305 hit = hit->getParentComponent();
306 }
307
308 resultComponent = nullptr;
309 return nullptr;
310 }
311
313 {
314 auto newPos = screenPos - imageOffset;
315
316 if (auto* p = getParentComponent())
317 newPos = p->getLocalPoint (nullptr, newPos);
318
319 setTopLeftPosition (newPos);
320 }
321
323 {
324 if (auto* target = getCurrentlyOver())
325 if (target->isInterestedInDragSource (details))
326 target->itemDragMove (details);
327 }
328
330 {
332 {
333 if (Desktop::getInstance().findComponentAt (screenPos) == nullptr)
334 {
336
337 if (ComponentPeer::getCurrentModifiersRealtime().isAnyMouseButtonDown())
338 {
340 auto canMoveFiles = false;
341
342 if (owner.shouldDropFilesWhenDraggedExternally (details, files, canMoveFiles) && ! files.isEmpty())
343 {
345 deleteSelf();
346 return;
347 }
348
349 String text;
350
351 if (owner.shouldDropTextWhenDraggedExternally (details, text) && text.isNotEmpty())
352 {
354 deleteSelf();
355 return;
356 }
357 }
358 }
359 }
360 }
361
363 {
364 delete this;
365 }
366
367 void dismissWithAnimation (const bool shouldSnapBack)
368 {
369 setVisible (true);
370 auto& animator = Desktop::getInstance().getAnimator();
371
372 if (shouldSnapBack && sourceDetails.sourceComponent != nullptr)
373 {
374 auto target = sourceDetails.sourceComponent->localPointToGlobal (sourceDetails.sourceComponent->getLocalBounds().getCentre());
375 auto ourCentre = localPointToGlobal (getLocalBounds().getCentre());
376
377 animator.animateComponent (this,
378 getBounds() + (target - ourCentre),
379 0.0f, 120,
380 true, 1.0, 1.0);
381 }
382 else
383 {
384 animator.fadeOut (this, 120);
385 }
386 }
387
388 bool isOriginalInputSource (const MouseInputSource& sourceToCheck)
389 {
390 return (sourceToCheck.getType() == originalInputSourceType
391 && sourceToCheck.getIndex() == originalInputSourceIndex);
392 }
393
395};
396
397
398//==============================================================================
400
402
403void DragAndDropContainer::startDragging (const var& sourceDescription,
404 Component* sourceComponent,
405 const ScaledImage& dragImage,
406 const bool allowDraggingToExternalWindows,
407 const Point<int>* imageOffsetFromMouse,
408 const MouseInputSource* inputSourceCausingDrag)
409{
410 if (isAlreadyDragging (sourceComponent))
411 return;
412
413 auto* draggingSource = getMouseInputSourceForDrag (sourceComponent, inputSourceCausingDrag);
414
415 if (draggingSource == nullptr || ! draggingSource->isDragging())
416 {
417 jassertfalse; // You must call startDragging() from within a mouseDown or mouseDrag callback!
418 return;
419 }
420
421 const auto lastMouseDown = draggingSource->getLastMouseDownPosition().roundToInt();
422
423 struct ImageAndOffset
424 {
426 Point<double> offset;
427 };
428
429 const auto imageToUse = [&]() -> ImageAndOffset
430 {
431 if (! dragImage.getImage().isNull())
432 return { dragImage, imageOffsetFromMouse != nullptr ? dragImage.getScaledBounds().getConstrainedPoint (-imageOffsetFromMouse->toDouble())
433 : dragImage.getScaledBounds().getCentre() };
434
435 const auto scaleFactor = 2.0;
436 auto image = sourceComponent->createComponentSnapshot (sourceComponent->getLocalBounds(), true, (float) scaleFactor)
438 image.multiplyAllAlphas (0.6f);
439
440 const auto relPos = sourceComponent->getLocalPoint (nullptr, lastMouseDown).toDouble();
441 const auto clipped = (image.getBounds().toDouble() / scaleFactor).getConstrainedPoint (relPos);
442
443 Image fade (Image::SingleChannel, image.getWidth(), image.getHeight(), true);
444 Graphics fadeContext (fade);
445
446 ColourGradient gradient;
447 gradient.isRadial = true;
448 gradient.point1 = clipped.toFloat() * scaleFactor;
449 gradient.point2 = gradient.point1 + Point<float> (0.0f, scaleFactor * 400.0f);
450 gradient.addColour (0.0, Colours::white);
451 gradient.addColour (0.375, Colours::white);
452 gradient.addColour (1.0, Colours::transparentWhite);
453
454 fadeContext.setGradientFill (gradient);
455 fadeContext.fillAll();
456
457 Image composite (Image::ARGB, image.getWidth(), image.getHeight(), true);
458 Graphics compositeContext (composite);
459
460 compositeContext.reduceClipRegion (fade, {});
461 compositeContext.drawImageAt (image, 0, 0);
462
463 return { ScaledImage (composite, scaleFactor), clipped };
464 }();
465
466 auto* dragImageComponent = dragImageComponents.add (new DragImageComponent (imageToUse.image, sourceDescription, sourceComponent,
467 draggingSource, *this, imageToUse.offset.roundToInt()));
468
469 if (allowDraggingToExternalWindows)
470 {
472 dragImageComponent->setOpaque (true);
473
474 dragImageComponent->addToDesktop (ComponentPeer::windowIgnoresMouseClicks
476 }
477 else
478 {
479 if (auto* thisComp = dynamic_cast<Component*> (this))
480 {
481 thisComp->addChildComponent (dragImageComponent);
482 }
483 else
484 {
485 jassertfalse; // Your DragAndDropContainer needs to be a Component!
486 return;
487 }
488 }
489
490 dragImageComponent->sourceDetails.localPosition = sourceComponent->getLocalPoint (nullptr, lastMouseDown);
491 dragImageComponent->updateLocation (false, lastMouseDown);
492 dragImageComponent->grabKeyboardFocus();
493
494 #if JUCE_WINDOWS
495 // Under heavy load, the layered window's paint callback can often be lost by the OS,
496 // so forcing a repaint at least once makes sure that the window becomes visible..
497 if (auto* peer = dragImageComponent->getPeer())
498 peer->performAnyPendingRepaintsNow();
499 #endif
500
501 dragOperationStarted (dragImageComponent->sourceDetails);
502}
503
505{
506 return dragImageComponents.size() > 0;
507}
508
510{
511 return dragImageComponents.size();
512}
513
515{
516 // If you are performing drag and drop in a multi-touch environment then
517 // you should use the getDragDescriptionForIndex() method instead!
518 jassert (dragImageComponents.size() < 2);
519
520 return dragImageComponents.size() != 0 ? dragImageComponents[0]->sourceDetails.description
521 : var();
522}
523
525{
526 if (! isPositiveAndBelow (index, dragImageComponents.size()))
527 return {};
528
529 return dragImageComponents.getUnchecked (index)->sourceDetails.description;
530}
531
533{
534 // If you are performing drag and drop in a multi-touch environment then
535 // you should use the setDragImageForIndex() method instead!
536 jassert (dragImageComponents.size() < 2);
537
538 dragImageComponents[0]->updateImage (newImage);
539}
540
542{
543 if (isPositiveAndBelow (index, dragImageComponents.size()))
544 dragImageComponents.getUnchecked (index)->updateImage (newImage);
545}
546
548{
549 return c != nullptr ? c->findParentComponentOfClass<DragAndDropContainer>() : nullptr;
550}
551
556
561
564
566 const MouseInputSource* inputSourceCausingDrag)
567{
568 if (inputSourceCausingDrag == nullptr)
569 {
570 auto minDistance = std::numeric_limits<float>::max();
571 auto& desktop = Desktop::getInstance();
572
573 auto centrePoint = sourceComponent ? sourceComponent->getScreenBounds().getCentre().toFloat() : Point<float>();
574 auto numDragging = desktop.getNumDraggingMouseSources();
575
576 for (auto i = 0; i < numDragging; ++i)
577 {
578 if (auto* ms = desktop.getDraggingMouseSource (i))
579 {
580 auto distance = ms->getScreenPosition().getDistanceSquaredFrom (centrePoint);
581
582 if (distance < minDistance)
583 {
584 minDistance = distance;
585 inputSourceCausingDrag = ms;
586 }
587 }
588 }
589 }
590
591 // You must call startDragging() from within a mouseDown or mouseDrag callback!
592 jassert (inputSourceCausingDrag != nullptr && inputSourceCausingDrag->isDragging());
593
594 return inputSourceCausingDrag;
595}
596
598{
599 for (auto* dragImageComp : dragImageComponents)
600 {
601 if (dragImageComp->sourceDetails.sourceComponent == component)
602 return true;
603 }
604
605 return false;
606}
607
608//==============================================================================
615
620
621//==============================================================================
625
629
630} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_ColourGradient.h:38
Point< float > point2
Definition juce_ColourGradient.h:195
bool isRadial
Definition juce_ColourGradient.h:202
Point< float > point1
Definition juce_ColourGradient.h:195
int addColour(double proportionAlongGradient, Colour colour)
Definition juce_ColourGradient.cpp:113
Definition juce_Component.h:36
void setInterceptsMouseClicks(bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
Definition juce_Component.cpp:1420
bool isVisible() const noexcept
Definition juce_Component.h:122
Component * getParentComponent() const noexcept
Definition juce_Component.h:804
Image createComponentSnapshot(Rectangle< int > areaToGrab, bool clipImageToComponentBounds=true, float scaleFactor=1.0f)
Definition juce_Component.cpp:2135
bool isOpaque() const noexcept
Definition juce_Component.cpp:843
Point< int > getLocalPoint(const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
Definition juce_Component.cpp:1136
void setAlwaysOnTop(bool shouldStayOnTop)
Definition juce_Component.cpp:1074
Rectangle< int > getBounds() const noexcept
Definition juce_Component.h:304
void repaint()
Definition juce_Component.cpp:1917
Component() noexcept
Definition juce_Component.cpp:517
Rectangle< int > getScreenBounds() const
Definition juce_Component.cpp:1134
void setSize(int newWidth, int newHeight)
Definition juce_Component.cpp:1262
void setWantsKeyboardFocus(bool wantsFocus) noexcept
Definition juce_Component.cpp:2842
Point< int > localPointToGlobal(Point< int > localPoint) const
Definition juce_Component.cpp:1141
Rectangle< int > getLocalBounds() const noexcept
Definition juce_Component.cpp:2283
void setTopLeftPosition(int x, int y)
Definition juce_Component.cpp:1264
virtual void setVisible(bool shouldBeVisible)
Definition juce_Component.cpp:575
static ModifierKeys getCurrentModifiersRealtime() noexcept
Definition juce_ComponentPeer.cpp:596
@ windowIsTemporary
Definition juce_ComponentPeer.h:52
@ windowIgnoresMouseClicks
Definition juce_ComponentPeer.h:54
static Desktop &JUCE_CALLTYPE getInstance()
Definition juce_Desktop.cpp:50
static bool canUseSemiTransparentWindows() noexcept
Definition juce_linux_Windowing.cpp:603
Definition juce_DragAndDropContainer.cpp:36
void updateSize()
Definition juce_DragAndDropContainer.cpp:237
void updateImage(const ScaledImage &newImage)
Definition juce_DragAndDropContainer.cpp:169
const Point< int > imageOffset
Definition juce_DragAndDropContainer.cpp:231
Time lastTimeOverTarget
Definition juce_DragAndDropContainer.cpp:233
DragAndDropTarget::SourceDetails sourceDetails
Definition juce_DragAndDropContainer.cpp:225
ScaledImage image
Definition juce_DragAndDropContainer.cpp:228
void sendDragMove(DragAndDropTarget::SourceDetails &details) const
Definition juce_DragAndDropContainer.cpp:322
DragImageComponent(const ScaledImage &im, const var &desc, Component *const sourceComponent, const MouseInputSource *draggingSource, DragAndDropContainer &ddc, Point< int > offset)
Definition juce_DragAndDropContainer.cpp:38
void mouseDrag(const MouseEvent &e) override
Definition juce_DragAndDropContainer.cpp:124
void paint(Graphics &g) override
Definition juce_DragAndDropContainer.cpp:82
void forceMouseCursorUpdate()
Definition juce_DragAndDropContainer.cpp:243
WeakReference< Component > mouseDragSource
Definition juce_DragAndDropContainer.cpp:230
void setNewScreenPos(Point< int > screenPos)
Definition juce_DragAndDropContainer.cpp:312
MouseInputSource::InputSourceType originalInputSourceType
Definition juce_DragAndDropContainer.cpp:235
void updateLocation(const bool canDoExternalDrag, Point< int > screenPos)
Definition juce_DragAndDropContainer.cpp:130
DragAndDropContainer & owner
Definition juce_DragAndDropContainer.cpp:229
void dismissWithAnimation(const bool shouldSnapBack)
Definition juce_DragAndDropContainer.cpp:367
bool canModalEventBeSentToComponent(const Component *targetComponent) override
Definition juce_DragAndDropContainer.cpp:217
bool hasCheckedForExternalDrag
Definition juce_DragAndDropContainer.cpp:232
int originalInputSourceIndex
Definition juce_DragAndDropContainer.cpp:234
void deleteSelf()
Definition juce_DragAndDropContainer.cpp:362
bool isOriginalInputSource(const MouseInputSource &sourceToCheck)
Definition juce_DragAndDropContainer.cpp:388
void checkForExternalDrag(DragAndDropTarget::SourceDetails &details, Point< int > screenPos)
Definition juce_DragAndDropContainer.cpp:329
~DragImageComponent() override
Definition juce_DragAndDropContainer.cpp:66
Point< int > transformOffsetCoordinates(const Component *const sourceComponent, Point< int > offsetInSource) const
Definition juce_DragAndDropContainer.cpp:274
void timerCallback() override
Definition juce_DragAndDropContainer.cpp:176
void inputAttemptWhenModal() override
Definition juce_DragAndDropContainer.cpp:223
static Component * findDesktopComponentBelow(Point< int > screenPos)
Definition juce_DragAndDropContainer.cpp:253
DragAndDropTarget * findTarget(Point< int > screenPos, Point< int > &relativePos, Component *&resultComponent) const
Definition juce_DragAndDropContainer.cpp:279
bool keyPressed(const KeyPress &key) override
Definition juce_DragAndDropContainer.cpp:200
DragAndDropTarget * getCurrentlyOver() const noexcept
Definition juce_DragAndDropContainer.cpp:248
void mouseUp(const MouseEvent &e) override
Definition juce_DragAndDropContainer.cpp:91
WeakReference< Component > currentlyOverComp
Definition juce_DragAndDropContainer.cpp:230
var getCurrentDragDescription() const
Definition juce_DragAndDropContainer.cpp:514
void startDragging(const var &sourceDescription, Component *sourceComponent, const ScaledImage &dragImage=ScaledImage(), bool allowDraggingToOtherJuceWindows=false, const Point< int > *imageOffsetFromMouse=nullptr, const MouseInputSource *inputSourceCausingDrag=nullptr)
Definition juce_DragAndDropContainer.cpp:403
var getDragDescriptionForIndex(int index) const
Definition juce_DragAndDropContainer.cpp:524
bool isDragAndDropActive() const
Definition juce_DragAndDropContainer.cpp:504
virtual void dragOperationStarted(const DragAndDropTarget::SourceDetails &)
Definition juce_DragAndDropContainer.cpp:562
static bool performExternalDragDropOfText(const String &text, Component *sourceComponent=nullptr, std::function< void()> callback=nullptr)
Definition juce_linux_Windowing.cpp:778
const MouseInputSource * getMouseInputSourceForDrag(Component *sourceComponent, const MouseInputSource *inputSourceCausingDrag)
Definition juce_DragAndDropContainer.cpp:565
virtual bool shouldDropTextWhenDraggedExternally(const DragAndDropTarget::SourceDetails &sourceDetails, String &text)
Definition juce_DragAndDropContainer.cpp:557
virtual void dragOperationEnded(const DragAndDropTarget::SourceDetails &)
Definition juce_DragAndDropContainer.cpp:563
virtual bool shouldDropFilesWhenDraggedExternally(const DragAndDropTarget::SourceDetails &sourceDetails, StringArray &files, bool &canMoveFiles)
Definition juce_DragAndDropContainer.cpp:552
int getNumCurrentDrags() const
Definition juce_DragAndDropContainer.cpp:509
OwnedArray< DragImageComponent > dragImageComponents
Definition juce_DragAndDropContainer.h:258
static DragAndDropContainer * findParentDragContainerFor(Component *childComponent)
Definition juce_DragAndDropContainer.cpp:547
static bool performExternalDragDropOfFiles(const StringArray &files, bool canMoveFiles, Component *sourceComponent=nullptr, std::function< void()> callback=nullptr)
Definition juce_linux_Windowing.cpp:764
void setDragImageForIndex(int index, const ScaledImage &newImage)
Definition juce_DragAndDropContainer.cpp:541
bool isAlreadyDragging(Component *sourceComponent) const noexcept
Definition juce_DragAndDropContainer.cpp:597
void setCurrentDragImage(const ScaledImage &newImage)
Definition juce_DragAndDropContainer.cpp:532
Definition juce_DragAndDropTarget.h:54
Point< int > localPosition
Definition juce_DragAndDropTarget.h:70
WeakReference< Component > sourceComponent
Definition juce_DragAndDropTarget.h:65
var description
Definition juce_DragAndDropTarget.h:62
SourceDetails(const var &description, Component *sourceComponent, Point< int > localPosition) noexcept
Definition juce_DragAndDropContainer.cpp:609
Definition juce_DragAndDropTarget.h:46
virtual void itemDragEnter(const SourceDetails &dragSourceDetails)
Definition juce_DragAndDropContainer.cpp:616
virtual void itemDragExit(const SourceDetails &dragSourceDetails)
Definition juce_DragAndDropContainer.cpp:618
virtual void itemDragMove(const SourceDetails &dragSourceDetails)
Definition juce_DragAndDropContainer.cpp:617
virtual void itemDropped(const SourceDetails &dragSourceDetails)=0
virtual bool shouldDrawDragImageWhenOver()
Definition juce_DragAndDropContainer.cpp:619
virtual void fileDragEnter(const StringArray &files, int x, int y)
Definition juce_DragAndDropContainer.cpp:622
virtual void fileDragExit(const StringArray &files)
Definition juce_DragAndDropContainer.cpp:624
virtual void fileDragMove(const StringArray &files, int x, int y)
Definition juce_DragAndDropContainer.cpp:623
Definition juce_GraphicsContext.h:45
void drawImageAt(const Image &imageToDraw, int topLeftX, int topLeftY, bool fillAlphaChannelWithCurrentBrush=false) const
Definition juce_GraphicsContext.cpp:803
void setGradientFill(const ColourGradient &gradient)
Definition juce_GraphicsContext.cpp:290
bool reduceClipRegion(int x, int y, int width, int height)
Definition juce_GraphicsContext.cpp:180
void fillAll() const
Definition juce_GraphicsContext.cpp:541
Definition juce_Image.h:58
Image convertedToFormat(PixelFormat newFormat) const
Definition juce_Image.cpp:317
bool isNull() const noexcept
Definition juce_Image.h:155
@ SingleChannel
Definition juce_Image.h:68
@ ARGB
Definition juce_Image.h:67
Definition juce_KeyPress.h:40
static const int escapeKey
Definition juce_KeyPress.h:190
static bool callAsync(std::function< void()> functionToCall)
Definition juce_MessageManager.cpp:192
Definition juce_MouseEvent.h:39
Definition juce_MouseInputSource.h:52
MouseInputSource::InputSourceType getType() const noexcept
Definition juce_MouseInputSource.cpp:569
int getIndex() const noexcept
Definition juce_MouseInputSource.cpp:575
InputSourceType
Definition juce_MouseInputSource.h:56
bool isDragging() const noexcept
Definition juce_MouseInputSource.cpp:576
Definition juce_Point.h:42
constexpr Point< float > toFloat() const noexcept
Definition juce_Point.h:234
constexpr Point< double > toDouble() const noexcept
Definition juce_Point.h:237
Point< ValueType > getCentre() const noexcept
Definition juce_Rectangle.h:151
Point< ValueType > getConstrainedPoint(Point< ValueType > point) const noexcept
Definition juce_Rectangle.h:569
static RelativeTime milliseconds(int milliseconds) noexcept
Definition juce_RelativeTime.cpp:31
Definition juce_ScaledImage.h:45
Image getImage() const
Definition juce_ScaledImage.h:69
Rectangle< double > getScaledBounds() const
Definition juce_ScaledImage.h:75
Definition juce_StringArray.h:35
Definition juce_String.h:53
virtual void textDragEnter(const String &text, int x, int y)
Definition juce_DragAndDropContainer.cpp:626
virtual void textDragMove(const String &text, int x, int y)
Definition juce_DragAndDropContainer.cpp:627
virtual void textDragExit(const String &text)
Definition juce_DragAndDropContainer.cpp:628
Definition juce_Time.h:37
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Definition juce_Time.cpp:233
Timer() noexcept
Definition juce_Timer.cpp:316
void startTimer(int intervalInMilliseconds) noexcept
Definition juce_Timer.cpp:332
Definition juce_WeakReference.h:78
Definition juce_Variant.h:42
* e
Definition inflate.c:1404
int g
Definition inflate.c:1573
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
void composite()
Definition exprtk_simple_example_08.cpp:27
static uintptr_t parent
Definition pugl.h:1644
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE(className)
#define jassertfalse
static __inline float fade(float t)
Definition lice_texgen.cpp:133
static int JUCE_CDECL comp(const void *a, const void *b)
Definition lsp.c:298
static char ** files
Definition misc.c:28
const Colour transparentWhite
Definition juce_Colours.h:41
const Colour white
Definition juce_Colours.h:180
Definition carla_juce.cpp:31
bool juce_performDragDropFiles(const StringArray &, const bool copyFiles, bool &shouldStop)
bool juce_performDragDropText(const String &, bool &shouldStop)
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Definition juce_MathsFunctions.h:279
@ image
Definition juce_AccessibilityRole.h:42
const char * text
Definition swell-functions.h:167
uch * p
Definition crypt.c:594
return c
Definition crypt.c:175
ZCONST char * key
Definition crypt.c:587
typedef int(UZ_EXP MsgFn)()
#define const
Definition zconf.h:137