pub struct StatusItem { /* private fields */ }Expand description
What a status item shows: its icon, text and menu. Built by the closure handed to
status_item, which re-runs whenever a signal it reads changes.
Implementations§
Source§impl StatusItem
impl StatusItem
Sourcepub fn new() -> StatusItem
pub fn new() -> StatusItem
An item with nothing set yet.
Sourcepub fn icon(self, symbol: Symbol) -> StatusItem
pub fn icon(self, symbol: Symbol) -> StatusItem
A platform symbol as the icon, drawn in the menu bar’s or panel’s own color.
Sourcepub fn vector(self, name: impl Into<VectorName>) -> StatusItem
pub fn vector(self, name: impl Into<VectorName>) -> StatusItem
A bundled vector glyph as the icon (res::vectors::…), drawn as a template: the shape
in the menu bar’s or panel’s own color. The usual choice for a status item.
Sourcepub fn image(self, name: impl Into<ImageName>) -> StatusItem
pub fn image(self, name: impl Into<ImageName>) -> StatusItem
A bundled image as the icon (res::images::…), drawn as it is. Call template
for a monochrome glyph that should take the menu bar’s color instead.
Sourcepub fn raster(self, image: StatusImage) -> Self
pub fn raster(self, image: StatusImage) -> Self
A runtime RGBA image, preserving its logical width (a chart or compact status grid).
AppKit renders this in color; template opts into a monochrome
template.
Other backends keep using the icon/vector/image fallback, if supplied. The image
owns its pixels and survives closing the window that produced it.
Sourcepub fn template(self) -> StatusItem
pub fn template(self) -> StatusItem
Sourcepub fn title<M>(self, title: impl IntoText<M>) -> StatusItem
pub fn title<M>(self, title: impl IntoText<M>) -> StatusItem
Text beside the icon where the platform shows it (the macOS menu bar): a timer, a count, a short status. A literal, a localized text, a signal or a closure; live.
Sourcepub fn tooltip<M>(self, tooltip: impl IntoText<M>) -> StatusItem
pub fn tooltip<M>(self, tooltip: impl IntoText<M>) -> StatusItem
The hover text. The same sources as title.
The item’s menu, built from the same entries as app_menu (a list or a derived
closure). Include a menu_role(MenuRole::Quit) (or an item calling day::quit()) in an
app that keeps running without a window, or the user has no way to end it.
Sourcepub fn on_activate(self, f: impl Fn() + 'static) -> StatusItem
pub fn on_activate(self, f: impl Fn() + 'static) -> StatusItem
Run f when the user clicks the item itself, where the platform tells a click apart
from opening the menu (a left click on macOS and Windows; a Linux tray’s primary
action). The menu then opens on a right click. Without it, any click opens the menu.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StatusItem
impl !Send for StatusItem
impl !Sync for StatusItem
impl !UnwindSafe for StatusItem
impl Freeze for StatusItem
impl Unpin for StatusItem
impl UnsafeUnpin for StatusItem
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<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more