Skip to main content

KeyboardDragManager

Struct KeyboardDragManager 

Source
pub struct KeyboardDragManager { /* private fields */ }
Expand description

Manager for keyboard-driven drag operations.

Implementations§

Source§

impl KeyboardDragManager

Source

pub fn new(config: KeyboardDragConfig) -> Self

Create a new keyboard drag manager.

Source

pub fn with_defaults() -> Self

Create with default configuration.

Source

pub fn mode(&self) -> KeyboardDragMode

Get the current drag mode.

Source

pub fn is_active(&self) -> bool

Check if a drag is active.

Source

pub fn state(&self) -> Option<&KeyboardDragState>

Get the current drag state.

Source

pub fn state_mut(&mut self) -> Option<&mut KeyboardDragState>

Get mutable access to the drag state.

Source

pub fn start_drag(&mut self, source_id: WidgetId, payload: DragPayload) -> bool

Start a keyboard drag operation.

Returns true if the drag was started successfully. Returns false if a drag is already in progress.

Source

pub fn navigate_targets<'a>( &mut self, direction: Direction, targets: &'a [DropTargetInfo], ) -> Option<&'a DropTargetInfo>

Navigate to the next drop target in the given direction.

Returns the newly selected target info if navigation succeeded.

Source

pub fn select_target( &mut self, target_index: usize, targets: &[DropTargetInfo], ) -> bool

Navigate to a specific target by index.

Source

pub fn complete_drag(&mut self) -> Option<(DragPayload, usize)>

Complete the drag operation (drop on selected target).

Returns None if no target is selected or no drag is active. Returns Some((payload, target_index)) with the payload and target index.

Source

pub fn drop_on_target( &mut self, targets: &[DropTargetInfo], ) -> Option<KeyboardDropResult>

Complete the drag with a specific target and get the drop result info.

Source

pub fn cancel_drag(&mut self) -> Option<DragPayload>

Cancel the current drag operation.

Returns the payload if a drag was active.

Source

pub fn handle_key(&mut self, key: KeyboardDragKey) -> KeyboardDragAction

Handle key press during keyboard drag.

Returns KeyboardDragAction indicating what action was triggered.

Source

pub fn tick(&mut self)

Advance animation state.

Source

pub fn drain_announcements(&mut self) -> Vec<Announcement>

Get and clear pending announcements.

Source

pub fn announcements(&self) -> &[Announcement]

Peek at pending announcements without clearing.

Source

pub fn render_highlight( &self, targets: &[DropTargetInfo], frame: &mut Frame<'_>, )

Render the target highlight overlay.

Trait Implementations§

Source§

impl Debug for KeyboardDragManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more