gtk/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
5use crate::{SelectionData, TreePath, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 ///
10 ///
11 /// # Implements
12 ///
13 /// [`TreeDragDestExt`][trait@crate::prelude::TreeDragDestExt]
14 #[doc(alias = "GtkTreeDragDest")]
15 pub struct TreeDragDest(Interface<ffi::GtkTreeDragDest, ffi::GtkTreeDragDestIface>);
16
17 match fn {
18 type_ => || ffi::gtk_tree_drag_dest_get_type(),
19 }
20}
21
22impl TreeDragDest {
23 pub const NONE: Option<&'static TreeDragDest> = None;
24}
25
26/// Trait containing all [`struct@TreeDragDest`] methods.
27///
28/// # Implementors
29///
30/// [`ListStore`][struct@crate::ListStore], [`TreeDragDest`][struct@crate::TreeDragDest], [`TreeStore`][struct@crate::TreeStore]
31pub trait TreeDragDestExt: IsA<TreeDragDest> + 'static {
32 /// Asks the [`TreeDragDest`][crate::TreeDragDest] to insert a row before the path `dest`,
33 /// deriving the contents of the row from `selection_data`. If `dest` is
34 /// outside the tree so that inserting before it is impossible, [`false`]
35 /// will be returned. Also, [`false`] may be returned if the new row is
36 /// not created for some model-specific reason. Should robustly handle
37 /// a `dest` no longer found in the model!
38 /// ## `dest`
39 /// row to drop in front of
40 /// ## `selection_data`
41 /// data to drop
42 ///
43 /// # Returns
44 ///
45 /// whether a new row was created before position `dest`
46 #[doc(alias = "gtk_tree_drag_dest_drag_data_received")]
47 fn drag_data_received(&self, dest: &mut TreePath, selection_data: &mut SelectionData) -> bool {
48 unsafe {
49 from_glib(ffi::gtk_tree_drag_dest_drag_data_received(
50 self.as_ref().to_glib_none().0,
51 dest.to_glib_none_mut().0,
52 selection_data.to_glib_none_mut().0,
53 ))
54 }
55 }
56
57 /// Determines whether a drop is possible before the given `dest_path`,
58 /// at the same depth as `dest_path`. i.e., can we drop the data in
59 /// `selection_data` at that location. `dest_path` does not have to
60 /// exist; the return value will almost certainly be [`false`] if the
61 /// parent of `dest_path` doesn’t exist, though.
62 /// ## `dest_path`
63 /// destination row
64 /// ## `selection_data`
65 /// the data being dragged
66 ///
67 /// # Returns
68 ///
69 /// [`true`] if a drop is possible before `dest_path`
70 #[doc(alias = "gtk_tree_drag_dest_row_drop_possible")]
71 fn row_drop_possible(
72 &self,
73 dest_path: &mut TreePath,
74 selection_data: &mut SelectionData,
75 ) -> bool {
76 unsafe {
77 from_glib(ffi::gtk_tree_drag_dest_row_drop_possible(
78 self.as_ref().to_glib_none().0,
79 dest_path.to_glib_none_mut().0,
80 selection_data.to_glib_none_mut().0,
81 ))
82 }
83 }
84}
85
86impl<O: IsA<TreeDragDest>> TreeDragDestExt for O {}