rlvgl_core/
event.rs

1//! Basic UI events used for widgets.
2
3/// Event types propagated through the widget tree.
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum Event {
6    /// Called periodically to advance animations or timers.
7    Tick,
8    /// A pointer (mouse or touch) was pressed at the given coordinates.
9    PointerDown {
10        /// Horizontal coordinate relative to the widget origin.
11        x: i32,
12        /// Vertical coordinate relative to the widget origin.
13        y: i32,
14    },
15    /// The pointer was released.
16    PointerUp {
17        /// Horizontal coordinate relative to the widget origin.
18        x: i32,
19        /// Vertical coordinate relative to the widget origin.
20        y: i32,
21    },
22    /// The pointer moved while still pressed.
23    PointerMove {
24        /// Horizontal coordinate relative to the widget origin.
25        x: i32,
26        /// Vertical coordinate relative to the widget origin.
27        y: i32,
28    },
29    /// A keyboard key was pressed.
30    KeyDown {
31        /// Key that was pressed.
32        key: Key,
33    },
34    /// A keyboard key was released.
35    KeyUp {
36        /// Key that was released.
37        key: Key,
38    },
39}
40
41/// Identifiers for keyboard keys.
42#[derive(Debug, Clone, PartialEq, Eq)]
43pub enum Key {
44    /// Escape key.
45    Escape,
46    /// Enter/Return key.
47    Enter,
48    /// Spacebar key.
49    Space,
50    /// Up arrow key.
51    ArrowUp,
52    /// Down arrow key.
53    ArrowDown,
54    /// Left arrow key.
55    ArrowLeft,
56    /// Right arrow key.
57    ArrowRight,
58    /// Function key with the given index (1–12).
59    Function(u8),
60    /// Printable character key.
61    Character(char),
62    /// Any other key not explicitly covered above.
63    Other(u32),
64}