gtk4/auto/
tree_drag_dest.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 [`DropTarget`][crate::DropTarget] to implement a drop destination
12    /// Interface for Drag-and-Drop destinations in [`TreeView`][crate::TreeView].
13    ///
14    /// # Implements
15    ///
16    /// [`TreeDragDestExt`][trait@crate::prelude::TreeDragDestExt]
17    #[doc(alias = "GtkTreeDragDest")]
18    pub struct TreeDragDest(Interface<ffi::GtkTreeDragDest, ffi::GtkTreeDragDestIface>);
19
20    match fn {
21        type_ => || ffi::gtk_tree_drag_dest_get_type(),
22    }
23}
24
25impl TreeDragDest {
26    pub const NONE: Option<&'static TreeDragDest> = None;
27}
28
29mod sealed {
30    pub trait Sealed {}
31    impl<T: super::IsA<super::TreeDragDest>> Sealed for T {}
32}
33
34/// Trait containing all [`struct@TreeDragDest`] methods.
35///
36/// # Implementors
37///
38/// [`ListStore`][struct@crate::ListStore], [`TreeDragDest`][struct@crate::TreeDragDest], [`TreeStore`][struct@crate::TreeStore]
39pub trait TreeDragDestExt: IsA<TreeDragDest> + sealed::Sealed + 'static {
40    /// Asks the [`TreeDragDest`][crate::TreeDragDest] to insert a row before the path @dest,
41    /// deriving the contents of the row from @value. If @dest is
42    /// outside the tree so that inserting before it is impossible, [`false`]
43    /// will be returned. Also, [`false`] may be returned if the new row is
44    /// not created for some model-specific reason.  Should robustly handle
45    /// a @dest no longer found in the model!
46    ///
47    /// # Deprecated since 4.10
48    ///
49    /// Use list models instead
50    /// ## `dest`
51    /// row to drop in front of
52    /// ## `value`
53    /// data to drop
54    ///
55    /// # Returns
56    ///
57    /// whether a new row was created before position @dest
58    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
59    #[allow(deprecated)]
60    #[doc(alias = "gtk_tree_drag_dest_drag_data_received")]
61    fn drag_data_received(&self, dest: &TreePath, value: &glib::Value) -> bool {
62        unsafe {
63            from_glib(ffi::gtk_tree_drag_dest_drag_data_received(
64                self.as_ref().to_glib_none().0,
65                mut_override(dest.to_glib_none().0),
66                value.to_glib_none().0,
67            ))
68        }
69    }
70
71    /// Determines whether a drop is possible before the given @dest_path,
72    /// at the same depth as @dest_path. i.e., can we drop the data in
73    /// @value at that location. @dest_path does not have to
74    /// exist; the return value will almost certainly be [`false`] if the
75    /// parent of @dest_path doesn’t exist, though.
76    ///
77    /// # Deprecated since 4.10
78    ///
79    /// Use list models instead
80    /// ## `dest_path`
81    /// destination row
82    /// ## `value`
83    /// the data being dropped
84    ///
85    /// # Returns
86    ///
87    /// [`true`] if a drop is possible before @dest_path
88    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
89    #[allow(deprecated)]
90    #[doc(alias = "gtk_tree_drag_dest_row_drop_possible")]
91    fn row_drop_possible(&self, dest_path: &TreePath, value: &glib::Value) -> bool {
92        unsafe {
93            from_glib(ffi::gtk_tree_drag_dest_row_drop_possible(
94                self.as_ref().to_glib_none().0,
95                mut_override(dest_path.to_glib_none().0),
96                value.to_glib_none().0,
97            ))
98        }
99    }
100}
101
102impl<O: IsA<TreeDragDest>> TreeDragDestExt for O {}