gtk/auto/
tree_drag_source.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use glib::object::IsA;
6use glib::translate::*;
7use gtk_sys;
8use std::fmt;
9use SelectionData;
10use TreePath;
11
12glib_wrapper! {
13    pub struct TreeDragSource(Interface<gtk_sys::GtkTreeDragSource>);
14
15    match fn {
16        get_type => || gtk_sys::gtk_tree_drag_source_get_type(),
17    }
18}
19
20pub const NONE_TREE_DRAG_SOURCE: Option<&TreeDragSource> = None;
21
22pub trait TreeDragSourceExt: 'static {
23    fn drag_data_delete(&self, path: &mut TreePath) -> bool;
24
25    fn drag_data_get(&self, path: &mut TreePath, selection_data: &mut SelectionData) -> bool;
26
27    fn row_draggable(&self, path: &mut TreePath) -> bool;
28}
29
30impl<O: IsA<TreeDragSource>> TreeDragSourceExt for O {
31    fn drag_data_delete(&self, path: &mut TreePath) -> bool {
32        unsafe {
33            from_glib(gtk_sys::gtk_tree_drag_source_drag_data_delete(
34                self.as_ref().to_glib_none().0,
35                path.to_glib_none_mut().0,
36            ))
37        }
38    }
39
40    fn drag_data_get(&self, path: &mut TreePath, selection_data: &mut SelectionData) -> bool {
41        unsafe {
42            from_glib(gtk_sys::gtk_tree_drag_source_drag_data_get(
43                self.as_ref().to_glib_none().0,
44                path.to_glib_none_mut().0,
45                selection_data.to_glib_none_mut().0,
46            ))
47        }
48    }
49
50    fn row_draggable(&self, path: &mut TreePath) -> bool {
51        unsafe {
52            from_glib(gtk_sys::gtk_tree_drag_source_row_draggable(
53                self.as_ref().to_glib_none().0,
54                path.to_glib_none_mut().0,
55            ))
56        }
57    }
58}
59
60impl fmt::Display for TreeDragSource {
61    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
62        write!(f, "TreeDragSource")
63    }
64}