#external #interaction #gui-component #component #draganddrop

aloe-drag-and-drop

Aloe Drag and Drop provides extensible Rust traits and structs for adding drag-and-drop functionality to GUI components, supporting files, text, and custom object interactions. This crate is a translation of the c++ juce module serving the same function.

1 unstable release

Uses new Rust 2024

new 0.1.1 Apr 2, 2025

#4 in #gui-component

40 downloads per month
Used in 68 crates (13 directly)

GPL-3.0 license

2MB
15K SLoC

Aloe Drag and Drop

Aloe Drag and Drop is a sophisticated Rust crate designed to facilitate seamless drag-and-drop interactions within GUI applications. This crate provides extensive support for drag-and-drop operations involving files, text, and custom components, both internally within applications and across different applications via external drag-and-drop.

Features

  • File Drag-and-Drop: Enables components to receive files from external sources through drag-and-drop events.
  • Text Drag-and-Drop: Supports dragging of textual data, allowing components to handle dropped text.
  • Custom Component Dragging: Provides a comprehensive interface for dragging complex objects within a GUI, with support for custom drag images and constraints on component movement.
  • External Drag-and-Drop Support: Facilitates interaction with the operating system's drag-and-drop mechanisms to move files or text between applications.

Usage

Implement the necessary traits such as FileDragAndDropTarget, TextDragAndDropTarget, or DragAndDropTarget within your components to enable drag-and-drop functionality. Utilize methods such as start_dragging_component within mouse event handlers to initiate drag operations.

Example

use aloe_drag_and_drop::{ComponentDragger, DragAndDropContainer};

struct MyComponent {
    dragger: ComponentDragger,
}

impl MyComponent {
    fn on_mouse_down(&mut self) {
        self.dragger.start_dragging_component(self, ...);
    }

    fn on_mouse_drag(&mut self) {
        self.dragger.drag_component(self, ...);
    }
}

Advanced Operations

  • Using Drag Image: Customize the drag image shown during a drag-and-drop operation by using set_current_drag_image.
  • External Drag-and-Drop Initiation: Start drag-and-drop operations with external applications using methods like perform_external_drag_drop_of_files or perform_external_drag_drop_of_text.

Note: When dealing with external drag-and-drops, consider platform-specific functionality and constraints.

License

This crate is open-source under the GPL-3.0 license.

Repository

For more details, visit the GitHub repository.


This README.md file was generated by an AI model and may not be 100% accurate however it should be pretty good.

This crate is a translation of the JUCE module.

JUCE is a c++ software framework for developing high performance audio applications.

Usage falls under the GPLv3 as well as the JUCE commercial license.

See github.com/juce-framework/JUCE and the JUCE license page for details.

This crate is in the process of being translated from c++ to rust. For progress updates, please see the workspacer rust project. designed specifically for rust projects.

Dependencies

~25–38MB
~594K SLoC