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