rust_widgets 0.9.6

Pure Rust cross-platform native GUI library with hardware-adaptive rendering, 60+ widgets, touch/gesture support, i18n, and SVG-pipeline-accurate output
use crate::core::ObjectId;
use crate::platform::{get_platform, DropEvent, Platform};
/// High-level drag-and-drop access facade.
///
/// This manager exposes minimal cross-platform drag and drop entry points.
pub struct DragDropManager;
impl DragDropManager {
    /// Start a drag operation from a source widget.
    ///
    /// `mime` identifies payload type and `payload` carries raw bytes.
    /// Returns `true` if the backend accepts the drag request.
    pub fn begin_drag(source_widget_id: ObjectId, mime: impl AsRef<str>, payload: &[u8]) -> bool {
        Self::begin_drag_with(get_platform(), source_widget_id, mime.as_ref(), payload)
    }
    /// Inject a drop event into the backend queue.
    ///
    /// Useful for tests, bridges, and host-driven event forwarding.
    pub fn inject_drop_event(event: DropEvent) -> bool {
        Self::inject_drop_event_with(get_platform(), event)
    }
    /// Poll the next pending drop event, if any.
    pub fn poll_drop_event() -> Option<DropEvent> {
        Self::poll_drop_event_with(get_platform())
    }
    pub(crate) fn begin_drag_with(
        platform: &dyn Platform,
        source_widget_id: ObjectId,
        mime: &str,
        payload: &[u8],
    ) -> bool {
        platform.begin_drag(source_widget_id, mime, payload)
    }
    pub(crate) fn inject_drop_event_with(platform: &dyn Platform, event: DropEvent) -> bool {
        platform.inject_drop_event(event)
    }
    pub(crate) fn poll_drop_event_with(platform: &dyn Platform) -> Option<DropEvent> {
        platform.poll_drop_event()
    }
}