pub struct DragState {
pub source_id: WidgetId,
pub payload: DragPayload,
pub start_pos: Position,
pub current_pos: Position,
pub preview: Option<Box<dyn Widget>>,
}Expand description
Active drag operation state.
Created when a drag starts and destroyed when it ends or is cancelled. The drag manager (bd-1csc.3) owns this state.
Fields§
§source_id: WidgetIdWidget that initiated the drag.
payload: DragPayloadData being dragged.
start_pos: PositionPosition where the drag started.
current_pos: PositionCurrent drag position.
preview: Option<Box<dyn Widget>>Optional custom preview widget.
Implementations§
Source§impl DragState
impl DragState
Sourcepub fn new(
source_id: WidgetId,
payload: DragPayload,
start_pos: Position,
) -> Self
pub fn new( source_id: WidgetId, payload: DragPayload, start_pos: Position, ) -> Self
Create a new drag state.
Sourcepub fn with_preview(self, preview: Box<dyn Widget>) -> Self
pub fn with_preview(self, preview: Box<dyn Widget>) -> Self
Set a custom preview widget.
Sourcepub fn update_position(&mut self, pos: Position)
pub fn update_position(&mut self, pos: Position)
Update the current position during a drag move.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DragState
impl !RefUnwindSafe for DragState
impl !Send for DragState
impl !Sync for DragState
impl Unpin for DragState
impl UnsafeUnpin for DragState
impl !UnwindSafe for DragState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more