euv_core/platform/quickapp/struct.rs
1use super::*;
2
3/// Device display metrics reported by QuickApp `@system.device.getInfo()`.
4#[derive(Clone, Copy, Data, Debug, PartialEq)]
5pub struct QuickAppDeviceMetrics {
6 /// Active QuickApp runtime vendor (`Alliance` or `Huawei`).
7 #[get(type(copy))]
8 pub(crate) vendor: QuickAppVendor,
9 /// Physical screen width in pixels.
10 #[get(type(copy))]
11 pub(crate) screen_width_px: u32,
12 /// Physical screen height in pixels.
13 #[get(type(copy))]
14 pub(crate) screen_height_px: u32,
15 /// Device display density (`px / dp`).
16 #[get(type(copy))]
17 pub(crate) screen_density: f32,
18 /// QuickApp manifest `designWidth` reference (`750.0` default).
19 #[get(type(copy))]
20 pub(crate) design_width: f32,
21 /// OS status bar height in physical pixels.
22 #[get(type(copy))]
23 pub(crate) status_bar_height_px: u32,
24 /// OS bottom gesture/navigation bar height in physical pixels.
25 #[get(type(copy))]
26 pub(crate) nav_bar_height_px: u32,
27 /// Active system theme mode.
28 #[get(type(copy))]
29 pub(crate) theme: ThemeMode,
30}
31
32/// Active QuickApp `<canvas>` window record held by `QuickAppPlatform`.
33#[derive(Clone, Data, Debug)]
34pub struct QuickAppWindowRecord {
35 /// Window configuration snapshot.
36 pub(crate) config: WindowConfig,
37 /// Live window metrics in logical dp.
38 #[get(type(copy))]
39 pub(crate) state: WindowState,
40 /// Canvas element identifier.
41 #[get(type(copy))]
42 pub(crate) canvas_id: u32,
43 /// Last presented RGBA8 framebuffer snapshot.
44 pub(crate) last_frame: Framebuffer,
45 /// Total presented frames.
46 #[get(type(copy))]
47 pub(crate) present_count: u64,
48}
49
50/// Unified QuickApp runtime host adapter abstracting QuickApp Alliance (`@system.*`) and Huawei QuickApp.
51#[derive(Clone, Data, Debug)]
52pub struct QuickAppPlatform {
53 /// Device screen, density, design-width, and status-bar metrics.
54 #[get(type(copy))]
55 pub(crate) device_metrics: QuickAppDeviceMetrics,
56 /// Resolved logical safe-area insets.
57 #[get(type(copy))]
58 pub(crate) safe_area: SafeAreaInsets,
59 /// Monotonic window identifier allocator.
60 #[get(pub(crate), type(copy))]
61 #[get_mut(pub(crate))]
62 #[set(pub(crate))]
63 pub(crate) next_id: u64,
64 /// Primary QuickApp canvas window identifier, if created.
65 #[get(skip)]
66 pub(crate) primary_window: Option<WindowId>,
67 /// Active QuickApp canvas windows.
68 pub(crate) windows: HashMap<WindowId, QuickAppWindowRecord>,
69 /// Multi-touch contact lifecycle tracker.
70 pub(crate) touch_tracker: TouchPointerTracker,
71 /// Queued normalized EUV `WindowEvent` and `SystemEvent`s.
72 pub(crate) pending_events: Vec<WindowEvent>,
73 /// Outbound `@system.*` host commands drained by the UX shell.
74 pub(crate) outbound_commands: Vec<QuickAppHostCommand>,
75 /// Mirrored `@system.storage` key-value cache.
76 pub(crate) storage: HashMap<String, String>,
77 /// Active `@system.router` navigation stack.
78 pub(crate) route_stack: Vec<String>,
79 /// Mirrored `@system.clipboard` text buffer.
80 #[get(skip)]
81 pub(crate) clipboard: Option<String>,
82 /// Whether the QuickApp frame pump is paused (`onHide`/`onDestroy`).
83 #[get(type(copy))]
84 pub(crate) pump_paused: bool,
85}