The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

110 lines
4.9KB

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