gtk4/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#![allow(deprecated)]
5
6use crate::{ffi, TreePath};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// List views use widgets to display their contents.
11    ///   You can use [`DragSource`][crate::DragSource] to implement a drag source
12    /// Interface for Drag-and-Drop destinations in [`TreeView`][crate::TreeView].
13    ///
14    /// # Implements
15    ///
16    /// [`TreeDragSourceExt`][trait@crate::prelude::TreeDragSourceExt]
17    #[doc(alias = "GtkTreeDragSource")]
18    pub struct TreeDragSource(Interface<ffi::GtkTreeDragSource, ffi::GtkTreeDragSourceIface>);
19
20    match fn {
21        type_ => || ffi::gtk_tree_drag_source_get_type(),
22    }
23}
24
25impl TreeDragSource {
26    pub const NONE: Option<&'static TreeDragSource> = None;
27}
28
29/// Trait containing all [`struct@TreeDragSource`] methods.
30///
31/// # Implementors
32///
33/// [`ListStore`][struct@crate::ListStore], [`TreeDragSource`][struct@crate::TreeDragSource], [`TreeModelFilter`][struct@crate::TreeModelFilter], [`TreeModelSort`][struct@crate::TreeModelSort], [`TreeStore`][struct@crate::TreeStore]
34pub trait TreeDragSourceExt: IsA<TreeDragSource> + 'static {
35    /// Asks the [`TreeDragSource`][crate::TreeDragSource] to delete the row at @path, because
36    /// it was moved somewhere else via drag-and-drop. Returns [`false`]
37    /// if the deletion fails because @path no longer exists, or for
38    /// some model-specific reason. Should robustly handle a @path no
39    /// longer found in the model!
40    ///
41    /// # Deprecated since 4.10
42    ///
43    /// Use list models instead
44    /// ## `path`
45    /// row that was being dragged
46    ///
47    /// # Returns
48    ///
49    /// [`true`] if the row was successfully deleted
50    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
51    #[allow(deprecated)]
52    #[doc(alias = "gtk_tree_drag_source_drag_data_delete")]
53    fn drag_data_delete(&self, path: &TreePath) -> bool {
54        unsafe {
55            from_glib(ffi::gtk_tree_drag_source_drag_data_delete(
56                self.as_ref().to_glib_none().0,
57                mut_override(path.to_glib_none().0),
58            ))
59        }
60    }
61
62    /// Asks the [`TreeDragSource`][crate::TreeDragSource] to return a [`gdk::ContentProvider`][crate::gdk::ContentProvider] representing
63    /// the row at @path. Should robustly handle a @path no
64    /// longer found in the model!
65    ///
66    /// # Deprecated since 4.10
67    ///
68    /// Use list models instead
69    /// ## `path`
70    /// row that was dragged
71    ///
72    /// # Returns
73    ///
74    /// a [`gdk::ContentProvider`][crate::gdk::ContentProvider] for the
75    ///    given @path
76    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
77    #[allow(deprecated)]
78    #[doc(alias = "gtk_tree_drag_source_drag_data_get")]
79    fn drag_data_get(&self, path: &TreePath) -> Option<gdk::ContentProvider> {
80        unsafe {
81            from_glib_full(ffi::gtk_tree_drag_source_drag_data_get(
82                self.as_ref().to_glib_none().0,
83                mut_override(path.to_glib_none().0),
84            ))
85        }
86    }
87
88    /// Asks the [`TreeDragSource`][crate::TreeDragSource] whether a particular row can be used as
89    /// the source of a DND operation. If the source doesn’t implement
90    /// this interface, the row is assumed draggable.
91    ///
92    /// # Deprecated since 4.10
93    ///
94    /// Use list models instead
95    /// ## `path`
96    /// row on which user is initiating a drag
97    ///
98    /// # Returns
99    ///
100    /// [`true`] if the row can be dragged
101    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
102    #[allow(deprecated)]
103    #[doc(alias = "gtk_tree_drag_source_row_draggable")]
104    fn row_draggable(&self, path: &TreePath) -> bool {
105        unsafe {
106            from_glib(ffi::gtk_tree_drag_source_row_draggable(
107                self.as_ref().to_glib_none().0,
108                mut_override(path.to_glib_none().0),
109            ))
110        }
111    }
112}
113
114impl<O: IsA<TreeDragSource>> TreeDragSourceExt for O {}