#drag-and-drop #cairo #drawing #default #remove #place #cairo-rs

cairodrag

Unofficial drag-and-drop implementation for cairo-rs

4 releases

new 0.1.3 Dec 14, 2024
0.1.2 Dec 14, 2024
0.1.1 Dec 10, 2024
0.1.0 Dec 3, 2024

#215 in GUI

Download history 118/week @ 2024-11-28 146/week @ 2024-12-05 254/week @ 2024-12-12

518 downloads per month

BSD-3-Clause

25KB
491 lines

CairoDrag

An unofficial drag-and-drop implementation for cairo-rs and gtk4.

Drag-and-drop interfaces are useful in many places, and Rust's GTK 4 bindings have some support for them. However, there are some cases in which GTK's drag-and-drop is not sufficient, requiring the use of Cairo, its drawing library. Unfortunately, Cairo does not have drag-and-drop support by default. This crate adds this functionality. Read the documentation and the examples (found in the repository) to get started.

License: BSD 3-Clause

This basically means that you can do whatever you want as long as you give me attribution and you don't remove the license notices or use my name to endorse stuff I don't. Read the actual license for details though.

Changes

0.1.0

  • Initial release.

0.1.1

  • Change DragArea::push_(box|rc|rc_ref_cell) to &self instead of &mut self since they only rely on interior mutability internally.

0.1.2

  • Make DragArea optionally scrollable. Use DragArea::new_scrollable instead of new to construct a scrollable DragArea.
  • Add on_(double|middle|right)_click methods to Draggable for handling mouse clicks on specific draggable objects.
  • Add retain method to Draggable to allow for removal of objects from their DragArea.

0.1.3

  • Add set_(pre|post)_draw_func methods to DragArea that are run immediately before and after drawing and corresponding unset_(pre|post)_draw_func methods.

Dependencies

~16–23MB
~437K SLoC