iced_core/window/
event.rs

1use crate::time::Instant;
2use crate::{Point, Size};
3
4use std::path::PathBuf;
5
6/// A window-related event.
7#[derive(PartialEq, Clone, Debug)]
8pub enum Event {
9    /// A window was opened.
10    Opened {
11        /// The position of the opened window. This is relative to the top-left corner of the desktop
12        /// the window is on, including virtual desktops. Refers to window's "outer" position,
13        /// or the window area, in logical pixels.
14        ///
15        /// **Note**: Not available in Wayland.
16        position: Option<Point>,
17        /// The size of the created window. This is its "inner" size, or the size of the
18        /// client area, in logical pixels.
19        size: Size,
20    },
21
22    /// A window was closed.
23    Closed,
24
25    /// A window was moved.
26    Moved(Point),
27
28    /// A window was resized.
29    Resized(Size),
30
31    /// A window changed its scale factor.
32    Rescaled(f32),
33
34    /// A window redraw was requested.
35    ///
36    /// The [`Instant`] contains the current time.
37    RedrawRequested(Instant),
38
39    /// The user has requested for the window to close.
40    CloseRequested,
41
42    /// A window was focused.
43    Focused,
44
45    /// A window was unfocused.
46    Unfocused,
47
48    /// A file is being hovered over the window.
49    ///
50    /// When the user hovers multiple files at once, this event will be emitted
51    /// for each file separately.
52    ///
53    /// ## Platform-specific
54    ///
55    /// - **Wayland:** Not implemented.
56    FileHovered(PathBuf),
57
58    /// A file has been dropped into the window.
59    ///
60    /// When the user drops multiple files at once, this event will be emitted
61    /// for each file separately.
62    ///
63    /// ## Platform-specific
64    ///
65    /// - **Wayland:** Not implemented.
66    FileDropped(PathBuf),
67
68    /// A file was hovered, but has exited the window.
69    ///
70    /// There will be a single `FilesHoveredLeft` event triggered even if
71    /// multiple files were hovered.
72    ///
73    /// ## Platform-specific
74    ///
75    /// - **Wayland:** Not implemented.
76    FilesHoveredLeft,
77}