Skip to main content

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::{TreePath, ffi};
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    /// t implement
89    /// this interface, the row is assumed draggable.
90    ///
91    /// # Deprecated since 4.10
92    ///
93    /// Use list models instead
94    /// ## `path`
95    /// row on which user is initiating a drag
96    ///
97    /// # Returns
98    ///
99    /// [`true`] if the row can be dragged
100    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
101    #[allow(deprecated)]
102    #[doc(alias = "gtk_tree_drag_source_row_draggable")]
103    fn row_draggable(&self, path: &TreePath) -> bool {
104        unsafe {
105            from_glib(ffi::gtk_tree_drag_source_row_draggable(
106                self.as_ref().to_glib_none().0,
107                mut_override(path.to_glib_none().0),
108            ))
109        }
110    }
111}
112
113impl<O: IsA<TreeDragSource>> TreeDragSourceExt for O {}