1use crate::*;
2
3#[derive(Data)]
7pub struct NativeEventHandler {
8 #[get(pub(crate))]
10 #[set(pub(crate))]
11 pub(crate) event_name: String,
12 #[get(pub(crate))]
14 #[set(pub(crate))]
15 pub(crate) callback: Rc<RefCell<dyn FnMut(NativeEvent)>>,
16}
17
18#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
22pub struct NativeMouseEvent {
23 #[get(pub, type(copy))]
25 #[set(pub)]
26 pub(crate) client_x: i32,
27 #[get(pub, type(copy))]
29 #[set(pub)]
30 pub(crate) client_y: i32,
31 #[get(pub, type(copy))]
33 #[set(pub)]
34 pub(crate) screen_x: i32,
35 #[get(pub, type(copy))]
37 #[set(pub)]
38 pub(crate) screen_y: i32,
39 #[get(pub, type(copy))]
41 #[set(pub)]
42 pub(crate) button: i16,
43 #[get(pub, type(copy))]
45 #[set(pub)]
46 pub(crate) buttons: u16,
47 #[get(pub, type(copy))]
49 #[set(pub)]
50 pub(crate) ctrl_key: bool,
51 #[get(pub, type(copy))]
53 #[set(pub)]
54 pub(crate) shift_key: bool,
55 #[get(pub, type(copy))]
57 #[set(pub)]
58 pub(crate) alt_key: bool,
59 #[get(pub, type(copy))]
61 #[set(pub)]
62 pub(crate) meta_key: bool,
63}
64
65#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
69pub struct NativeInputEvent {
70 #[get(pub)]
72 #[set(pub)]
73 value: String,
74 #[get(pub)]
76 #[set(pub)]
77 input_type: String,
78}
79
80#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
84pub struct NativeKeyboardEvent {
85 #[get(pub)]
87 #[set(pub)]
88 pub(crate) key: String,
89 #[get(pub)]
91 #[set(pub)]
92 pub(crate) code: String,
93 #[get(pub, type(copy))]
95 #[set(pub)]
96 pub(crate) location: u32,
97 #[get(pub, type(copy))]
99 #[set(pub)]
100 pub(crate) ctrl_key: bool,
101 #[get(pub, type(copy))]
103 #[set(pub)]
104 pub(crate) shift_key: bool,
105 #[get(pub, type(copy))]
107 #[set(pub)]
108 pub(crate) alt_key: bool,
109 #[get(pub, type(copy))]
111 #[set(pub)]
112 pub(crate) meta_key: bool,
113 #[get(pub, type(copy))]
115 #[set(pub)]
116 pub(crate) repeat: bool,
117}
118
119#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
123pub struct NativeFocusEvent {
124 #[get(pub, type(copy))]
126 #[set(pub)]
127 is_focus: bool,
128 #[get(pub, type(copy))]
130 #[set(pub)]
131 is_blur: bool,
132}
133
134#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
138pub struct NativeSubmitEvent {
139 #[get(pub)]
141 #[set(pub)]
142 submitter: Option<String>,
143}
144
145#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
149pub struct NativeChangeEvent {
150 #[get(pub)]
152 #[set(pub)]
153 value: String,
154 #[get(pub, type(copy))]
156 #[set(pub)]
157 checked: bool,
158}
159
160#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
164pub struct NativeDragEvent {
165 #[get(pub, type(copy))]
167 #[set(pub)]
168 client_x: i32,
169 #[get(pub, type(copy))]
171 #[set(pub)]
172 client_y: i32,
173 #[get(pub)]
175 #[set(pub)]
176 types: Vec<String>,
177}
178
179#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
183pub struct NativeTouchEvent {
184 #[get(pub, type(copy))]
186 #[set(pub)]
187 touches_count: u32,
188 #[get(pub, type(copy))]
190 #[set(pub)]
191 client_x: i32,
192 #[get(pub, type(copy))]
194 #[set(pub)]
195 client_y: i32,
196}
197
198#[derive(Clone, Data, Debug, Default, New, PartialEq)]
202pub struct NativeWheelEvent {
203 #[get(pub, type(copy))]
205 #[set(pub)]
206 delta_x: f64,
207 #[get(pub, type(copy))]
209 #[set(pub)]
210 delta_y: f64,
211 #[get(pub, type(copy))]
213 #[set(pub)]
214 delta_mode: u32,
215}
216
217#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
221pub struct NativeClipboardEvent {
222 #[get(pub)]
224 #[set(pub)]
225 data: Option<String>,
226}
227
228#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
232pub struct NativeMediaEvent {
233 #[get(pub)]
235 #[set(pub)]
236 event_type: String,
237}