1use crate::*;
2
3#[derive(CustomDebug, Data)]
7pub struct NativeEventHandler {
8 #[get(pub(crate))]
10 #[set(pub(crate))]
11 pub(crate) event_name: String,
12 #[debug(skip)]
14 #[get(pub(crate))]
15 #[set(pub(crate))]
16 pub(crate) callback: Rc<RefCell<dyn FnMut(NativeEvent)>>,
17}
18
19#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
23pub struct NativeMouseEvent {
24 #[get(pub, type(copy))]
26 #[set(pub)]
27 pub(crate) client_x: i32,
28 #[get(pub, type(copy))]
30 #[set(pub)]
31 pub(crate) client_y: i32,
32 #[get(pub, type(copy))]
34 #[set(pub)]
35 pub(crate) screen_x: i32,
36 #[get(pub, type(copy))]
38 #[set(pub)]
39 pub(crate) screen_y: i32,
40 #[get(pub, type(copy))]
42 #[set(pub)]
43 pub(crate) button: i16,
44 #[get(pub, type(copy))]
46 #[set(pub)]
47 pub(crate) buttons: u16,
48 #[get(pub, type(copy))]
50 #[set(pub)]
51 pub(crate) ctrl_key: bool,
52 #[get(pub, type(copy))]
54 #[set(pub)]
55 pub(crate) shift_key: bool,
56 #[get(pub, type(copy))]
58 #[set(pub)]
59 pub(crate) alt_key: bool,
60 #[get(pub, type(copy))]
62 #[set(pub)]
63 pub(crate) meta_key: bool,
64}
65
66#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
70pub struct NativeInputEvent {
71 #[get(pub)]
73 #[set(pub)]
74 value: String,
75 #[get(pub)]
77 #[set(pub)]
78 input_type: String,
79}
80
81#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
85pub struct NativeKeyboardEvent {
86 #[get(pub)]
88 #[set(pub)]
89 pub(crate) key: String,
90 #[get(pub)]
92 #[set(pub)]
93 pub(crate) code: String,
94 #[get(pub, type(copy))]
96 #[set(pub)]
97 pub(crate) location: u32,
98 #[get(pub, type(copy))]
100 #[set(pub)]
101 pub(crate) ctrl_key: bool,
102 #[get(pub, type(copy))]
104 #[set(pub)]
105 pub(crate) shift_key: bool,
106 #[get(pub, type(copy))]
108 #[set(pub)]
109 pub(crate) alt_key: bool,
110 #[get(pub, type(copy))]
112 #[set(pub)]
113 pub(crate) meta_key: bool,
114 #[get(pub, type(copy))]
116 #[set(pub)]
117 pub(crate) repeat: bool,
118}
119
120#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
124pub struct NativeFocusEvent {
125 #[get(pub, type(copy))]
127 #[set(pub)]
128 is_focus: bool,
129 #[get(pub, type(copy))]
131 #[set(pub)]
132 is_blur: bool,
133}
134
135#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
139pub struct NativeSubmitEvent {
140 #[get(pub)]
142 #[set(pub)]
143 submitter: Option<String>,
144}
145
146#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
150pub struct NativeChangeEvent {
151 #[get(pub)]
153 #[set(pub)]
154 value: String,
155 #[get(pub, type(copy))]
157 #[set(pub)]
158 checked: bool,
159}
160
161#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
165pub struct NativeDragEvent {
166 #[get(pub, type(copy))]
168 #[set(pub)]
169 client_x: i32,
170 #[get(pub, type(copy))]
172 #[set(pub)]
173 client_y: i32,
174 #[get(pub)]
176 #[set(pub)]
177 types: Vec<String>,
178}
179
180#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
184pub struct NativeTouchEvent {
185 #[get(pub, type(copy))]
187 #[set(pub)]
188 touches_count: u32,
189 #[get(pub, type(copy))]
191 #[set(pub)]
192 client_x: i32,
193 #[get(pub, type(copy))]
195 #[set(pub)]
196 client_y: i32,
197}
198
199#[derive(Clone, Data, Debug, Default, New, PartialEq)]
203pub struct NativeWheelEvent {
204 #[get(pub, type(copy))]
206 #[set(pub)]
207 delta_x: f64,
208 #[get(pub, type(copy))]
210 #[set(pub)]
211 delta_y: f64,
212 #[get(pub, type(copy))]
214 #[set(pub)]
215 delta_mode: u32,
216}
217
218#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
222pub struct NativeClipboardEvent {
223 #[get(pub)]
225 #[set(pub)]
226 data: Option<String>,
227}
228
229#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
233pub struct NativeMediaEvent {
234 #[get(pub)]
236 #[set(pub)]
237 event_type: String,
238}