1use super::{View};
8use crate::views;
9
10impl View {
11 pub fn drag_configuration(
19 self,
20 within_app: views::DragOperations,
21 outside_app: views::DragOperations,
22 ) -> Self {
23 Self::new(views::drag_configuration(&self.handle, within_app, outside_app))
24 }
25
26 pub fn drag_container(self, items: &[&str]) -> Self {
28 Self::new(views::drag_container(&self.handle, items))
29 }
30
31 pub fn drag_container_selection(self, selected: &[&str]) -> Self {
34 Self::new(views::drag_container_selection(&self.handle, selected))
35 }
36
37 pub fn draggable_container_item(self, id: views::HashableValue<'_>) -> Self {
40 Self::new(views::draggable_container_item(&self.handle, id))
41 }
42
43 pub fn drag_previews_formation(self, value: views::DragDropPreviewsFormation) -> Self {
45 Self::new(views::drag_previews_formation(&self.handle, value))
46 }
47
48 pub fn drop_previews_formation(self, value: views::DragDropPreviewsFormation) -> Self {
50 Self::new(views::drop_previews_formation(&self.handle, value))
51 }
52
53 pub fn drop_configuration(self, decide: impl Fn() -> views::DropOperation + 'static) -> Self {
56 Self::new(views::drop_configuration(&self.handle, decide))
57 }
58
59 pub fn drop_destination(
62 self,
63 accept: impl Fn(&[String]) -> bool + 'static,
64 targeted: impl Fn(bool) + 'static,
65 ) -> Self {
66 Self::new(views::drop_destination(&self.handle, accept, targeted))
67 }
68
69 pub fn on_drag_session_updated(self, action: impl Fn() + 'static) -> Self {
71 Self::new(views::on_drag_session_updated(&self.handle, action))
72 }
73
74 pub fn on_drop_session_updated(self, action: impl Fn() + 'static) -> Self {
76 Self::new(views::on_drop_session_updated(&self.handle, action))
77 }
78
79 pub fn on_copy_command(self, items: &[&str]) -> Self {
87 Self::new(views::on_copy_command(&self.handle, items))
88 }
89
90 pub fn on_cut_command(self, items: &[&str]) -> Self {
92 Self::new(views::on_cut_command(&self.handle, items))
93 }
94
95 pub fn on_paste_command(
97 self,
98 kinds: &[views::ContentType],
99 paste: impl Fn(&[views::ItemProvider]) + 'static,
100 ) -> Self {
101 Self::new(views::on_paste_command(&self.handle, kinds, paste))
102 }
103
104 pub fn on_delete_command(self, action: impl Fn() + 'static) -> Self {
106 Self::new(views::on_delete_command(&self.handle, action))
107 }
108
109 pub fn on_move_command(self, action: impl Fn(i64) + 'static) -> Self {
111 Self::new(views::on_move_command(&self.handle, action))
112 }
113
114 pub fn on_exit_command(self, action: impl Fn() + 'static) -> Self {
116 Self::new(views::on_exit_command(&self.handle, action))
117 }
118
119 pub fn on_command(self, selector: &'static core::ffi::CStr, action: impl Fn() + 'static) -> Self {
122 Self::new(views::on_command(&self.handle, selector, action))
123 }
124
125 pub fn cuttable(self, items: &[&str]) -> Self {
128 Self::new(views::cuttable(&self.handle, items))
129 }
130
131 pub fn paste_destination(self, paste: impl Fn(&[String]) + 'static) -> Self {
133 Self::new(views::paste_destination(&self.handle, paste))
134 }
135
136 pub fn rename_action(self, action: impl Fn() + 'static) -> Self {
139 Self::new(views::rename_action(&self.handle, action))
140 }
141
142 pub fn pointer_style(self, style: Option<views::PointerStyle>) -> Self {
146 Self::new(views::pointer_style(&self.handle, style))
147 }
148
149 pub fn pointer_visibility(self, value: views::Visibility) -> Self {
151 Self::new(views::pointer_visibility(&self.handle, value))
152 }
153
154 pub fn on_modifier_keys_changed(
156 self,
157 mask: views::EventModifier,
158 initial: bool,
159 action: impl Fn(u64, u64) + 'static,
160 ) -> Self {
161 Self::new(views::on_modifier_keys_changed(&self.handle, mask, initial, action))
162 }
163
164 pub fn modifier_key_alternate(self, modifiers: views::EventModifier, content: View) -> Self {
166 Self::new(views::modifier_key_alternate(&self.handle, modifiers, content.handle()))
167 }
168
169 pub fn on_interactive_resize_change(self, action: impl Fn(bool) + 'static) -> Self {
171 Self::new(views::on_interactive_resize_change(&self.handle, action))
172 }
173
174 pub fn user_activity(self, kind: &str, active: bool, action: impl Fn() + 'static) -> Self {
177 Self::new(views::user_activity(&self.handle, kind, active, action))
178 }
179
180 pub fn on_continue_user_activity(self, kind: &str, action: impl Fn() + 'static) -> Self {
182 Self::new(views::on_continue_user_activity(&self.handle, kind, action))
183 }
184
185 pub fn handles_external_events(self, preferring: &[&str], allowing: &[&str]) -> Self {
187 Self::new(views::handles_external_events(&self.handle, preferring, allowing))
188 }
189
190 pub fn allowed_dynamic_range_high(self) -> Self {
192 Self::new(views::allowed_dynamic_range_high(&self.handle))
193 }
194
195 pub fn tab_item(self, label: View) -> Self {
199 Self::new(views::tab_item(&self.handle, label.handle()))
200 }
201
202 pub fn high_priority_gesture(self, minimum_distance: f64, action: impl Fn() + 'static) -> Self {
205 Self::new(views::high_priority_gesture(&self.handle, minimum_distance, action))
206 }
207
208 pub fn simultaneous_gesture(self, minimum_distance: f64, action: impl Fn() + 'static) -> Self {
211 Self::new(views::simultaneous_gesture(&self.handle, minimum_distance, action))
212 }
213
214 pub fn on_open_url(self, action: impl Fn(&str) + 'static) -> Self {
216 Self::new(views::on_open_url(&self.handle, action))
217 }
218
219 pub fn copyable(self, items: &[&str]) -> Self {
221 Self::new(views::copyable(&self.handle, items))
222 }
223
224 pub fn scroll_position_id(
229 self,
230 state: &views::BoundState<String>,
231 anchor: Option<(f64, f64)>,
232 ) -> Self {
233 Self::new(views::scroll_position_id(&self.handle, state, anchor))
234 }
235
236 pub fn default_scroll_anchor(
238 self,
239 anchor: Option<(f64, f64)>,
240 role: views::ScrollAnchorRole,
241 ) -> Self {
242 Self::new(views::default_scroll_anchor(&self.handle, anchor, role))
243 }
244
245 pub fn scroll_target_layout(self, enabled: bool) -> Self {
248 Self::new(views::scroll_target_layout(&self.handle, enabled))
249 }
250
251 pub fn scroll_bounce_behavior(
253 self,
254 behavior: views::ScrollBounceBehavior,
255 axes: views::AxisSet,
256 ) -> Self {
257 Self::new(views::scroll_bounce_behavior(&self.handle, behavior, axes))
258 }
259
260 pub fn scroll_indicators_flash(self, on_appear: bool) -> Self {
262 Self::new(views::scroll_indicators_flash(&self.handle, on_appear))
263 }
264
265 pub fn scroll_edge_effect_hidden(self, hidden: bool, edges: views::EdgeSet) -> Self {
267 Self::new(views::scroll_edge_effect_hidden(&self.handle, hidden, edges))
268 }
269
270 pub fn scroll_edge_effect_style(
272 self,
273 style: Option<views::ScrollEdgeEffectStyle>,
274 edges: &[views::EdgeSetMember],
275 ) -> Self {
276 Self::new(views::scroll_edge_effect_style(&self.handle, style, edges))
277 }
278
279 pub fn scroll_transition(
282 self,
283 config: views::ScrollTransitionConfiguration,
284 axis: Option<views::Axis>,
285 ) -> Self {
286 Self::new(views::scroll_transition(&self.handle, config, axis))
287 }
288
289 pub fn scroll_transition_ends(
296 self,
297 top_leading: views::ScrollTransitionConfiguration,
298 bottom_trailing: views::ScrollTransitionConfiguration,
299 axis: Option<views::Axis>,
300 ) -> Self {
301 Self::new(views::scroll_transition_ends(
302 &self.handle,
303 top_leading,
304 bottom_trailing,
305 axis,
306 ))
307 }
308
309 pub fn on_scroll_phase_change(self, action: impl Fn(i64, i64) + 'static) -> Self {
311 Self::new(views::on_scroll_phase_change(&self.handle, action))
312 }
313
314 pub fn on_scroll_visibility_change(self, threshold: f64, action: impl Fn(bool) + 'static) -> Self {
316 Self::new(views::on_scroll_visibility_change(&self.handle, threshold, action))
317 }
318
319 pub fn default_focus(self, value: bool, priority: views::DefaultFocusPriority) -> Self {
323 Self::new(views::default_focus(&self.handle, value, priority))
324 }
325
326 pub fn prefers_default_focus(self, prefers: bool) -> Self {
328 Self::new(views::prefers_default_focus(&self.handle, prefers))
329 }
330
331 pub fn focus_scope(self) -> Self {
333 Self::new(views::focus_scope(&self.handle))
334 }
335
336 pub fn a11y_focused(self) -> Self {
338 Self::new(views::accessibility_focused(&self.handle))
339 }
340
341 pub fn a11y_default_focus(self, value: bool) -> Self {
343 Self::new(views::accessibility_default_focus(&self.handle, value))
344 }
345
346 pub fn focused(self) -> Self {
348 Self::new(views::focused(&self.handle))
349 }
350
351 pub fn matched_geometry_effect(
354 self,
355 id: views::HashableValue<'_>,
356 properties: &[views::GeometryProperties],
357 anchor: (f64, f64),
358 is_source: bool,
359 ) -> Self {
360 Self::new(views::matched_geometry_effect(
361 &self.handle,
362 id,
363 properties,
364 anchor,
365 is_source,
366 ))
367 }
368
369 pub fn matched_geometry_effect_in(
376 self,
377 id: views::HashableValue<'_>,
378 namespace: views::Namespace,
379 properties: &[views::GeometryProperties],
380 anchor: (f64, f64),
381 is_source: bool,
382 ) -> Self {
383 Self::new(views::matched_geometry_effect_in(
384 &self.handle,
385 id,
386 namespace,
387 properties,
388 anchor,
389 is_source,
390 ))
391 }
392
393 pub fn on_drag_item(self, item: &str, preview: View) -> Self {
399 Self::new(views::on_drag(&self.handle, item, preview.handle()))
400 }
401
402 pub fn on_drop(
405 self,
406 kinds: &[views::ContentType],
407 accept: impl Fn(&[views::ItemProvider]) -> bool + 'static,
408 ) -> Self {
409 Self::new(views::on_drop(&self.handle, kinds, accept))
410 }
411
412 pub fn on_key_press(
435 self,
436 characters: views::CharacterSetKind,
437 phases: views::KeyPressPhases,
438 action: impl Fn(views::KeyPress) -> views::KeyPressResult + 'static,
439 ) -> Self {
440 Self::new(views::on_key_press(&self.handle, characters, phases, action))
441 }
442
443 pub fn on_key(
457 self,
458 key: views::Key,
459 action: impl Fn() -> views::KeyPressResult + 'static,
460 ) -> Self {
461 Self::new(views::on_key(&self.handle, key, action))
462 }
463
464 pub fn sensory_feedback(
467 self,
468 feedback: views::SensoryFeedback,
469 trigger: i64,
470 condition: impl Fn(i64, i64) -> bool + 'static,
471 ) -> Self {
472 Self::new(views::sensory_feedback(&self.handle, feedback, trigger, condition))
473 }
474
475 #[cfg(not(target_os = "macos"))]
483 pub fn hover_effect_lift(self) -> Self {
484 Self::new(views::hover_effect_lift(&self.handle))
485 }
486
487 #[cfg(not(target_os = "macos"))]
491 pub fn hover_effect_highlight(self) -> Self {
492 Self::new(views::hover_effect_highlight(&self.handle))
493 }
494
495 pub fn on_hover(self, callback: impl Fn(bool) + 'static) -> Self {
498 Self::new(views::on_hover(&self.handle, callback))
499 }
500}