Skip to main content

gtk/auto/
cell_renderer.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::{
6    CellEditable, CellRendererMode, CellRendererState, Requisition, SizeRequestMode, StateFlags,
7    TreePath, Widget, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// The [`CellRenderer`][crate::CellRenderer] is a base class of a set of objects used for
19    /// rendering a cell to a [`cairo::Context`][crate::cairo::Context]. These objects are used primarily by
20    /// the [`TreeView`][crate::TreeView] widget, though they aren’t tied to them in any
21    /// specific way. It is worth noting that [`CellRenderer`][crate::CellRenderer] is not a
22    /// [`Widget`][crate::Widget] and cannot be treated as such.
23    ///
24    /// The primary use of a [`CellRenderer`][crate::CellRenderer] is for drawing a certain graphical
25    /// elements on a [`cairo::Context`][crate::cairo::Context]. Typically, one cell renderer is used to
26    /// draw many cells on the screen. To this extent, it isn’t expected that a
27    /// CellRenderer keep any permanent state around. Instead, any state is set
28    /// just prior to use using `GObjects` property system. Then, the
29    /// cell is measured using `gtk_cell_renderer_get_size()`. Finally, the cell
30    /// is rendered in the correct location using [`CellRendererExt::render()`][crate::prelude::CellRendererExt::render()].
31    ///
32    /// There are a number of rules that must be followed when writing a new
33    /// [`CellRenderer`][crate::CellRenderer]. First and foremost, it’s important that a certain set
34    /// of properties will always yield a cell renderer of the same size,
35    /// barring a `GtkStyle` change. The [`CellRenderer`][crate::CellRenderer] also has a number of
36    /// generic properties that are expected to be honored by all children.
37    ///
38    /// Beyond merely rendering a cell, cell renderers can optionally
39    /// provide active user interface elements. A cell renderer can be
40    /// “activatable” like [`CellRendererToggle`][crate::CellRendererToggle],
41    /// which toggles when it gets activated by a mouse click, or it can be
42    /// “editable” like [`CellRendererText`][crate::CellRendererText], which
43    /// allows the user to edit the text using a widget implementing the
44    /// [`CellEditable`][crate::CellEditable] interface, e.g. [`Entry`][crate::Entry].
45    /// To make a cell renderer activatable or editable, you have to
46    /// implement the `GtkCellRendererClass.activate` or
47    /// `GtkCellRendererClass.start_editing` virtual functions, respectively.
48    ///
49    /// Many properties of [`CellRenderer`][crate::CellRenderer] and its subclasses have a
50    /// corresponding “set” property, e.g. “cell-background-set” corresponds
51    /// to “cell-background”. These “set” properties reflect whether a property
52    /// has been set or not. You should not set them independently.
53    ///
54    /// This is an Abstract Base Class, you cannot instantiate it.
55    ///
56    /// ## Properties
57    ///
58    ///
59    /// #### `cell-background`
60    ///  Writable
61    ///
62    ///
63    /// #### `cell-background-gdk`
64    ///  Cell background as a `GdkColor`
65    ///
66    /// Readable | Writable
67    ///
68    ///
69    /// #### `cell-background-rgba`
70    ///  Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
71    ///
72    /// Readable | Writable
73    ///
74    ///
75    /// #### `cell-background-set`
76    ///  Readable | Writable
77    ///
78    ///
79    /// #### `editing`
80    ///  Readable
81    ///
82    ///
83    /// #### `height`
84    ///  Readable | Writable
85    ///
86    ///
87    /// #### `is-expanded`
88    ///  Readable | Writable
89    ///
90    ///
91    /// #### `is-expander`
92    ///  Readable | Writable
93    ///
94    ///
95    /// #### `mode`
96    ///  Readable | Writable
97    ///
98    ///
99    /// #### `sensitive`
100    ///  Readable | Writable
101    ///
102    ///
103    /// #### `visible`
104    ///  Readable | Writable
105    ///
106    ///
107    /// #### `width`
108    ///  Readable | Writable
109    ///
110    ///
111    /// #### `xalign`
112    ///  Readable | Writable
113    ///
114    ///
115    /// #### `xpad`
116    ///  Readable | Writable
117    ///
118    ///
119    /// #### `yalign`
120    ///  Readable | Writable
121    ///
122    ///
123    /// #### `ypad`
124    ///  Readable | Writable
125    ///
126    /// ## Signals
127    ///
128    ///
129    /// #### `editing-canceled`
130    ///  This signal gets emitted when the user cancels the process of editing a
131    /// cell. For example, an editable cell renderer could be written to cancel
132    /// editing when the user presses Escape.
133    ///
134    /// See also: [`CellRendererExt::stop_editing()`][crate::prelude::CellRendererExt::stop_editing()].
135    ///
136    ///
137    ///
138    ///
139    /// #### `editing-started`
140    ///
141    /// static void
142    /// text_editing_started (GtkCellRenderer *cell,
143    ///  GtkCellEditable *editable,
144    ///  const gchar *path,
145    ///  gpointer data)
146    /// {
147    ///  if (GTK_IS_ENTRY (editable))
148    ///  {
149    ///  GtkEntry *entry = GTK_ENTRY (editable);
150    ///
151    ///  // ... create a GtkEntryCompletion
152    ///
153    ///  gtk_entry_set_completion (entry, completion);
154    ///  }
155    /// }
156    /// ]|
157    ///
158    ///
159    ///
160    /// # Implements
161    ///
162    /// [`CellRendererExt`][trait@crate::prelude::CellRendererExt], [`trait@glib::ObjectExt`]
163    #[doc(alias = "GtkCellRenderer")]
164    pub struct CellRenderer(Object<ffi::GtkCellRenderer, ffi::GtkCellRendererClass>);
165
166    match fn {
167        type_ => || ffi::gtk_cell_renderer_get_type(),
168    }
169}
170
171impl CellRenderer {
172    pub const NONE: Option<&'static CellRenderer> = None;
173}
174
175/// Trait containing all [`struct@CellRenderer`] methods.
176///
177/// # Implementors
178///
179/// [`CellRendererPixbuf`][struct@crate::CellRendererPixbuf], [`CellRendererProgress`][struct@crate::CellRendererProgress], [`CellRendererSpinner`][struct@crate::CellRendererSpinner], [`CellRendererText`][struct@crate::CellRendererText], [`CellRendererToggle`][struct@crate::CellRendererToggle], [`CellRenderer`][struct@crate::CellRenderer]
180pub trait CellRendererExt: IsA<CellRenderer> + 'static {
181    /// Passes an activate event to the cell renderer for possible processing.
182    /// Some cell renderers may use events; for example, [`CellRendererToggle`][crate::CellRendererToggle]
183    /// toggles when it gets a mouse click.
184    /// ## `event`
185    /// a `GdkEvent`
186    /// ## `widget`
187    /// widget that received the event
188    /// ## `path`
189    /// widget-dependent string representation of the event location;
190    ///  e.g. for [`TreeView`][crate::TreeView], a string representation of [`TreePath`][crate::TreePath]
191    /// ## `background_area`
192    /// background area as passed to [`render()`][Self::render()]
193    /// ## `cell_area`
194    /// cell area as passed to [`render()`][Self::render()]
195    /// ## `flags`
196    /// render flags
197    ///
198    /// # Returns
199    ///
200    /// [`true`] if the event was consumed/handled
201    #[doc(alias = "gtk_cell_renderer_activate")]
202    fn activate(
203        &self,
204        event: &gdk::Event,
205        widget: &impl IsA<Widget>,
206        path: &str,
207        background_area: &gdk::Rectangle,
208        cell_area: &gdk::Rectangle,
209        flags: CellRendererState,
210    ) -> bool {
211        unsafe {
212            from_glib(ffi::gtk_cell_renderer_activate(
213                self.as_ref().to_glib_none().0,
214                mut_override(event.to_glib_none().0),
215                widget.as_ref().to_glib_none().0,
216                path.to_glib_none().0,
217                background_area.to_glib_none().0,
218                cell_area.to_glib_none().0,
219                flags.into_glib(),
220            ))
221        }
222    }
223
224    /// Gets the aligned area used by `self` inside `cell_area`. Used for finding
225    /// the appropriate edit and focus rectangle.
226    /// ## `widget`
227    /// the [`Widget`][crate::Widget] this cell will be rendering to
228    /// ## `flags`
229    /// render flags
230    /// ## `cell_area`
231    /// cell area which would be passed to [`render()`][Self::render()]
232    ///
233    /// # Returns
234    ///
235    ///
236    /// ## `aligned_area`
237    /// the return location for the space inside `cell_area`
238    ///  that would acually be used to render.
239    #[doc(alias = "gtk_cell_renderer_get_aligned_area")]
240    #[doc(alias = "get_aligned_area")]
241    fn aligned_area(
242        &self,
243        widget: &impl IsA<Widget>,
244        flags: CellRendererState,
245        cell_area: &gdk::Rectangle,
246    ) -> gdk::Rectangle {
247        unsafe {
248            let mut aligned_area = gdk::Rectangle::uninitialized();
249            ffi::gtk_cell_renderer_get_aligned_area(
250                self.as_ref().to_glib_none().0,
251                widget.as_ref().to_glib_none().0,
252                flags.into_glib(),
253                cell_area.to_glib_none().0,
254                aligned_area.to_glib_none_mut().0,
255            );
256            aligned_area
257        }
258    }
259
260    /// Fills in `xalign` and `yalign` with the appropriate values of `self`.
261    ///
262    /// # Returns
263    ///
264    ///
265    /// ## `xalign`
266    /// location to fill in with the x alignment of the cell, or [`None`]
267    ///
268    /// ## `yalign`
269    /// location to fill in with the y alignment of the cell, or [`None`]
270    #[doc(alias = "gtk_cell_renderer_get_alignment")]
271    #[doc(alias = "get_alignment")]
272    fn alignment(&self) -> (f32, f32) {
273        unsafe {
274            let mut xalign = std::mem::MaybeUninit::uninit();
275            let mut yalign = std::mem::MaybeUninit::uninit();
276            ffi::gtk_cell_renderer_get_alignment(
277                self.as_ref().to_glib_none().0,
278                xalign.as_mut_ptr(),
279                yalign.as_mut_ptr(),
280            );
281            (xalign.assume_init(), yalign.assume_init())
282        }
283    }
284
285    /// Fills in `width` and `height` with the appropriate size of `self`.
286    ///
287    /// # Returns
288    ///
289    ///
290    /// ## `width`
291    /// location to fill in with the fixed width of the cell, or [`None`]
292    ///
293    /// ## `height`
294    /// location to fill in with the fixed height of the cell, or [`None`]
295    #[doc(alias = "gtk_cell_renderer_get_fixed_size")]
296    #[doc(alias = "get_fixed_size")]
297    fn fixed_size(&self) -> (i32, i32) {
298        unsafe {
299            let mut width = std::mem::MaybeUninit::uninit();
300            let mut height = std::mem::MaybeUninit::uninit();
301            ffi::gtk_cell_renderer_get_fixed_size(
302                self.as_ref().to_glib_none().0,
303                width.as_mut_ptr(),
304                height.as_mut_ptr(),
305            );
306            (width.assume_init(), height.assume_init())
307        }
308    }
309
310    /// Fills in `xpad` and `ypad` with the appropriate values of `self`.
311    ///
312    /// # Returns
313    ///
314    ///
315    /// ## `xpad`
316    /// location to fill in with the x padding of the cell, or [`None`]
317    ///
318    /// ## `ypad`
319    /// location to fill in with the y padding of the cell, or [`None`]
320    #[doc(alias = "gtk_cell_renderer_get_padding")]
321    #[doc(alias = "get_padding")]
322    fn padding(&self) -> (i32, i32) {
323        unsafe {
324            let mut xpad = std::mem::MaybeUninit::uninit();
325            let mut ypad = std::mem::MaybeUninit::uninit();
326            ffi::gtk_cell_renderer_get_padding(
327                self.as_ref().to_glib_none().0,
328                xpad.as_mut_ptr(),
329                ypad.as_mut_ptr(),
330            );
331            (xpad.assume_init(), ypad.assume_init())
332        }
333    }
334
335    /// Retreives a renderer’s natural size when rendered to `widget`.
336    /// ## `widget`
337    /// the [`Widget`][crate::Widget] this cell will be rendering to
338    ///
339    /// # Returns
340    ///
341    ///
342    /// ## `minimum_size`
343    /// location to store the minimum size, or [`None`]
344    ///
345    /// ## `natural_size`
346    /// location to store the natural size, or [`None`]
347    #[doc(alias = "gtk_cell_renderer_get_preferred_height")]
348    #[doc(alias = "get_preferred_height")]
349    fn preferred_height(&self, widget: &impl IsA<Widget>) -> (i32, i32) {
350        unsafe {
351            let mut minimum_size = std::mem::MaybeUninit::uninit();
352            let mut natural_size = std::mem::MaybeUninit::uninit();
353            ffi::gtk_cell_renderer_get_preferred_height(
354                self.as_ref().to_glib_none().0,
355                widget.as_ref().to_glib_none().0,
356                minimum_size.as_mut_ptr(),
357                natural_size.as_mut_ptr(),
358            );
359            (minimum_size.assume_init(), natural_size.assume_init())
360        }
361    }
362
363    /// Retreives a cell renderers’s minimum and natural height if it were rendered to
364    /// `widget` with the specified `width`.
365    /// ## `widget`
366    /// the [`Widget`][crate::Widget] this cell will be rendering to
367    /// ## `width`
368    /// the size which is available for allocation
369    ///
370    /// # Returns
371    ///
372    ///
373    /// ## `minimum_height`
374    /// location for storing the minimum size, or [`None`]
375    ///
376    /// ## `natural_height`
377    /// location for storing the preferred size, or [`None`]
378    #[doc(alias = "gtk_cell_renderer_get_preferred_height_for_width")]
379    #[doc(alias = "get_preferred_height_for_width")]
380    fn preferred_height_for_width(&self, widget: &impl IsA<Widget>, width: i32) -> (i32, i32) {
381        unsafe {
382            let mut minimum_height = std::mem::MaybeUninit::uninit();
383            let mut natural_height = std::mem::MaybeUninit::uninit();
384            ffi::gtk_cell_renderer_get_preferred_height_for_width(
385                self.as_ref().to_glib_none().0,
386                widget.as_ref().to_glib_none().0,
387                width,
388                minimum_height.as_mut_ptr(),
389                natural_height.as_mut_ptr(),
390            );
391            (minimum_height.assume_init(), natural_height.assume_init())
392        }
393    }
394
395    /// Retrieves the minimum and natural size of a cell taking
396    /// into account the widget’s preference for height-for-width management.
397    /// ## `widget`
398    /// the [`Widget`][crate::Widget] this cell will be rendering to
399    ///
400    /// # Returns
401    ///
402    ///
403    /// ## `minimum_size`
404    /// location for storing the minimum size, or [`None`]
405    ///
406    /// ## `natural_size`
407    /// location for storing the natural size, or [`None`]
408    #[doc(alias = "gtk_cell_renderer_get_preferred_size")]
409    #[doc(alias = "get_preferred_size")]
410    fn preferred_size(&self, widget: &impl IsA<Widget>) -> (Requisition, Requisition) {
411        unsafe {
412            let mut minimum_size = Requisition::uninitialized();
413            let mut natural_size = Requisition::uninitialized();
414            ffi::gtk_cell_renderer_get_preferred_size(
415                self.as_ref().to_glib_none().0,
416                widget.as_ref().to_glib_none().0,
417                minimum_size.to_glib_none_mut().0,
418                natural_size.to_glib_none_mut().0,
419            );
420            (minimum_size, natural_size)
421        }
422    }
423
424    /// Retreives a renderer’s natural size when rendered to `widget`.
425    /// ## `widget`
426    /// the [`Widget`][crate::Widget] this cell will be rendering to
427    ///
428    /// # Returns
429    ///
430    ///
431    /// ## `minimum_size`
432    /// location to store the minimum size, or [`None`]
433    ///
434    /// ## `natural_size`
435    /// location to store the natural size, or [`None`]
436    #[doc(alias = "gtk_cell_renderer_get_preferred_width")]
437    #[doc(alias = "get_preferred_width")]
438    fn preferred_width(&self, widget: &impl IsA<Widget>) -> (i32, i32) {
439        unsafe {
440            let mut minimum_size = std::mem::MaybeUninit::uninit();
441            let mut natural_size = std::mem::MaybeUninit::uninit();
442            ffi::gtk_cell_renderer_get_preferred_width(
443                self.as_ref().to_glib_none().0,
444                widget.as_ref().to_glib_none().0,
445                minimum_size.as_mut_ptr(),
446                natural_size.as_mut_ptr(),
447            );
448            (minimum_size.assume_init(), natural_size.assume_init())
449        }
450    }
451
452    /// Retreives a cell renderers’s minimum and natural width if it were rendered to
453    /// `widget` with the specified `height`.
454    /// ## `widget`
455    /// the [`Widget`][crate::Widget] this cell will be rendering to
456    /// ## `height`
457    /// the size which is available for allocation
458    ///
459    /// # Returns
460    ///
461    ///
462    /// ## `minimum_width`
463    /// location for storing the minimum size, or [`None`]
464    ///
465    /// ## `natural_width`
466    /// location for storing the preferred size, or [`None`]
467    #[doc(alias = "gtk_cell_renderer_get_preferred_width_for_height")]
468    #[doc(alias = "get_preferred_width_for_height")]
469    fn preferred_width_for_height(&self, widget: &impl IsA<Widget>, height: i32) -> (i32, i32) {
470        unsafe {
471            let mut minimum_width = std::mem::MaybeUninit::uninit();
472            let mut natural_width = std::mem::MaybeUninit::uninit();
473            ffi::gtk_cell_renderer_get_preferred_width_for_height(
474                self.as_ref().to_glib_none().0,
475                widget.as_ref().to_glib_none().0,
476                height,
477                minimum_width.as_mut_ptr(),
478                natural_width.as_mut_ptr(),
479            );
480            (minimum_width.assume_init(), natural_width.assume_init())
481        }
482    }
483
484    /// Gets whether the cell renderer prefers a height-for-width layout
485    /// or a width-for-height layout.
486    ///
487    /// # Returns
488    ///
489    /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by this renderer.
490    #[doc(alias = "gtk_cell_renderer_get_request_mode")]
491    #[doc(alias = "get_request_mode")]
492    fn request_mode(&self) -> SizeRequestMode {
493        unsafe {
494            from_glib(ffi::gtk_cell_renderer_get_request_mode(
495                self.as_ref().to_glib_none().0,
496            ))
497        }
498    }
499
500    /// Returns the cell renderer’s sensitivity.
501    ///
502    /// # Returns
503    ///
504    /// [`true`] if the cell renderer is sensitive
505    #[doc(alias = "gtk_cell_renderer_get_sensitive")]
506    #[doc(alias = "get_sensitive")]
507    #[doc(alias = "sensitive")]
508    fn is_sensitive(&self) -> bool {
509        unsafe {
510            from_glib(ffi::gtk_cell_renderer_get_sensitive(
511                self.as_ref().to_glib_none().0,
512            ))
513        }
514    }
515
516    /// Translates the cell renderer state to [`StateFlags`][crate::StateFlags],
517    /// based on the cell renderer and widget sensitivity, and
518    /// the given [`CellRendererState`][crate::CellRendererState].
519    /// ## `widget`
520    /// a [`Widget`][crate::Widget], or [`None`]
521    /// ## `cell_state`
522    /// cell renderer state
523    ///
524    /// # Returns
525    ///
526    /// the widget state flags applying to `self`
527    #[doc(alias = "gtk_cell_renderer_get_state")]
528    #[doc(alias = "get_state")]
529    fn state(
530        &self,
531        widget: Option<&impl IsA<Widget>>,
532        cell_state: CellRendererState,
533    ) -> StateFlags {
534        unsafe {
535            from_glib(ffi::gtk_cell_renderer_get_state(
536                self.as_ref().to_glib_none().0,
537                widget.map(|p| p.as_ref()).to_glib_none().0,
538                cell_state.into_glib(),
539            ))
540        }
541    }
542
543    /// Returns the cell renderer’s visibility.
544    ///
545    /// # Returns
546    ///
547    /// [`true`] if the cell renderer is visible
548    #[doc(alias = "gtk_cell_renderer_get_visible")]
549    #[doc(alias = "get_visible")]
550    #[doc(alias = "visible")]
551    fn is_visible(&self) -> bool {
552        unsafe {
553            from_glib(ffi::gtk_cell_renderer_get_visible(
554                self.as_ref().to_glib_none().0,
555            ))
556        }
557    }
558
559    /// Checks whether the cell renderer can do something when activated.
560    ///
561    /// # Returns
562    ///
563    /// [`true`] if the cell renderer can do anything when activated
564    #[doc(alias = "gtk_cell_renderer_is_activatable")]
565    fn is_activatable(&self) -> bool {
566        unsafe {
567            from_glib(ffi::gtk_cell_renderer_is_activatable(
568                self.as_ref().to_glib_none().0,
569            ))
570        }
571    }
572
573    /// Invokes the virtual render function of the [`CellRenderer`][crate::CellRenderer]. The three
574    /// passed-in rectangles are areas in `cr`. Most renderers will draw within
575    /// `cell_area`; the xalign, yalign, xpad, and ypad fields of the [`CellRenderer`][crate::CellRenderer]
576    /// should be honored with respect to `cell_area`. `background_area` includes the
577    /// blank space around the cell, and also the area containing the tree expander;
578    /// so the `background_area` rectangles for all cells tile to cover the entire
579    /// `window`.
580    /// ## `cr`
581    /// a cairo context to draw to
582    /// ## `widget`
583    /// the widget owning `window`
584    /// ## `background_area`
585    /// entire cell area (including tree expanders and maybe
586    ///  padding on the sides)
587    /// ## `cell_area`
588    /// area normally rendered by a cell renderer
589    /// ## `flags`
590    /// flags that affect rendering
591    #[doc(alias = "gtk_cell_renderer_render")]
592    fn render(
593        &self,
594        cr: &cairo::Context,
595        widget: &impl IsA<Widget>,
596        background_area: &gdk::Rectangle,
597        cell_area: &gdk::Rectangle,
598        flags: CellRendererState,
599    ) {
600        unsafe {
601            ffi::gtk_cell_renderer_render(
602                self.as_ref().to_glib_none().0,
603                mut_override(cr.to_glib_none().0),
604                widget.as_ref().to_glib_none().0,
605                background_area.to_glib_none().0,
606                cell_area.to_glib_none().0,
607                flags.into_glib(),
608            );
609        }
610    }
611
612    /// Sets the renderer’s alignment within its available space.
613    /// ## `xalign`
614    /// the x alignment of the cell renderer
615    /// ## `yalign`
616    /// the y alignment of the cell renderer
617    #[doc(alias = "gtk_cell_renderer_set_alignment")]
618    fn set_alignment(&self, xalign: f32, yalign: f32) {
619        unsafe {
620            ffi::gtk_cell_renderer_set_alignment(self.as_ref().to_glib_none().0, xalign, yalign);
621        }
622    }
623
624    /// Sets the renderer size to be explicit, independent of the properties set.
625    /// ## `width`
626    /// the width of the cell renderer, or -1
627    /// ## `height`
628    /// the height of the cell renderer, or -1
629    #[doc(alias = "gtk_cell_renderer_set_fixed_size")]
630    fn set_fixed_size(&self, width: i32, height: i32) {
631        unsafe {
632            ffi::gtk_cell_renderer_set_fixed_size(self.as_ref().to_glib_none().0, width, height);
633        }
634    }
635
636    /// Sets the renderer’s padding.
637    /// ## `xpad`
638    /// the x padding of the cell renderer
639    /// ## `ypad`
640    /// the y padding of the cell renderer
641    #[doc(alias = "gtk_cell_renderer_set_padding")]
642    fn set_padding(&self, xpad: i32, ypad: i32) {
643        unsafe {
644            ffi::gtk_cell_renderer_set_padding(self.as_ref().to_glib_none().0, xpad, ypad);
645        }
646    }
647
648    /// Sets the cell renderer’s sensitivity.
649    /// ## `sensitive`
650    /// the sensitivity of the cell
651    #[doc(alias = "gtk_cell_renderer_set_sensitive")]
652    #[doc(alias = "sensitive")]
653    fn set_sensitive(&self, sensitive: bool) {
654        unsafe {
655            ffi::gtk_cell_renderer_set_sensitive(
656                self.as_ref().to_glib_none().0,
657                sensitive.into_glib(),
658            );
659        }
660    }
661
662    /// Sets the cell renderer’s visibility.
663    /// ## `visible`
664    /// the visibility of the cell
665    #[doc(alias = "gtk_cell_renderer_set_visible")]
666    #[doc(alias = "visible")]
667    fn set_visible(&self, visible: bool) {
668        unsafe {
669            ffi::gtk_cell_renderer_set_visible(self.as_ref().to_glib_none().0, visible.into_glib());
670        }
671    }
672
673    /// Starts editing the contents of this `self`, through a new [`CellEditable`][crate::CellEditable]
674    /// widget created by the `GtkCellRendererClass.start_editing` virtual function.
675    /// ## `event`
676    /// a `GdkEvent`
677    /// ## `widget`
678    /// widget that received the event
679    /// ## `path`
680    /// widget-dependent string representation of the event location;
681    ///  e.g. for [`TreeView`][crate::TreeView], a string representation of [`TreePath`][crate::TreePath]
682    /// ## `background_area`
683    /// background area as passed to [`render()`][Self::render()]
684    /// ## `cell_area`
685    /// cell area as passed to [`render()`][Self::render()]
686    /// ## `flags`
687    /// render flags
688    ///
689    /// # Returns
690    ///
691    /// A new [`CellEditable`][crate::CellEditable] for editing this
692    ///  `self`, or [`None`] if editing is not possible
693    #[doc(alias = "gtk_cell_renderer_start_editing")]
694    fn start_editing(
695        &self,
696        event: Option<&gdk::Event>,
697        widget: &impl IsA<Widget>,
698        path: &str,
699        background_area: &gdk::Rectangle,
700        cell_area: &gdk::Rectangle,
701        flags: CellRendererState,
702    ) -> Option<CellEditable> {
703        unsafe {
704            from_glib_none(ffi::gtk_cell_renderer_start_editing(
705                self.as_ref().to_glib_none().0,
706                mut_override(event.to_glib_none().0),
707                widget.as_ref().to_glib_none().0,
708                path.to_glib_none().0,
709                background_area.to_glib_none().0,
710                cell_area.to_glib_none().0,
711                flags.into_glib(),
712            ))
713        }
714    }
715
716    /// Informs the cell renderer that the editing is stopped.
717    /// If `canceled` is [`true`], the cell renderer will emit the
718    /// [`editing-canceled`][struct@crate::CellRenderer#editing-canceled] signal.
719    ///
720    /// This function should be called by cell renderer implementations
721    /// in response to the [`editing-done`][struct@crate::CellEditable#editing-done] signal of
722    /// [`CellEditable`][crate::CellEditable].
723    /// ## `canceled`
724    /// [`true`] if the editing has been canceled
725    #[doc(alias = "gtk_cell_renderer_stop_editing")]
726    fn stop_editing(&self, canceled: bool) {
727        unsafe {
728            ffi::gtk_cell_renderer_stop_editing(
729                self.as_ref().to_glib_none().0,
730                canceled.into_glib(),
731            );
732        }
733    }
734
735    #[doc(alias = "cell-background")]
736    fn set_cell_background(&self, cell_background: Option<&str>) {
737        ObjectExt::set_property(self.as_ref(), "cell-background", cell_background)
738    }
739
740    /// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
741    #[doc(alias = "cell-background-rgba")]
742    fn cell_background_rgba(&self) -> Option<gdk::RGBA> {
743        ObjectExt::property(self.as_ref(), "cell-background-rgba")
744    }
745
746    /// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
747    #[doc(alias = "cell-background-rgba")]
748    fn set_cell_background_rgba(&self, cell_background_rgba: Option<&gdk::RGBA>) {
749        ObjectExt::set_property(self.as_ref(), "cell-background-rgba", cell_background_rgba)
750    }
751
752    #[doc(alias = "cell-background-set")]
753    fn is_cell_background_set(&self) -> bool {
754        ObjectExt::property(self.as_ref(), "cell-background-set")
755    }
756
757    #[doc(alias = "cell-background-set")]
758    fn set_cell_background_set(&self, cell_background_set: bool) {
759        ObjectExt::set_property(self.as_ref(), "cell-background-set", cell_background_set)
760    }
761
762    fn is_editing(&self) -> bool {
763        ObjectExt::property(self.as_ref(), "editing")
764    }
765
766    fn height(&self) -> i32 {
767        ObjectExt::property(self.as_ref(), "height")
768    }
769
770    fn set_height(&self, height: i32) {
771        ObjectExt::set_property(self.as_ref(), "height", height)
772    }
773
774    #[doc(alias = "is-expanded")]
775    fn is_expanded(&self) -> bool {
776        ObjectExt::property(self.as_ref(), "is-expanded")
777    }
778
779    #[doc(alias = "is-expanded")]
780    fn set_is_expanded(&self, is_expanded: bool) {
781        ObjectExt::set_property(self.as_ref(), "is-expanded", is_expanded)
782    }
783
784    #[doc(alias = "is-expander")]
785    fn is_expander(&self) -> bool {
786        ObjectExt::property(self.as_ref(), "is-expander")
787    }
788
789    #[doc(alias = "is-expander")]
790    fn set_is_expander(&self, is_expander: bool) {
791        ObjectExt::set_property(self.as_ref(), "is-expander", is_expander)
792    }
793
794    fn mode(&self) -> CellRendererMode {
795        ObjectExt::property(self.as_ref(), "mode")
796    }
797
798    fn set_mode(&self, mode: CellRendererMode) {
799        ObjectExt::set_property(self.as_ref(), "mode", mode)
800    }
801
802    fn width(&self) -> i32 {
803        ObjectExt::property(self.as_ref(), "width")
804    }
805
806    fn set_width(&self, width: i32) {
807        ObjectExt::set_property(self.as_ref(), "width", width)
808    }
809
810    fn xalign(&self) -> f32 {
811        ObjectExt::property(self.as_ref(), "xalign")
812    }
813
814    fn set_xalign(&self, xalign: f32) {
815        ObjectExt::set_property(self.as_ref(), "xalign", xalign)
816    }
817
818    fn xpad(&self) -> u32 {
819        ObjectExt::property(self.as_ref(), "xpad")
820    }
821
822    fn set_xpad(&self, xpad: u32) {
823        ObjectExt::set_property(self.as_ref(), "xpad", xpad)
824    }
825
826    fn yalign(&self) -> f32 {
827        ObjectExt::property(self.as_ref(), "yalign")
828    }
829
830    fn set_yalign(&self, yalign: f32) {
831        ObjectExt::set_property(self.as_ref(), "yalign", yalign)
832    }
833
834    fn ypad(&self) -> u32 {
835        ObjectExt::property(self.as_ref(), "ypad")
836    }
837
838    fn set_ypad(&self, ypad: u32) {
839        ObjectExt::set_property(self.as_ref(), "ypad", ypad)
840    }
841
842    /// This signal gets emitted when the user cancels the process of editing a
843    /// cell. For example, an editable cell renderer could be written to cancel
844    /// editing when the user presses Escape.
845    ///
846    /// See also: [`stop_editing()`][Self::stop_editing()].
847    #[doc(alias = "editing-canceled")]
848    fn connect_editing_canceled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
849        unsafe extern "C" fn editing_canceled_trampoline<
850            P: IsA<CellRenderer>,
851            F: Fn(&P) + 'static,
852        >(
853            this: *mut ffi::GtkCellRenderer,
854            f: glib::ffi::gpointer,
855        ) {
856            unsafe {
857                let f: &F = &*(f as *const F);
858                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
859            }
860        }
861        unsafe {
862            let f: Box_<F> = Box_::new(f);
863            connect_raw(
864                self.as_ptr() as *mut _,
865                c"editing-canceled".as_ptr(),
866                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
867                    editing_canceled_trampoline::<Self, F> as *const (),
868                )),
869                Box_::into_raw(f),
870            )
871        }
872    }
873
874    ///
875    /// static void
876    /// text_editing_started (GtkCellRenderer *cell,
877    ///  GtkCellEditable *editable,
878    ///  const gchar *path,
879    ///  gpointer data)
880    /// {
881    ///  if (GTK_IS_ENTRY (editable))
882    ///  {
883    ///  GtkEntry *entry = GTK_ENTRY (editable);
884    ///
885    ///  // ... create a GtkEntryCompletion
886    ///
887    ///  gtk_entry_set_completion (entry, completion);
888    ///  }
889    /// }
890    /// ]|
891    /// ## `editable`
892    /// the [`CellEditable`][crate::CellEditable]
893    /// ## `path`
894    /// the path identifying the edited cell
895    #[doc(alias = "editing-started")]
896    fn connect_editing_started<F: Fn(&Self, &CellEditable, TreePath) + 'static>(
897        &self,
898        f: F,
899    ) -> SignalHandlerId {
900        unsafe extern "C" fn editing_started_trampoline<
901            P: IsA<CellRenderer>,
902            F: Fn(&P, &CellEditable, TreePath) + 'static,
903        >(
904            this: *mut ffi::GtkCellRenderer,
905            editable: *mut ffi::GtkCellEditable,
906            path: *mut std::ffi::c_char,
907            f: glib::ffi::gpointer,
908        ) {
909            unsafe {
910                let f: &F = &*(f as *const F);
911                let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
912                f(
913                    CellRenderer::from_glib_borrow(this).unsafe_cast_ref(),
914                    &from_glib_borrow(editable),
915                    path,
916                )
917            }
918        }
919        unsafe {
920            let f: Box_<F> = Box_::new(f);
921            connect_raw(
922                self.as_ptr() as *mut _,
923                c"editing-started".as_ptr(),
924                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
925                    editing_started_trampoline::<Self, F> as *const (),
926                )),
927                Box_::into_raw(f),
928            )
929        }
930    }
931
932    #[doc(alias = "cell-background")]
933    fn connect_cell_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
934        unsafe extern "C" fn notify_cell_background_trampoline<
935            P: IsA<CellRenderer>,
936            F: Fn(&P) + 'static,
937        >(
938            this: *mut ffi::GtkCellRenderer,
939            _param_spec: glib::ffi::gpointer,
940            f: glib::ffi::gpointer,
941        ) {
942            unsafe {
943                let f: &F = &*(f as *const F);
944                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
945            }
946        }
947        unsafe {
948            let f: Box_<F> = Box_::new(f);
949            connect_raw(
950                self.as_ptr() as *mut _,
951                c"notify::cell-background".as_ptr(),
952                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
953                    notify_cell_background_trampoline::<Self, F> as *const (),
954                )),
955                Box_::into_raw(f),
956            )
957        }
958    }
959
960    #[doc(alias = "cell-background-rgba")]
961    fn connect_cell_background_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
962        unsafe extern "C" fn notify_cell_background_rgba_trampoline<
963            P: IsA<CellRenderer>,
964            F: Fn(&P) + 'static,
965        >(
966            this: *mut ffi::GtkCellRenderer,
967            _param_spec: glib::ffi::gpointer,
968            f: glib::ffi::gpointer,
969        ) {
970            unsafe {
971                let f: &F = &*(f as *const F);
972                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
973            }
974        }
975        unsafe {
976            let f: Box_<F> = Box_::new(f);
977            connect_raw(
978                self.as_ptr() as *mut _,
979                c"notify::cell-background-rgba".as_ptr(),
980                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
981                    notify_cell_background_rgba_trampoline::<Self, F> as *const (),
982                )),
983                Box_::into_raw(f),
984            )
985        }
986    }
987
988    #[doc(alias = "cell-background-set")]
989    fn connect_cell_background_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
990        unsafe extern "C" fn notify_cell_background_set_trampoline<
991            P: IsA<CellRenderer>,
992            F: Fn(&P) + 'static,
993        >(
994            this: *mut ffi::GtkCellRenderer,
995            _param_spec: glib::ffi::gpointer,
996            f: glib::ffi::gpointer,
997        ) {
998            unsafe {
999                let f: &F = &*(f as *const F);
1000                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1001            }
1002        }
1003        unsafe {
1004            let f: Box_<F> = Box_::new(f);
1005            connect_raw(
1006                self.as_ptr() as *mut _,
1007                c"notify::cell-background-set".as_ptr(),
1008                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1009                    notify_cell_background_set_trampoline::<Self, F> as *const (),
1010                )),
1011                Box_::into_raw(f),
1012            )
1013        }
1014    }
1015
1016    #[doc(alias = "editing")]
1017    fn connect_editing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1018        unsafe extern "C" fn notify_editing_trampoline<
1019            P: IsA<CellRenderer>,
1020            F: Fn(&P) + 'static,
1021        >(
1022            this: *mut ffi::GtkCellRenderer,
1023            _param_spec: glib::ffi::gpointer,
1024            f: glib::ffi::gpointer,
1025        ) {
1026            unsafe {
1027                let f: &F = &*(f as *const F);
1028                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1029            }
1030        }
1031        unsafe {
1032            let f: Box_<F> = Box_::new(f);
1033            connect_raw(
1034                self.as_ptr() as *mut _,
1035                c"notify::editing".as_ptr(),
1036                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1037                    notify_editing_trampoline::<Self, F> as *const (),
1038                )),
1039                Box_::into_raw(f),
1040            )
1041        }
1042    }
1043
1044    #[doc(alias = "height")]
1045    fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1046        unsafe extern "C" fn notify_height_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1047            this: *mut ffi::GtkCellRenderer,
1048            _param_spec: glib::ffi::gpointer,
1049            f: glib::ffi::gpointer,
1050        ) {
1051            unsafe {
1052                let f: &F = &*(f as *const F);
1053                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1054            }
1055        }
1056        unsafe {
1057            let f: Box_<F> = Box_::new(f);
1058            connect_raw(
1059                self.as_ptr() as *mut _,
1060                c"notify::height".as_ptr(),
1061                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1062                    notify_height_trampoline::<Self, F> as *const (),
1063                )),
1064                Box_::into_raw(f),
1065            )
1066        }
1067    }
1068
1069    #[doc(alias = "is-expanded")]
1070    fn connect_is_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1071        unsafe extern "C" fn notify_is_expanded_trampoline<
1072            P: IsA<CellRenderer>,
1073            F: Fn(&P) + 'static,
1074        >(
1075            this: *mut ffi::GtkCellRenderer,
1076            _param_spec: glib::ffi::gpointer,
1077            f: glib::ffi::gpointer,
1078        ) {
1079            unsafe {
1080                let f: &F = &*(f as *const F);
1081                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1082            }
1083        }
1084        unsafe {
1085            let f: Box_<F> = Box_::new(f);
1086            connect_raw(
1087                self.as_ptr() as *mut _,
1088                c"notify::is-expanded".as_ptr(),
1089                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1090                    notify_is_expanded_trampoline::<Self, F> as *const (),
1091                )),
1092                Box_::into_raw(f),
1093            )
1094        }
1095    }
1096
1097    #[doc(alias = "is-expander")]
1098    fn connect_is_expander_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1099        unsafe extern "C" fn notify_is_expander_trampoline<
1100            P: IsA<CellRenderer>,
1101            F: Fn(&P) + 'static,
1102        >(
1103            this: *mut ffi::GtkCellRenderer,
1104            _param_spec: glib::ffi::gpointer,
1105            f: glib::ffi::gpointer,
1106        ) {
1107            unsafe {
1108                let f: &F = &*(f as *const F);
1109                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1110            }
1111        }
1112        unsafe {
1113            let f: Box_<F> = Box_::new(f);
1114            connect_raw(
1115                self.as_ptr() as *mut _,
1116                c"notify::is-expander".as_ptr(),
1117                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1118                    notify_is_expander_trampoline::<Self, F> as *const (),
1119                )),
1120                Box_::into_raw(f),
1121            )
1122        }
1123    }
1124
1125    #[doc(alias = "mode")]
1126    fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1127        unsafe extern "C" fn notify_mode_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1128            this: *mut ffi::GtkCellRenderer,
1129            _param_spec: glib::ffi::gpointer,
1130            f: glib::ffi::gpointer,
1131        ) {
1132            unsafe {
1133                let f: &F = &*(f as *const F);
1134                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1135            }
1136        }
1137        unsafe {
1138            let f: Box_<F> = Box_::new(f);
1139            connect_raw(
1140                self.as_ptr() as *mut _,
1141                c"notify::mode".as_ptr(),
1142                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1143                    notify_mode_trampoline::<Self, F> as *const (),
1144                )),
1145                Box_::into_raw(f),
1146            )
1147        }
1148    }
1149
1150    #[doc(alias = "sensitive")]
1151    fn connect_sensitive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1152        unsafe extern "C" fn notify_sensitive_trampoline<
1153            P: IsA<CellRenderer>,
1154            F: Fn(&P) + 'static,
1155        >(
1156            this: *mut ffi::GtkCellRenderer,
1157            _param_spec: glib::ffi::gpointer,
1158            f: glib::ffi::gpointer,
1159        ) {
1160            unsafe {
1161                let f: &F = &*(f as *const F);
1162                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1163            }
1164        }
1165        unsafe {
1166            let f: Box_<F> = Box_::new(f);
1167            connect_raw(
1168                self.as_ptr() as *mut _,
1169                c"notify::sensitive".as_ptr(),
1170                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1171                    notify_sensitive_trampoline::<Self, F> as *const (),
1172                )),
1173                Box_::into_raw(f),
1174            )
1175        }
1176    }
1177
1178    #[doc(alias = "visible")]
1179    fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1180        unsafe extern "C" fn notify_visible_trampoline<
1181            P: IsA<CellRenderer>,
1182            F: Fn(&P) + 'static,
1183        >(
1184            this: *mut ffi::GtkCellRenderer,
1185            _param_spec: glib::ffi::gpointer,
1186            f: glib::ffi::gpointer,
1187        ) {
1188            unsafe {
1189                let f: &F = &*(f as *const F);
1190                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1191            }
1192        }
1193        unsafe {
1194            let f: Box_<F> = Box_::new(f);
1195            connect_raw(
1196                self.as_ptr() as *mut _,
1197                c"notify::visible".as_ptr(),
1198                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1199                    notify_visible_trampoline::<Self, F> as *const (),
1200                )),
1201                Box_::into_raw(f),
1202            )
1203        }
1204    }
1205
1206    #[doc(alias = "width")]
1207    fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1208        unsafe extern "C" fn notify_width_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1209            this: *mut ffi::GtkCellRenderer,
1210            _param_spec: glib::ffi::gpointer,
1211            f: glib::ffi::gpointer,
1212        ) {
1213            unsafe {
1214                let f: &F = &*(f as *const F);
1215                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1216            }
1217        }
1218        unsafe {
1219            let f: Box_<F> = Box_::new(f);
1220            connect_raw(
1221                self.as_ptr() as *mut _,
1222                c"notify::width".as_ptr(),
1223                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1224                    notify_width_trampoline::<Self, F> as *const (),
1225                )),
1226                Box_::into_raw(f),
1227            )
1228        }
1229    }
1230
1231    #[doc(alias = "xalign")]
1232    fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1233        unsafe extern "C" fn notify_xalign_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1234            this: *mut ffi::GtkCellRenderer,
1235            _param_spec: glib::ffi::gpointer,
1236            f: glib::ffi::gpointer,
1237        ) {
1238            unsafe {
1239                let f: &F = &*(f as *const F);
1240                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1241            }
1242        }
1243        unsafe {
1244            let f: Box_<F> = Box_::new(f);
1245            connect_raw(
1246                self.as_ptr() as *mut _,
1247                c"notify::xalign".as_ptr(),
1248                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1249                    notify_xalign_trampoline::<Self, F> as *const (),
1250                )),
1251                Box_::into_raw(f),
1252            )
1253        }
1254    }
1255
1256    #[doc(alias = "xpad")]
1257    fn connect_xpad_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1258        unsafe extern "C" fn notify_xpad_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1259            this: *mut ffi::GtkCellRenderer,
1260            _param_spec: glib::ffi::gpointer,
1261            f: glib::ffi::gpointer,
1262        ) {
1263            unsafe {
1264                let f: &F = &*(f as *const F);
1265                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1266            }
1267        }
1268        unsafe {
1269            let f: Box_<F> = Box_::new(f);
1270            connect_raw(
1271                self.as_ptr() as *mut _,
1272                c"notify::xpad".as_ptr(),
1273                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1274                    notify_xpad_trampoline::<Self, F> as *const (),
1275                )),
1276                Box_::into_raw(f),
1277            )
1278        }
1279    }
1280
1281    #[doc(alias = "yalign")]
1282    fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1283        unsafe extern "C" fn notify_yalign_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1284            this: *mut ffi::GtkCellRenderer,
1285            _param_spec: glib::ffi::gpointer,
1286            f: glib::ffi::gpointer,
1287        ) {
1288            unsafe {
1289                let f: &F = &*(f as *const F);
1290                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1291            }
1292        }
1293        unsafe {
1294            let f: Box_<F> = Box_::new(f);
1295            connect_raw(
1296                self.as_ptr() as *mut _,
1297                c"notify::yalign".as_ptr(),
1298                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1299                    notify_yalign_trampoline::<Self, F> as *const (),
1300                )),
1301                Box_::into_raw(f),
1302            )
1303        }
1304    }
1305
1306    #[doc(alias = "ypad")]
1307    fn connect_ypad_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1308        unsafe extern "C" fn notify_ypad_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1309            this: *mut ffi::GtkCellRenderer,
1310            _param_spec: glib::ffi::gpointer,
1311            f: glib::ffi::gpointer,
1312        ) {
1313            unsafe {
1314                let f: &F = &*(f as *const F);
1315                f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1316            }
1317        }
1318        unsafe {
1319            let f: Box_<F> = Box_::new(f);
1320            connect_raw(
1321                self.as_ptr() as *mut _,
1322                c"notify::ypad".as_ptr(),
1323                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1324                    notify_ypad_trampoline::<Self, F> as *const (),
1325                )),
1326                Box_::into_raw(f),
1327            )
1328        }
1329    }
1330}
1331
1332impl<O: IsA<CellRenderer>> CellRendererExt for O {}