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