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.

107 lines
4.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. //==============================================================================
  21. /**
  22. Components derived from this class can have text dropped onto them by an external application.
  23. @see DragAndDropContainer
  24. @tags{GUI}
  25. */
  26. class JUCE_API TextDragAndDropTarget
  27. {
  28. public:
  29. /** Destructor. */
  30. virtual ~TextDragAndDropTarget() = default;
  31. /** Callback to check whether this target is interested in the set of text 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!
  34. @param text the text that the user is dragging
  35. @returns true if this component wants to receive the other callbacks regarding this
  36. type of object; if it returns false, no other callbacks will be made.
  37. */
  38. virtual bool isInterestedInTextDrag (const String& text) = 0;
  39. /** Callback to indicate that some text is being dragged over this component.
  40. This gets called when the user moves the mouse into this component while dragging.
  41. Use this callback as a trigger to make your component repaint itself to give the
  42. user feedback about whether the text can be dropped here or not.
  43. @param text the text that the user is dragging
  44. @param x the mouse x position, relative to this component
  45. @param y the mouse y position, relative to this component
  46. */
  47. virtual void textDragEnter (const String& text, int x, int y);
  48. /** Callback to indicate that the user is dragging some text over this component.
  49. This gets called when the user moves the mouse over this component while dragging.
  50. Normally overriding itemDragEnter() and itemDragExit() are enough, but
  51. this lets you know what happens in-between.
  52. @param text the text that the user is dragging
  53. @param x the mouse x position, relative to this component
  54. @param y the mouse y position, relative to this component
  55. */
  56. virtual void textDragMove (const String& text, int x, int y);
  57. /** Callback to indicate that the mouse has moved away from this component.
  58. This gets called when the user moves the mouse out of this component while dragging
  59. the text.
  60. If you've used textDragEnter() to repaint your component and give feedback, use this
  61. as a signal to repaint it in its normal state.
  62. @param text the text that the user is dragging
  63. */
  64. virtual void textDragExit (const String& text);
  65. /** Callback to indicate that the user has dropped the text onto this component.
  66. When the user drops the text, this get called, and you can use the text in whatever
  67. way is appropriate.
  68. Note that after this is called, the textDragExit method may not be called, so you should
  69. clean up in here if there's anything you need to do when the drag finishes.
  70. @param text the text that the user is dragging
  71. @param x the mouse x position, relative to this component
  72. @param y the mouse y position, relative to this component
  73. */
  74. virtual void textDropped (const String& text, int x, int y) = 0;
  75. };
  76. } // namespace juce