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.

105 lines
4.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_FILEDRAGANDDROPTARGET_H_INCLUDED
  18. #define JUCE_FILEDRAGANDDROPTARGET_H_INCLUDED
  19. /**
  20. Components derived from this class can have files dropped onto them by an external application.
  21. @see DragAndDropContainer
  22. */
  23. class JUCE_API FileDragAndDropTarget
  24. {
  25. public:
  26. /** Destructor. */
  27. virtual ~FileDragAndDropTarget() {}
  28. /** Callback to check whether this target is interested in the set of files being offered.
  29. Note that this will be called repeatedly when the user is dragging the mouse around over your
  30. component, so don't do anything time-consuming in here, like opening the files to have a look
  31. inside them!
  32. @param files the set of (absolute) pathnames of the files that the user is dragging
  33. @returns true if this component wants to receive the other callbacks regarging this
  34. type of object; if it returns false, no other callbacks will be made.
  35. */
  36. virtual bool isInterestedInFileDrag (const StringArray& files) = 0;
  37. /** Callback to indicate that some files are being dragged over this component.
  38. This gets called when the user moves the mouse into this component while dragging.
  39. Use this callback as a trigger to make your component repaint itself to give the
  40. user feedback about whether the files can be dropped here or not.
  41. @param files the set of (absolute) pathnames of the files that the user is dragging
  42. @param x the mouse x position, relative to this component
  43. @param y the mouse y position, relative to this component
  44. */
  45. virtual void fileDragEnter (const StringArray& files, int x, int y);
  46. /** Callback to indicate that the user is dragging some files over this component.
  47. This gets called when the user moves the mouse over this component while dragging.
  48. Normally overriding itemDragEnter() and itemDragExit() are enough, but
  49. this lets you know what happens in-between.
  50. @param files the set of (absolute) pathnames of the files that the user is dragging
  51. @param x the mouse x position, relative to this component
  52. @param y the mouse y position, relative to this component
  53. */
  54. virtual void fileDragMove (const StringArray& files, int x, int y);
  55. /** Callback to indicate that the mouse has moved away from this component.
  56. This gets called when the user moves the mouse out of this component while dragging
  57. the files.
  58. If you've used fileDragEnter() to repaint your component and give feedback, use this
  59. as a signal to repaint it in its normal state.
  60. @param files the set of (absolute) pathnames of the files that the user is dragging
  61. */
  62. virtual void fileDragExit (const StringArray& files);
  63. /** Callback to indicate that the user has dropped the files onto this component.
  64. When the user drops the files, this get called, and you can use the files in whatever
  65. way is appropriate.
  66. Note that after this is called, the fileDragExit method may not be called, so you should
  67. clean up in here if there's anything you need to do when the drag finishes.
  68. @param files the set of (absolute) pathnames of the files that the user is dragging
  69. @param x the mouse x position, relative to this component
  70. @param y the mouse y position, relative to this component
  71. */
  72. virtual void filesDropped (const StringArray& files, int x, int y) = 0;
  73. };
  74. #endif // JUCE_FILEDRAGANDDROPTARGET_H_INCLUDED