#[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: TrayIconId
Id 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: TrayIconId
Id 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: TrayIconId
Id 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: TrayIconId
Id 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: TrayIconId
Id of the tray icon which triggered this event.
position: PhysicalPosition<f64>
Physical Position of this event.
Implementations§
Source§impl TrayIconEvent
impl TrayIconEvent
Sourcepub fn id(&self) -> &TrayIconId
pub fn id(&self) -> &TrayIconId
Returns the id of the tray icon which triggered this event.
Sourcepub fn receiver<'a>() -> &'a TrayIconEventReceiver
pub fn receiver<'a>() -> &'a TrayIconEventReceiver
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.
Sourcepub fn set_event_handler<F: Fn(TrayIconEvent) + Send + Sync + 'static>(
f: Option<F>,
)
pub fn set_event_handler<F: Fn(TrayIconEvent) + Send + Sync + 'static>( 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§
Source§impl Clone for TrayIconEvent
impl Clone for TrayIconEvent
Source§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 more