Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

juce_FileDragAndDropTarget.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. /**
  16. Components derived from this class can have files dropped onto them by an external application.
  17. @see DragAndDropContainer
  18. @tags{GUI}
  19. */
  20. class JUCE_API FileDragAndDropTarget
  21. {
  22. public:
  23. /** Destructor. */
  24. virtual ~FileDragAndDropTarget() = default;
  25. /** Callback to check whether this target is interested in the set of files being offered.
  26. Note that this will be called repeatedly when the user is dragging the mouse around over your
  27. component, so don't do anything time-consuming in here, like opening the files to have a look
  28. inside them!
  29. @param files the set of (absolute) pathnames of the files that the user is dragging
  30. @returns true if this component wants to receive the other callbacks regarding this
  31. type of object; if it returns false, no other callbacks will be made.
  32. */
  33. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  34. /** Callback to indicate that some files are being dragged over this component.
  35. This gets called when the user moves the mouse into this component while dragging.
  36. Use this callback as a trigger to make your component repaint itself to give the
  37. user feedback about whether the files can be dropped here or not.
  38. @param files the set of (absolute) pathnames of the files that the user is dragging
  39. @param x the mouse x position, relative to this component
  40. @param y the mouse y position, relative to this component
  41. */
  42. virtual void fileDragEnter (const StringArray& files, int x, int y);
  43. /** Callback to indicate that the user is dragging some files over this component.
  44. This gets called when the user moves the mouse over this component while dragging.
  45. Normally overriding itemDragEnter() and itemDragExit() are enough, but
  46. this lets you know what happens in-between.
  47. @param files the set of (absolute) pathnames of the files that the user is dragging
  48. @param x the mouse x position, relative to this component
  49. @param y the mouse y position, relative to this component
  50. */
  51. virtual void fileDragMove (const StringArray& files, int x, int y);
  52. /** Callback to indicate that the mouse has moved away from this component.
  53. This gets called when the user moves the mouse out of this component while dragging
  54. the files.
  55. If you've used fileDragEnter() to repaint your component and give feedback, use this
  56. as a signal to repaint it in its normal state.
  57. @param files the set of (absolute) pathnames of the files that the user is dragging
  58. */
  59. virtual void fileDragExit (const StringArray& files);
  60. /** Callback to indicate that the user has dropped the files onto this component.
  61. When the user drops the files, this get called, and you can use the files in whatever
  62. way is appropriate.
  63. Note that after this is called, the fileDragExit method may not be called, so you should
  64. clean up in here if there's anything you need to do when the drag finishes.
  65. @param files the set of (absolute) pathnames of the files that the user is dragging
  66. @param x the mouse x position, relative to this component
  67. @param y the mouse y position, relative to this component
  68. */
  69. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  70. };
  71. } // namespace juce