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.

82 lines
2.7KB

  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. #pragma once
  18. //==============================================================================
  19. /**
  20. Components that want to use pop-up tooltips should implement this interface.
  21. A TooltipWindow will wait for the mouse to hover over a component that
  22. implements the TooltipClient interface, and when it finds one, it will display
  23. the tooltip returned by its getTooltip() method.
  24. @see TooltipWindow, SettableTooltipClient
  25. */
  26. class JUCE_API TooltipClient
  27. {
  28. public:
  29. /** Destructor. */
  30. virtual ~TooltipClient() {}
  31. /** Returns the string that this object wants to show as its tooltip. */
  32. virtual String getTooltip() = 0;
  33. };
  34. //==============================================================================
  35. /**
  36. An implementation of TooltipClient that stores the tooltip string and a method
  37. for changing it.
  38. This makes it easy to add a tooltip to a custom component, by simply adding this
  39. as a base class and calling setTooltip().
  40. Many of the Juce widgets already use this as a base class to implement their
  41. tooltips.
  42. @see TooltipClient, TooltipWindow
  43. */
  44. class JUCE_API SettableTooltipClient : public TooltipClient
  45. {
  46. public:
  47. //==============================================================================
  48. /** Destructor. */
  49. ~SettableTooltipClient() {}
  50. //==============================================================================
  51. /** Assigns a new tooltip to this object. */
  52. virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
  53. /** Returns the tooltip assigned to this object. */
  54. String getTooltip() override { return tooltipString; }
  55. protected:
  56. SettableTooltipClient() {}
  57. private:
  58. String tooltipString;
  59. };