Tray

Tray item displayed in system notification area.

Header#include "nativeui/tray.h"
Namespacenamespace nu
Typeclass (RefCounted)

Platform limitations:

Constructors

Tray(scoped_refptr<Image> icon)

Create a tray item with icon.

Parameters

Tray(const std::string& title) macOS

Create a tray item with only title.

Parameters

Methods

void Remove()

Remove the tray item.

RectF GetBounds() const macOS Windows

Return the position and size of the tray item.

Return

RectF

void SetTitle(const std::string& title) macOS Linux

Set title to be displayed aside item's icon.

Parameters

void SetImage(scoped_refptr<Image> icon)

Set the icon of tray item.

Parameters

void SetPressedImage(scoped_refptr<Image> image) macOS

Set the image to show when tray item is pressed.

Parameters

void SetMenu(scoped_refptr<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* GetMenu() const

Return the menu attached.

Return

Menu*

Events

void on_click(Tray* self) macOS Windows

Emitted when the tray item is clicked.

Parameters

Preventable

No.