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.

106 lines
4.4KB

  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_TEXTDRAGANDDROPTARGET_H_INCLUDED
  18. #define JUCE_TEXTDRAGANDDROPTARGET_H_INCLUDED
  19. //==============================================================================
  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_H_INCLUDED