Skip to main content

ferroui_xaml_interactions_draganddrop/
lib.rs

1//! ferroui-xaml-interactions-draganddrop
2//!
3//! Drag and drop behaviors, ported from the `Xaml.Behaviors.Interactions.DragAndDrop` project of
4//! Xaml.Behaviors (see `NOTICE.md`):
5//!
6//! - drag sources that start a drag and drop of the system with context data
7//!   ([`ContextDragBehavior`], [`ContextDragWithDirectionBehavior`], [`PanelDragBehavior`]) or with
8//!   data of a type ([`TypedDragBehavior`]), notifying an [`IDragHandler`];
9//! - drop targets that hand the drag events to an [`IDropHandler`] ([`ContextDropBehavior`]), or
10//!   execute a command ([`FilesDropBehavior`], [`TextDropBehavior`], [`PanelDropBehavior`],
11//!   [`ContentControlFilesDropBehavior`], [`DragDropCommandsBehavior`]); the base of custom drop
12//!   handlers ([`DropHandlerBase`], [`BaseTreeViewDropHandler`]);
13//! - the preview of dragged files ([`FilesPreviewBehavior`], [`AddPreviewFilesAction`]);
14//! - a managed drag and drop inside the application, with a preview window
15//!   ([`ManagedContextDragBehavior`], [`ManagedContextDropBehavior`], [`ManagedDragDropService`],
16//!   [`DragPreviewService`]).
17//!
18//! The styles of the reference (`Styles.xaml`: the adorners of the tree view items a drag passes
19//! over) are compiled by the build of the crate; an application includes them with
20//! `<StyleInclude Source="ferres://FerroUI.Xaml.Interactions.DragAndDrop/Styles.xaml" />`.
21//!
22//! The namespace of the crate is `FerroUI.Xaml.Interactions.DragAndDrop` (and
23//! `FerroUI.Xaml.Interactions.DragAndDrop.Controls` for the preview window), the first mapped into
24//! the default XML namespace of the framework: documents name its types without a prefix once
25//! [`register_types`] ran.
26
27// The compiled markup names the types of the crate by the name of the crate, as the markup of any
28// other crate does.
29extern crate self as ferroui_xaml_interactions_draganddrop;
30
31// `compiled_xaml` (the compiled markup of the styles document) and `compiled_markup` (the loader
32// table of the crate and `register()`), which the build script generates.
33ferroui_markup_xaml::include_compiled_xaml!();
34
35mod add_preview_files_action;
36#[cfg(any(test, feature = "document-assets"))]
37mod assets;
38mod behaviors;
39mod content_control_files_drop_behavior;
40mod context_drag_behavior;
41mod context_drag_behavior_base;
42mod context_drag_with_direction_behavior;
43mod context_drop_behavior;
44mod context_drop_behavior_base;
45mod contract;
46mod drag_and_drop_events_behavior;
47mod drag_drop_commands_behavior;
48mod drag_drop_context_store;
49mod drop_behavior_base;
50mod drop_handler_base;
51mod files_drop_behavior;
52mod files_preview_behavior;
53mod managed_drag_drop;
54mod markup_types;
55mod panel_drag_behavior;
56mod panel_drop_behavior;
57mod register_types;
58mod routed_handlers;
59mod rust_paths;
60mod text_drop_behavior;
61mod typed_drag_behavior;
62mod typed_drag_behavior_base;
63pub mod values;
64
65pub use add_preview_files_action::AddPreviewFilesAction;
66pub use behaviors::BaseTreeViewDropHandler;
67pub use content_control_files_drop_behavior::ContentControlFilesDropBehavior;
68pub use context_drag_behavior::ContextDragBehavior;
69pub use context_drag_behavior_base::{
70    ContextDragBehaviorBase, ContextDragBehaviorBaseImpl, ContextDragBehaviorBaseImplExt, ContextDragBehaviorBaseVTable,
71};
72pub use context_drag_with_direction_behavior::ContextDragWithDirectionBehavior;
73pub use context_drop_behavior::ContextDropBehavior;
74pub use context_drop_behavior_base::{
75    ContextDropBehaviorBase, ContextDropBehaviorBaseImpl, ContextDropBehaviorBaseImplExt, ContextDropBehaviorBaseVTable,
76};
77pub use contract::{IDragHandler, IDropHandler};
78pub use drag_and_drop_events_behavior::{
79    DragAndDropEventsBehavior, DragAndDropEventsBehaviorImpl, DragAndDropEventsBehaviorImplExt,
80    DragAndDropEventsBehaviorVTable,
81};
82pub use drag_drop_commands_behavior::DragDropCommandsBehavior;
83pub use drop_behavior_base::DropBehaviorBase;
84pub use drop_handler_base::DropHandlerBase;
85pub use files_drop_behavior::FilesDropBehavior;
86pub use files_preview_behavior::FilesPreviewBehavior;
87pub use managed_drag_drop::{
88    DragPreviewService, DragPreviewWindow, ManagedContextDragBehavior, ManagedContextDropArgs, ManagedContextDropBehavior,
89    ManagedDataTransferExtensions, ManagedDataTransferItemExtensions, ManagedDragDropService,
90};
91pub use panel_drag_behavior::PanelDragBehavior;
92pub use panel_drop_behavior::PanelDropBehavior;
93pub use register_types::{register_types, ASSEMBLY};
94pub use text_drop_behavior::TextDropBehavior;
95pub use typed_drag_behavior::TypedDragBehavior;
96pub use typed_drag_behavior_base::{
97    TypedDragBehaviorBase, TypedDragBehaviorBaseImpl, TypedDragBehaviorBaseImplExt, TypedDragBehaviorBaseVTable,
98};
99
100#[cfg(test)]
101mod tests;