euv_core/system/event/enum.rs
1use super::*;
2
3/// Canonical cross-platform application lifecycle state tracked identically on all 7 targets.
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum AppState {
6 /// Application is visible in the foreground and receiving interactive input.
7 #[default]
8 Active,
9 /// Application is transitioning, occluded, or unfocused while still partially visible.
10 Inactive,
11 /// Application is hidden or suspended in the background.
12 Background,
13 /// Application is terminating or has shut down.
14 Terminated,
15}
16
17/// Normalized device or window screen orientation across mobile, tablet, desktop, and web.
18#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
19pub enum ScreenOrientation {
20 /// Standard upright portrait orientation (`height >= width`).
21 #[default]
22 Portrait,
23 /// Standard horizontal landscape orientation (`width > height`).
24 Landscape,
25 /// Upside-down portrait orientation.
26 PortraitUpsideDown,
27 /// Landscape orientation rotated counter-clockwise.
28 LandscapeLeft,
29 /// Landscape orientation rotated clockwise.
30 LandscapeRight,
31}
32
33/// Normalized operating system memory pressure severity.
34#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub enum MemoryPressure {
36 /// Healthy memory headroom.
37 #[default]
38 Normal,
39 /// Moderate OS memory trim request; release non-essential caches.
40 Warning,
41 /// Critical OS low-memory alert; release all regeneratable caches immediately.
42 Critical,
43}
44
45/// Normalized network reachability and transport classification.
46#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub enum NetworkStatus {
48 /// Network connectivity is available (generic online transport).
49 #[default]
50 Online,
51 /// Device has no active network route.
52 Offline,
53 /// Connected over Wi-Fi / local wireless LAN.
54 Wifi,
55 /// Connected over cellular mobile data.
56 Cellular,
57 /// Connectivity state could not be determined by the host OS.
58 Unknown,
59}
60
61/// Unified cross-platform system and lifecycle event smoothing all 7-platform OS differences.
62#[derive(Clone, Debug, PartialEq)]
63pub enum SystemEvent {
64 /// Active window or routed page became visually presented.
65 Appear,
66 /// Active window or routed page ceased to be visually presented.
67 Disappear,
68 /// Application returned to active foreground execution.
69 Foreground,
70 /// Application moved into suspended/hidden background execution.
71 Background,
72 /// Application lost active interaction status (e.g. control center, app switcher, or deactivation).
73 Inactive,
74 /// Application is terminating gracefully.
75 Terminate,
76 /// Window keyboard/input focus state changed.
77 FocusChanged(bool),
78 /// Viewport logical dimensions or DPI scale factor changed.
79 Resize {
80 /// Logical viewport width in device-independent pixels.
81 width: f32,
82 /// Logical viewport height in device-independent pixels.
83 height: f32,
84 /// Display DPI scale factor.
85 scale_factor: f32,
86 },
87 /// Safe-area insets changed (notch, Dynamic Island, system bars, Stage Manager).
88 SafeAreaChanged(SafeAreaInsets),
89 /// Device or window orientation changed.
90 OrientationChanged(ScreenOrientation),
91 /// Host OS/browser light or dark theme preference changed.
92 ThemeChanged(ThemeMode),
93 /// Host OS/browser preferred BCP-47 locale changed.
94 LocaleChanged(String),
95 /// Soft virtual keyboard / IME visibility or covered height changed.
96 KeyboardVisibilityChanged {
97 /// Whether the soft virtual keyboard is currently shown.
98 visible: bool,
99 /// Keyboard height in logical pixels (`0.0` when hidden).
100 height: f32,
101 },
102 /// Operating system signaled memory pressure.
103 MemoryWarning(MemoryPressure),
104 /// Operating system toggled battery saver / low-power mode.
105 LowPowerModeChanged(bool),
106 /// Host network connectivity status changed.
107 NetworkStatusChanged(NetworkStatus),
108 /// Hardware/gesture system back navigation was triggered.
109 BackPressed,
110 /// Host OS delivered a custom-scheme or universal deep link URI.
111 DeepLink(String),
112 /// System clipboard content changed.
113 ClipboardChanged,
114 /// Real hardware gyroscope/accelerometer/gravity sensor sample aligned to the current screen axes.
115 DeviceMotion(DeviceMotionSample),
116}