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