DropHandlerBase
trait · ferroui-xaml-interactions-draganddrop · v0.5.0
trait DropHandlerBase
Provides helper methods for custom drop handlers.
Deviation (DEVIATIONS.md, Behaviors): the abstract class of the reference is a trait whose
methods have the bodies of the virtual methods of the class, and every type that implements it
is an IDropHandler. A handler overrides validate and
execute (and the others when it needs to); an override calls the body of the
base class through the base_* method of the same name. The IList<T> helpers work on a
FerroList, and the overloads of MoveItem and SwapItem that take two collections are
move_item_between and swap_item_between.
Call the methods with the trait named (DropHandlerBase::enter(handler, ..))
where IDropHandler is in scope too: the two traits have the same method names.
Members
move_itemmove_item_betweenswap_itemswap_item_betweeninsert_itementerbase_enteroverbase_overdropbase_dropleavebase_leavevalidateexecutecancel
move_item
fn move_item<T: Clone>(self: &Self, items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
Moves an item within a collection.
move_item_between
fn move_item_between<T: Clone>(self: &Self, source_items: &FerroList<T>, target_items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
Moves an item from one collection to another.
swap_item
fn swap_item<T: Clone + PartialEq>(self: &Self, items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
Swaps two items inside a collection.
swap_item_between
fn swap_item_between<T: Clone + PartialEq>(self: &Self, source_items: &FerroList<T>, target_items: &FerroList<T>, source_index: usize, target_index: usize)
where Self: Sized
Swaps an item of one collection with an item of another.
insert_item
fn insert_item<T: Clone>(self: &Self, items: &FerroList<T>, item: T, index: usize)
where Self: Sized
Inserts an item into a collection at the specified index.
enter
fn enter(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
Called when a drag enters the target.
base_enter
fn base_enter(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
The body of enter of the base class: the effects the target accepts, from
validate.
over
fn over(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
Called continuously while a drag is over the target.
base_over
fn base_over(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
The body of over of the base class: the effects the target accepts, from
validate.
drop
fn drop(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
Called when the drag is dropped on the target.
base_drop
fn base_drop(self: &Self, sender: Option<&BoxedValue>, e: &DragEventArgs, source_context: Option<&BoxedValue>, target_context: Option<&BoxedValue>)
The body of drop of the base class: the effects of the drop, from
execute.
leave
fn leave(self: &Self, sender: Option<&BoxedValue>, e: &RoutedEventArgs)
Called when the drag leaves the target.
base_leave
fn base_leave(self: &Self, sender: Option<&BoxedValue>, e: &RoutedEventArgs)
The body of leave of the base class: cancel.
validate
fn validate(self: &Self, _sender: Option<&BoxedValue>, _e: &DragEventArgs, _source_context: Option<&BoxedValue>, _target_context: Option<&BoxedValue>, _state: Option<&BoxedValue>) -> bool
Validates whether the drag operation can be performed.
execute
fn execute(self: &Self, _sender: Option<&BoxedValue>, _e: &DragEventArgs, _source_context: Option<&BoxedValue>, _target_context: Option<&BoxedValue>, _state: Option<&BoxedValue>) -> bool
Executes the drop operation.
cancel
fn cancel(self: &Self, _sender: Option<&BoxedValue>, _e: &RoutedEventArgs)
Cancels the drag operation.
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.