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.

104 lines
4.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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_TEXTDRAGANDDROPTARGET_JUCEHEADER__
  18. #define __JUCE_TEXTDRAGANDDROPTARGET_JUCEHEADER__
  19. /**
  20. Components derived from this class can have text dropped onto them by an external application.
  21. @see DragAndDropContainer
  22. */
  23. class JUCE_API TextDragAndDropTarget
  24. {
  25. public:
  26. /** Destructor. */
  27. virtual ~TextDragAndDropTarget() {}
  28. /** Callback to check whether this target is interested in the set of text 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!
  31. @param text the text that the user is dragging
  32. @returns true if this component wants to receive the other callbacks regarging this
  33. type of object; if it returns false, no other callbacks will be made.
  34. */
  35. virtual bool isInterestedInTextDrag (const String& text) = 0;
  36. /** Callback to indicate that some text is being dragged over this component.
  37. This gets called when the user moves the mouse into this component while dragging.
  38. Use this callback as a trigger to make your component repaint itself to give the
  39. user feedback about whether the text can be dropped here or not.
  40. @param text the text that the user is dragging
  41. @param x the mouse x position, relative to this component
  42. @param y the mouse y position, relative to this component
  43. */
  44. virtual void textDragEnter (const String& text, int x, int y);
  45. /** Callback to indicate that the user is dragging some text over this component.
  46. This gets called when the user moves the mouse over this component while dragging.
  47. Normally overriding itemDragEnter() and itemDragExit() are enough, but
  48. this lets you know what happens in-between.
  49. @param text the text that the user is dragging
  50. @param x the mouse x position, relative to this component
  51. @param y the mouse y position, relative to this component
  52. */
  53. virtual void textDragMove (const String& text, int x, int y);
  54. /** Callback to indicate that the mouse has moved away from this component.
  55. This gets called when the user moves the mouse out of this component while dragging
  56. the text.
  57. If you've used textDragEnter() to repaint your component and give feedback, use this
  58. as a signal to repaint it in its normal state.
  59. @param text the text that the user is dragging
  60. */
  61. virtual void textDragExit (const String& text);
  62. /** Callback to indicate that the user has dropped the text onto this component.
  63. When the user drops the text, this get called, and you can use the text in whatever
  64. way is appropriate.
  65. Note that after this is called, the textDragExit method may not be called, so you should
  66. clean up in here if there's anything you need to do when the drag finishes.
  67. @param text the text that the user is dragging
  68. @param x the mouse x position, relative to this component
  69. @param y the mouse y position, relative to this component
  70. */
  71. virtual void textDropped (const String& text, int x, int y) = 0;
  72. };
  73. #endif // __JUCE_TEXTDRAGANDDROPTARGET_JUCEHEADER__