1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Drag&drop service, types and events.
//!
//! The example below defines a window that shows the current dragging data that has entered any of the app windows.
//!
//! ```
//! use zng::prelude::*;
//! # let _scope = APP.defaults();
//! use zng::drag_drop::*;
//!
//! let data = var::<Vec<DragDropData>>(vec![]);
//! # let _ =
//! Window! {
//! padding = 20;
//! child = Container! {
//! widget::border = 5, widget::BorderSides::dashed(colors::GRAY);
//! widget::corner_radius = 15;
//! child_align = Align::CENTER;
//! on_drag_enter = hn!(data, |_| {
//! data.set(DRAG_DROP.dragging_data().get());
//! });
//! on_drag_leave = hn!(data, |_| {
//! data.set(vec![]);
//! });
//! on_drop = hn!(data, |args: &DropArgs| {
//! data.set(args.data.clone());
//! });
//! child = Text!(data.map(|d| if d.is_empty() {
//! Txt::from("drag over to inspect")
//! } else {
//! formatx!("{d:#?}")
//! }));
//! }
//! }
//! # ;
//! ```
//!
//!
//! # Limitations
//!
//! Drag&drop depends on the view-process backend, the default view-process (`zng-view`) is currently very limited:
//!
//! * No drag start from the app.
//! * Only file path drops.
//! * No support in Wayland, you can work around by calling `std::env::remove_var("WAYLAND_DISPLAY");` before `zng::env::init!()` in
//! your main function, this enables XWayland that has support for the basic file path drop.
//! * In X11 and macOS there is no cursor position notification on hover, just on drop, `DRAG_HOVERED_EVENT` and `DRAG_MOVE_EVENT`
//! based event properties will only fire once for the widget that is about to receive a drop.
//!
//! # Full API
//!
//! See [`zng_ext_input::drag_drop`] and [`zng_wgt_input::drag_drop`] for the full drag&drop API.
pub use ;
pub use ;