pub struct TrayMenuBuilder {
pub options: Options,
pub menu: Option<Menu>,
pub tooltip: Option<String>,
pub callback: Option<Callback<CallbackClosure<MouseEvent>>>,
}
Expand description
Provides a builder pattern for constructing a system tray menu for the application.
For usage example please refer to Examples
Fields§
§options: Options
§tooltip: Option<String>
§callback: Option<Callback<CallbackClosure<MouseEvent>>>
Implementations§
Source§impl TrayMenuBuilder
impl TrayMenuBuilder
pub fn new() -> Self
pub fn set(self, key: &str, value: JsValue) -> Self
Sourcepub fn tooltip(self, tooltip: &str) -> Self
pub fn tooltip(self, tooltip: &str) -> Self
Set the tooltip of the tray. tooltip shows when you hover the Tray with mouse.
Note: tooltip is showed on all three platforms. Should be set as Tray property rather from option object constructor.
Sourcepub fn icon(self, icon: &str) -> Self
pub fn icon(self, icon: &str) -> Self
Set the icon of the tray, icon must receive a path to your icon file. It can be a relative path which points to an icon in your app, or an absolute path pointing to a file in user’s system.
Mac OS X caveat: when used in notification context, png icon is not sized down like in windows notification area, it is rather displayed in 1:1 ratio.
Sourcepub fn icons_are_templates(self, icons_are_templates: bool) -> Self
pub fn icons_are_templates(self, icons_are_templates: bool) -> Self
(Mac) Set whether icon and alticon images are treated as “templates” (true by default). When the property is set to true the images are treated as “templates” and the system automatically ensures proper styling according to the various states of the status item (e.g. dark menu, light menu, etc.). Template images should consist only of black and clear colours and can use the alpha channel in the image to adjust the opacity of black content.
Set the menu of the tray, menu will be showed when you click on the tray icon.
On Mac OS X the menu will be showed when you click on the tray (which is the only action available for tray icons on Mac OS X). On Windows and Linux, the menu will be showed when you single click on the tray with right mouse button, clicking with left mouse button sends the click event and does not show a menu.
In order to reduce differences from different platforms, setting menu property is the only way to bind a menu to tray, there’s no way to popup a menu with left mouse button click on Linux and Windows.
A submenu