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.

juce_SystemTrayIconComponent.h 4.2KB

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