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
29mod sealed {
30 pub trait Sealed {}
31 impl<T: super::IsA<super::TreeDragSource>> Sealed for T {}
32}
33
34/// Trait containing all [`struct@TreeDragSource`] methods.
35///
36/// # Implementors
37///
38/// [`ListStore`][struct@crate::ListStore], [`TreeDragSource`][struct@crate::TreeDragSource], [`TreeModelFilter`][struct@crate::TreeModelFilter], [`TreeModelSort`][struct@crate::TreeModelSort], [`TreeStore`][struct@crate::TreeStore]
39pub trait TreeDragSourceExt: IsA<TreeDragSource> + sealed::Sealed + 'static {
40 /// Asks the [`TreeDragSource`][crate::TreeDragSource] to delete the row at @path, because
41 /// it was moved somewhere else via drag-and-drop. Returns [`false`]
42 /// if the deletion fails because @path no longer exists, or for
43 /// some model-specific reason. Should robustly handle a @path no
44 /// longer found in the model!
45 ///
46 /// # Deprecated since 4.10
47 ///
48 /// Use list models instead
49 /// ## `path`
50 /// row that was being dragged
51 ///
52 /// # Returns
53 ///
54 /// [`true`] if the row was successfully deleted
55 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
56 #[allow(deprecated)]
57 #[doc(alias = "gtk_tree_drag_source_drag_data_delete")]
58 fn drag_data_delete(&self, path: &TreePath) -> bool {
59 unsafe {
60 from_glib(ffi::gtk_tree_drag_source_drag_data_delete(
61 self.as_ref().to_glib_none().0,
62 mut_override(path.to_glib_none().0),
63 ))
64 }
65 }
66
67 /// Asks the [`TreeDragSource`][crate::TreeDragSource] to return a [`gdk::ContentProvider`][crate::gdk::ContentProvider] representing
68 /// the row at @path. Should robustly handle a @path no
69 /// longer found in the model!
70 ///
71 /// # Deprecated since 4.10
72 ///
73 /// Use list models instead
74 /// ## `path`
75 /// row that was dragged
76 ///
77 /// # Returns
78 ///
79 /// a [`gdk::ContentProvider`][crate::gdk::ContentProvider] for the
80 /// given @path
81 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
82 #[allow(deprecated)]
83 #[doc(alias = "gtk_tree_drag_source_drag_data_get")]
84 fn drag_data_get(&self, path: &TreePath) -> Option<gdk::ContentProvider> {
85 unsafe {
86 from_glib_full(ffi::gtk_tree_drag_source_drag_data_get(
87 self.as_ref().to_glib_none().0,
88 mut_override(path.to_glib_none().0),
89 ))
90 }
91 }
92
93 /// Asks the [`TreeDragSource`][crate::TreeDragSource] whether a particular row can be used as
94 /// the source of a DND operation. If the source doesn’t implement
95 /// this interface, the row is assumed draggable.
96 ///
97 /// # Deprecated since 4.10
98 ///
99 /// Use list models instead
100 /// ## `path`
101 /// row on which user is initiating a drag
102 ///
103 /// # Returns
104 ///
105 /// [`true`] if the row can be dragged
106 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
107 #[allow(deprecated)]
108 #[doc(alias = "gtk_tree_drag_source_row_draggable")]
109 fn row_draggable(&self, path: &TreePath) -> bool {
110 unsafe {
111 from_glib(ffi::gtk_tree_drag_source_row_draggable(
112 self.as_ref().to_glib_none().0,
113 mut_override(path.to_glib_none().0),
114 ))
115 }
116 }
117}
118
119impl<O: IsA<TreeDragSource>> TreeDragSourceExt for O {}