Enum TrayIconEvent
#[non_exhaustive]pub enum TrayIconEvent {
Click {
id: TrayIconId,
position: PhysicalPosition<f64>,
rect: Rect,
button: MouseButton,
button_state: MouseButtonState,
},
DoubleClick {
id: TrayIconId,
position: PhysicalPosition<f64>,
rect: Rect,
button: MouseButton,
},
Enter {
id: TrayIconId,
position: PhysicalPosition<f64>,
rect: Rect,
},
Move {
id: TrayIconId,
position: PhysicalPosition<f64>,
rect: Rect,
},
Leave {
id: TrayIconId,
position: PhysicalPosition<f64>,
rect: Rect,
},
}Expand description
Describes a tray icon event.
§Platform-specific:
- Linux: Unsupported. The event is not emmited even though the icon is shown and will still show a context menu on right click.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Click
A click happened on the tray icon.
Fields
id: TrayIconIdId of the tray icon which triggered this event.
position: PhysicalPosition<f64>Physical Position of this event.
Mouse button that triggered this event.
Mouse button state when this event was triggered.
DoubleClick
A double click happened on the tray icon. Windows Only
Fields
id: TrayIconIdId of the tray icon which triggered this event.
position: PhysicalPosition<f64>Physical Position of this event.
Mouse button that triggered this event.
Enter
The mouse entered the tray icon region.
Fields
id: TrayIconIdId of the tray icon which triggered this event.
position: PhysicalPosition<f64>Physical Position of this event.
Move
The mouse moved over the tray icon region.
Fields
id: TrayIconIdId of the tray icon which triggered this event.
position: PhysicalPosition<f64>Physical Position of this event.
Leave
The mouse left the tray icon region.
Fields
id: TrayIconIdId of the tray icon which triggered this event.
position: PhysicalPosition<f64>Physical Position of this event.
Implementations§
§impl TrayIconEvent
impl TrayIconEvent
pub fn id(&self) -> &TrayIconId
pub fn id(&self) -> &TrayIconId
Returns the id of the tray icon which triggered this event.
pub fn receiver<'a>() -> &'a Receiver<TrayIconEvent>
pub fn receiver<'a>() -> &'a Receiver<TrayIconEvent>
Gets a reference to the event channel’s TrayIconEventReceiver
which can be used to listen for tray events.
§Note
This will not receive any events if TrayIconEvent::set_event_handler has been called with a Some value.
pub fn set_event_handler<F>(f: Option<F>)
pub fn set_event_handler<F>(f: Option<F>)
Set a handler to be called for new events. Useful for implementing custom event sender.
§Note
Calling this function with a Some value,
will not send new events to the channel associated with TrayIconEvent::receiver
Trait Implementations§
§impl Clone for TrayIconEvent
impl Clone for TrayIconEvent
§fn clone(&self) -> TrayIconEvent
fn clone(&self) -> TrayIconEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TrayIconEvent
impl RefUnwindSafe for TrayIconEvent
impl Send for TrayIconEvent
impl Sync for TrayIconEvent
impl Unpin for TrayIconEvent
impl UnwindSafe for TrayIconEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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