gtk/auto/
cell_editable.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::{Buildable, Widget};
6use glib::{
7    prelude::*,
8    signal::{connect_raw, SignalHandlerId},
9    translate::*,
10};
11use std::{boxed::Box as Box_, fmt, mem::transmute};
12
13glib::wrapper! {
14    #[doc(alias = "GtkCellEditable")]
15    pub struct CellEditable(Interface<ffi::GtkCellEditable, ffi::GtkCellEditableIface>) @requires Widget, Buildable;
16
17    match fn {
18        type_ => || ffi::gtk_cell_editable_get_type(),
19    }
20}
21
22impl CellEditable {
23    pub const NONE: Option<&'static CellEditable> = None;
24}
25
26mod sealed {
27    pub trait Sealed {}
28    impl<T: super::IsA<super::CellEditable>> Sealed for T {}
29}
30
31pub trait CellEditableExt: IsA<CellEditable> + sealed::Sealed + 'static {
32    #[doc(alias = "gtk_cell_editable_editing_done")]
33    fn editing_done(&self) {
34        unsafe {
35            ffi::gtk_cell_editable_editing_done(self.as_ref().to_glib_none().0);
36        }
37    }
38
39    #[doc(alias = "gtk_cell_editable_remove_widget")]
40    fn remove_widget(&self) {
41        unsafe {
42            ffi::gtk_cell_editable_remove_widget(self.as_ref().to_glib_none().0);
43        }
44    }
45
46    #[doc(alias = "gtk_cell_editable_start_editing")]
47    fn start_editing(&self, event: Option<&gdk::Event>) {
48        unsafe {
49            ffi::gtk_cell_editable_start_editing(
50                self.as_ref().to_glib_none().0,
51                mut_override(event.to_glib_none().0),
52            );
53        }
54    }
55
56    #[doc(alias = "editing-canceled")]
57    fn is_editing_canceled(&self) -> bool {
58        ObjectExt::property(self.as_ref(), "editing-canceled")
59    }
60
61    #[doc(alias = "editing-canceled")]
62    fn set_editing_canceled(&self, editing_canceled: bool) {
63        ObjectExt::set_property(self.as_ref(), "editing-canceled", editing_canceled)
64    }
65
66    #[doc(alias = "editing-done")]
67    fn connect_editing_done<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
68        unsafe extern "C" fn editing_done_trampoline<P: IsA<CellEditable>, F: Fn(&P) + 'static>(
69            this: *mut ffi::GtkCellEditable,
70            f: glib::ffi::gpointer,
71        ) {
72            let f: &F = &*(f as *const F);
73            f(CellEditable::from_glib_borrow(this).unsafe_cast_ref())
74        }
75        unsafe {
76            let f: Box_<F> = Box_::new(f);
77            connect_raw(
78                self.as_ptr() as *mut _,
79                b"editing-done\0".as_ptr() as *const _,
80                Some(transmute::<_, unsafe extern "C" fn()>(
81                    editing_done_trampoline::<Self, F> as *const (),
82                )),
83                Box_::into_raw(f),
84            )
85        }
86    }
87
88    #[doc(alias = "remove-widget")]
89    fn connect_remove_widget<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
90        unsafe extern "C" fn remove_widget_trampoline<P: IsA<CellEditable>, F: Fn(&P) + 'static>(
91            this: *mut ffi::GtkCellEditable,
92            f: glib::ffi::gpointer,
93        ) {
94            let f: &F = &*(f as *const F);
95            f(CellEditable::from_glib_borrow(this).unsafe_cast_ref())
96        }
97        unsafe {
98            let f: Box_<F> = Box_::new(f);
99            connect_raw(
100                self.as_ptr() as *mut _,
101                b"remove-widget\0".as_ptr() as *const _,
102                Some(transmute::<_, unsafe extern "C" fn()>(
103                    remove_widget_trampoline::<Self, F> as *const (),
104                )),
105                Box_::into_raw(f),
106            )
107        }
108    }
109
110    #[doc(alias = "editing-canceled")]
111    fn connect_editing_canceled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
112        unsafe extern "C" fn notify_editing_canceled_trampoline<
113            P: IsA<CellEditable>,
114            F: Fn(&P) + 'static,
115        >(
116            this: *mut ffi::GtkCellEditable,
117            _param_spec: glib::ffi::gpointer,
118            f: glib::ffi::gpointer,
119        ) {
120            let f: &F = &*(f as *const F);
121            f(CellEditable::from_glib_borrow(this).unsafe_cast_ref())
122        }
123        unsafe {
124            let f: Box_<F> = Box_::new(f);
125            connect_raw(
126                self.as_ptr() as *mut _,
127                b"notify::editing-canceled\0".as_ptr() as *const _,
128                Some(transmute::<_, unsafe extern "C" fn()>(
129                    notify_editing_canceled_trampoline::<Self, F> as *const (),
130                )),
131                Box_::into_raw(f),
132            )
133        }
134    }
135}
136
137impl<O: IsA<CellEditable>> CellEditableExt for O {}
138
139impl fmt::Display for CellEditable {
140    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
141        f.write_str("CellEditable")
142    }
143}