pub struct Tray<Msg> { /* private fields */ }Expand description
The application’s tray icon, described: its tooltip, its icon, its menu, what a click on it does, and whether closing the window leaves the application running in it.
Implementations§
Source§impl<Msg> Tray<Msg>
impl<Msg> Tray<Msg>
Sourcepub fn new(tooltip: impl Into<String>) -> Self
pub fn new(tooltip: impl Into<String>) -> Self
A tray icon showing tooltip when the pointer rests on it, with the application’s icon
and an empty menu; a click on it brings the window forward.
Sourcepub fn item(self, label: impl Into<String>, message: Msg) -> Self
pub fn item(self, label: impl Into<String>, message: Msg) -> Self
Adds an item labelled label that sends message.
Sourcepub fn disabled_item(self, label: impl Into<String>) -> Self
pub fn disabled_item(self, label: impl Into<String>) -> Self
Adds an item that is shown but cannot be chosen: a status line, or an action not available now.
Sourcepub fn show_item(self, label: impl Into<String>) -> Self
pub fn show_item(self, label: impl Into<String>) -> Self
Adds an item that brings the window forward, showing it if it was hidden.
Sourcepub fn quit_item(self, label: impl Into<String>) -> Self
pub fn quit_item(self, label: impl Into<String>) -> Self
Adds an item that ends the application.
Sourcepub fn on_click(self, message: Msg) -> Self
pub fn on_click(self, message: Msg) -> Self
What a click on the icon sends, in place of bringing the window forward.
Sourcepub fn keep_running(self) -> Self
pub fn keep_running(self) -> Self
Closing the window hides it, and the application goes on in the tray until a
quit_item — or the system — ends it. Without one, closing the
window ends the application as it always does.
Auto Trait Implementations§
impl<Msg> Freeze for Tray<Msg>
impl<Msg> RefUnwindSafe for Tray<Msg>
impl<Msg> Send for Tray<Msg>
impl<Msg> Sync for Tray<Msg>
impl<Msg> Unpin for Tray<Msg>
impl<Msg> UnsafeUnpin for Tray<Msg>
impl<Msg> UnwindSafe for Tray<Msg>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.