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.

110 lines
3.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 7 technical preview.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For the technical preview this file cannot be licensed commercially.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. #if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD || JUCE_MAC || DOXYGEN
  16. //==============================================================================
  17. /**
  18. This component sits in the taskbar tray as a small icon.
  19. (NB: The exact behaviour of this class will differ between OSes, and it
  20. isn't fully implemented for all OSes)
  21. To use it, just create one of these components, but don't attempt to make it
  22. visible, add it to a parent, or put it on the desktop.
  23. You can then call setIconImage() to create an icon for it in the taskbar.
  24. To change the icon's tooltip, you can use setIconTooltip().
  25. To respond to mouse-events, you can override the normal mouseDown(),
  26. mouseUp(), mouseDoubleClick() and mouseMove() methods, and although the x, y
  27. position will not be valid, you can use this to respond to clicks. Traditionally
  28. you'd use a left-click to show your application's window, and a right-click
  29. to show a pop-up menu.
  30. @tags{GUI}
  31. */
  32. class JUCE_API SystemTrayIconComponent : public Component
  33. {
  34. public:
  35. //==============================================================================
  36. /** Constructor. */
  37. SystemTrayIconComponent();
  38. /** Destructor. */
  39. ~SystemTrayIconComponent() override;
  40. //==============================================================================
  41. /** Changes the image shown in the taskbar.
  42. On Windows and Linux a full colour Image is used as an icon.
  43. On macOS a template image is used, where all non-transparent regions will be
  44. rendered in a monochrome colour selected dynamically by the operating system.
  45. @param colourImage An colour image to use as an icon on Windows and Linux
  46. @param templateImage A template image to use as an icon on macOS
  47. */
  48. void setIconImage (const Image& colourImage, const Image& templateImage);
  49. /** Changes the icon's tooltip (if the current OS supports this). */
  50. void setIconTooltip (const String& tooltip);
  51. /** Highlights the icon (if the current OS supports this). */
  52. void setHighlighted (bool);
  53. /** Shows a floating text bubble pointing to the icon (if the current OS supports this). */
  54. void showInfoBubble (const String& title, const String& content);
  55. /** Hides the icon's floating text bubble (if the current OS supports this). */
  56. void hideInfoBubble();
  57. /** Returns the raw handle to whatever kind of internal OS structure is
  58. involved in showing this icon.
  59. @see ComponentPeer::getNativeHandle()
  60. */
  61. void* getNativeHandle() const;
  62. #if JUCE_LINUX || JUCE_BSD
  63. /** @internal */
  64. void paint (Graphics&) override;
  65. #endif
  66. #if JUCE_MAC
  67. /** Shows a menu attached to the OSX menu bar icon. */
  68. void showDropdownMenu (const PopupMenu& menu);
  69. #endif
  70. private:
  71. //==============================================================================
  72. JUCE_PUBLIC_IN_DLL_BUILD (class Pimpl)
  73. std::unique_ptr<Pimpl> pimpl;
  74. [[deprecated ("The new setIconImage function signature requires different images for macOS and the other platforms.")]]
  75. void setIconImage (const Image& newImage);
  76. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SystemTrayIconComponent)
  77. };
  78. #endif
  79. } // namespace juce