Tray
Tray item displayed in system notification area.
Header | #include "nativeui/tray.h" |
Namespace | namespace nu |
Type | class (RefCounted) |
Platform limitations:
- On Linux tray items are displayed as app indicators.
- On Linux there is no fallback when app indicators are not supported.
- On Linux app indicator can only show when it has menu attached.
Constructors
Tray(Image* icon)
Create a tray item with icon
.
Parameters
Image*
icon
macOS
Tray(const std::string& title)Create a tray item with only title
.
Parameters
const std::string&
title
Methods
macOS linux
void SetTitle(const std::string& title)Set title to be displayed aside item's icon.
Parameters
const std::string&
title
void SetImage(Image* icon)
Set the icon
of tray item.
Parameters
Image*
icon
void SetMenu(Menu* menu)
Set the menu attached with the tray item.
On most platforms the menu will show when clicking on the icon, while on Windows the menu will only show when when right-clicking on the icon.
Parameters
Menu*
menu
Menu* GetMenu() const
Return the menu attached.
Return
Menu*
Events
Windows
void on_click(Button* self)Emitted when the tray item is clicked.
Parameters
Button*
self