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 redraw was requested.
32    ///
33    /// The [`Instant`] contains the current time.
34    RedrawRequested(Instant),
35
36    /// The user has requested for the window to close.
37    CloseRequested,
38
39    /// A window was focused.
40    Focused,
41
42    /// A window was unfocused.
43    Unfocused,
44
45    /// A file is being hovered over the window.
46    ///
47    /// When the user hovers multiple files at once, this event will be emitted
48    /// for each file separately.
49    ///
50    /// ## Platform-specific
51    ///
52    /// - **Wayland:** Not implemented.
53    FileHovered(PathBuf),
54
55    /// A file has been dropped into the window.
56    ///
57    /// When the user drops multiple files at once, this event will be emitted
58    /// for each file separately.
59    ///
60    /// ## Platform-specific
61    ///
62    /// - **Wayland:** Not implemented.
63    FileDropped(PathBuf),
64
65    /// A file was hovered, but has exited the window.
66    ///
67    /// There will be a single `FilesHoveredLeft` event triggered even if
68    /// multiple files were hovered.
69    ///
70    /// ## Platform-specific
71    ///
72    /// - **Wayland:** Not implemented.
73    FilesHoveredLeft,
74}