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.

105 lines
4.5KB

  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_TEXTDRAGANDDROPTARGET_JUCEHEADER__
  19. #define __JUCE_TEXTDRAGANDDROPTARGET_JUCEHEADER__
  20. /**
  21. Components derived from this class can have text dropped onto them by an external application.
  22. @see DragAndDropContainer
  23. */
  24. class JUCE_API TextDragAndDropTarget
  25. {
  26. public:
  27. /** Destructor. */
  28. virtual ~TextDragAndDropTarget() {}
  29. /** Callback to check whether this target is interested in the set of text being offered.
  30. Note that this will be called repeatedly when the user is dragging the mouse around over your
  31. component, so don't do anything time-consuming in here!
  32. @param text the text 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 isInterestedInTextDrag (const String& text) = 0;
  37. /** Callback to indicate that some text is 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 text can be dropped here or not.
  41. @param text the text 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 textDragEnter (const String& text, int x, int y);
  46. /** Callback to indicate that the user is dragging some text 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 text the text 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 textDragMove (const String& text, 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 text.
  58. If you've used textDragEnter() to repaint your component and give feedback, use this
  59. as a signal to repaint it in its normal state.
  60. @param text the text that the user is dragging
  61. */
  62. virtual void textDragExit (const String& text);
  63. /** Callback to indicate that the user has dropped the text onto this component.
  64. When the user drops the text, this get called, and you can use the text in whatever
  65. way is appropriate.
  66. Note that after this is called, the textDragExit 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 text the text 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 textDropped (const String& text, int x, int y) = 0;
  73. };
  74. #endif // __JUCE_TEXTDRAGANDDROPTARGET_JUCEHEADER__