pub struct DragDropSource<'ui, T> { /* private fields */ }Expand description
Builder for creating drag drop sources
This struct is created by Ui::drag_drop_source_config and provides
a fluent interface for configuring drag sources.
Implementations§
Source§impl<'ui, T: AsRef<str>> DragDropSource<'ui, T>
impl<'ui, T: AsRef<str>> DragDropSource<'ui, T>
Sourcepub fn flags(self, flags: DragDropFlags) -> Self
pub fn flags(self, flags: DragDropFlags) -> Self
Sourcepub fn begin(self) -> Option<DragDropSourceTooltip<'ui>>
pub fn begin(self) -> Option<DragDropSourceTooltip<'ui>>
Begin drag source with empty payload
This is the safest option for simple drag and drop operations. Use shared state or other mechanisms to transfer actual data.
Returns a tooltip token if dragging started, None otherwise.
Sourcepub fn begin_payload<P: Copy + 'static>(
self,
payload: P,
) -> Option<DragDropSourceTooltip<'ui>>
pub fn begin_payload<P: Copy + 'static>( self, payload: P, ) -> Option<DragDropSourceTooltip<'ui>>
Begin drag source with typed payload
The payload data will be copied and managed by ImGui.
The data must be Copy + 'static for safety.
§Arguments
payload- Data to transfer (must be Copy + ’static)
Returns a tooltip token if dragging started, None otherwise.
Sourcepub unsafe fn begin_payload_unchecked(
&self,
ptr: *const c_void,
size: usize,
) -> Option<DragDropSourceTooltip<'ui>>
pub unsafe fn begin_payload_unchecked( &self, ptr: *const c_void, size: usize, ) -> Option<DragDropSourceTooltip<'ui>>
Begin drag source with raw payload data (unsafe)
§Safety
The caller must ensure:
ptrpoints to valid data ofsizebytes- The data remains valid for the duration of the drag operation
- The data layout matches what targets expect
§Arguments
ptr- Pointer to payload datasize- Size of payload data in bytes
Trait Implementations§
Auto Trait Implementations§
impl<'ui, T> Freeze for DragDropSource<'ui, T>where
T: Freeze,
impl<'ui, T> !RefUnwindSafe for DragDropSource<'ui, T>
impl<'ui, T> !Send for DragDropSource<'ui, T>
impl<'ui, T> !Sync for DragDropSource<'ui, T>
impl<'ui, T> Unpin for DragDropSource<'ui, T>where
T: Unpin,
impl<'ui, T> !UnwindSafe for DragDropSource<'ui, T>
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