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