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,
8};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::{boxed::Box as Box_, fmt, mem, mem::transmute};
15
16glib::wrapper! {
17    /// The [`CellRenderer`][crate::CellRenderer] is a base class of a set of objects used for
18    /// rendering a cell to a [`cairo::Context`][crate::cairo::Context]. These objects are used primarily by
19    /// the [`TreeView`][crate::TreeView] widget, though they aren’t tied to them in any
20    /// specific way. It is worth noting that [`CellRenderer`][crate::CellRenderer] is not a
21    /// [`Widget`][crate::Widget] and cannot be treated as such.
22    ///
23    /// The primary use of a [`CellRenderer`][crate::CellRenderer] is for drawing a certain graphical
24    /// elements on a [`cairo::Context`][crate::cairo::Context]. Typically, one cell renderer is used to
25    /// draw many cells on the screen. To this extent, it isn’t expected that a
26    /// CellRenderer keep any permanent state around. Instead, any state is set
27    /// just prior to use using `GObjects` property system. Then, the
28    /// cell is measured using `gtk_cell_renderer_get_size()`. Finally, the cell
29    /// is rendered in the correct location using [`CellRendererExt::render()`][crate::prelude::CellRendererExt::render()].
30    ///
31    /// There are a number of rules that must be followed when writing a new
32    /// [`CellRenderer`][crate::CellRenderer]. First and foremost, it’s important that a certain set
33    /// of properties will always yield a cell renderer of the same size,
34    /// barring a `GtkStyle` change. The [`CellRenderer`][crate::CellRenderer] also has a number of
35    /// generic properties that are expected to be honored by all children.
36    ///
37    /// Beyond merely rendering a cell, cell renderers can optionally
38    /// provide active user interface elements. A cell renderer can be
39    /// “activatable” like [`CellRendererToggle`][crate::CellRendererToggle],
40    /// which toggles when it gets activated by a mouse click, or it can be
41    /// “editable” like [`CellRendererText`][crate::CellRendererText], which
42    /// allows the user to edit the text using a widget implementing the
43    /// [`CellEditable`][crate::CellEditable] interface, e.g. [`Entry`][crate::Entry].
44    /// To make a cell renderer activatable or editable, you have to
45    /// implement the `GtkCellRendererClass.activate` or
46    /// `GtkCellRendererClass.start_editing` virtual functions, respectively.
47    ///
48    /// Many properties of [`CellRenderer`][crate::CellRenderer] and its subclasses have a
49    /// corresponding “set” property, e.g. “cell-background-set” corresponds
50    /// to “cell-background”. These “set” properties reflect whether a property
51    /// has been set or not. You should not set them independently.
52    ///
53    /// This is an Abstract Base Class, you cannot instantiate it.
54    ///
55    /// ## Properties
56    ///
57    ///
58    /// #### `cell-background`
59    ///  Writeable
60    ///
61    ///
62    /// #### `cell-background-gdk`
63    ///  Cell background as a `GdkColor`
64    ///
65    /// Readable | 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: [`CellRendererExt::stop_editing()`][crate::prelude::CellRendererExt::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 [`CellEditableExt::start_editing()`][crate::prelude::CellEditableExt::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    ///
153    /// **⚠️ The following code is in C ⚠️**
154    ///
155    /// ```C
156    /// static void
157    /// text_editing_started (GtkCellRenderer *cell,
158    ///                       GtkCellEditable *editable,
159    ///                       const gchar     *path,
160    ///                       gpointer         data)
161    /// {
162    ///   if (GTK_IS_ENTRY (editable))
163    ///     {
164    ///       GtkEntry *entry = GTK_ENTRY (editable);
165    ///
166    ///       // ... create a GtkEntryCompletion
167    ///
168    ///       gtk_entry_set_completion (entry, completion);
169    ///     }
170    /// }
171    /// ```
172    ///
173    ///
174    ///
175    /// # Implements
176    ///
177    /// [`CellRendererExt`][trait@crate::prelude::CellRendererExt], [`trait@glib::ObjectExt`]
178    #[doc(alias = "GtkCellRenderer")]
179    pub struct CellRenderer(Object<ffi::GtkCellRenderer, ffi::GtkCellRendererClass>);
180
181    match fn {
182        type_ => || ffi::gtk_cell_renderer_get_type(),
183    }
184}
185
186impl CellRenderer {
187    pub const NONE: Option<&'static CellRenderer> = None;
188}
189
190mod sealed {
191    pub trait Sealed {}
192    impl<T: super::IsA<super::CellRenderer>> Sealed for T {}
193}
194
195/// Trait containing all [`struct@CellRenderer`] methods.
196///
197/// # Implementors
198///
199/// [`CellRendererPixbuf`][struct@crate::CellRendererPixbuf], [`CellRendererProgress`][struct@crate::CellRendererProgress], [`CellRendererSpinner`][struct@crate::CellRendererSpinner], [`CellRendererText`][struct@crate::CellRendererText], [`CellRendererToggle`][struct@crate::CellRendererToggle], [`CellRenderer`][struct@crate::CellRenderer]
200pub trait CellRendererExt: IsA<CellRenderer> + sealed::Sealed + 'static {
201    /// Passes an activate event to the cell renderer for possible processing.
202    /// Some cell renderers may use events; for example, [`CellRendererToggle`][crate::CellRendererToggle]
203    /// toggles when it gets a mouse click.
204    /// ## `event`
205    /// a `GdkEvent`
206    /// ## `widget`
207    /// widget that received the event
208    /// ## `path`
209    /// widget-dependent string representation of the event location;
210    ///  e.g. for [`TreeView`][crate::TreeView], a string representation of [`TreePath`][crate::TreePath]
211    /// ## `background_area`
212    /// background area as passed to [`render()`][Self::render()]
213    /// ## `cell_area`
214    /// cell area as passed to [`render()`][Self::render()]
215    /// ## `flags`
216    /// render flags
217    ///
218    /// # Returns
219    ///
220    /// [`true`] if the event was consumed/handled
221    #[doc(alias = "gtk_cell_renderer_activate")]
222    fn activate(
223        &self,
224        event: &gdk::Event,
225        widget: &impl IsA<Widget>,
226        path: &str,
227        background_area: &gdk::Rectangle,
228        cell_area: &gdk::Rectangle,
229        flags: CellRendererState,
230    ) -> bool {
231        unsafe {
232            from_glib(ffi::gtk_cell_renderer_activate(
233                self.as_ref().to_glib_none().0,
234                mut_override(event.to_glib_none().0),
235                widget.as_ref().to_glib_none().0,
236                path.to_glib_none().0,
237                background_area.to_glib_none().0,
238                cell_area.to_glib_none().0,
239                flags.into_glib(),
240            ))
241        }
242    }
243
244    /// Gets the aligned area used by `self` inside `cell_area`. Used for finding
245    /// the appropriate edit and focus rectangle.
246    /// ## `widget`
247    /// the [`Widget`][crate::Widget] this cell will be rendering to
248    /// ## `flags`
249    /// render flags
250    /// ## `cell_area`
251    /// cell area which would be passed to [`render()`][Self::render()]
252    ///
253    /// # Returns
254    ///
255    ///
256    /// ## `aligned_area`
257    /// the return location for the space inside `cell_area`
258    ///  that would acually be used to render.
259    #[doc(alias = "gtk_cell_renderer_get_aligned_area")]
260    #[doc(alias = "get_aligned_area")]
261    fn aligned_area(
262        &self,
263        widget: &impl IsA<Widget>,
264        flags: CellRendererState,
265        cell_area: &gdk::Rectangle,
266    ) -> gdk::Rectangle {
267        unsafe {
268            let mut aligned_area = gdk::Rectangle::uninitialized();
269            ffi::gtk_cell_renderer_get_aligned_area(
270                self.as_ref().to_glib_none().0,
271                widget.as_ref().to_glib_none().0,
272                flags.into_glib(),
273                cell_area.to_glib_none().0,
274                aligned_area.to_glib_none_mut().0,
275            );
276            aligned_area
277        }
278    }
279
280    /// Fills in `xalign` and `yalign` with the appropriate values of `self`.
281    ///
282    /// # Returns
283    ///
284    ///
285    /// ## `xalign`
286    /// location to fill in with the x alignment of the cell, or [`None`]
287    ///
288    /// ## `yalign`
289    /// location to fill in with the y alignment of the cell, or [`None`]
290    #[doc(alias = "gtk_cell_renderer_get_alignment")]
291    #[doc(alias = "get_alignment")]
292    fn alignment(&self) -> (f32, f32) {
293        unsafe {
294            let mut xalign = mem::MaybeUninit::uninit();
295            let mut yalign = mem::MaybeUninit::uninit();
296            ffi::gtk_cell_renderer_get_alignment(
297                self.as_ref().to_glib_none().0,
298                xalign.as_mut_ptr(),
299                yalign.as_mut_ptr(),
300            );
301            (xalign.assume_init(), yalign.assume_init())
302        }
303    }
304
305    /// Fills in `width` and `height` with the appropriate size of `self`.
306    ///
307    /// # Returns
308    ///
309    ///
310    /// ## `width`
311    /// location to fill in with the fixed width of the cell, or [`None`]
312    ///
313    /// ## `height`
314    /// location to fill in with the fixed height of the cell, or [`None`]
315    #[doc(alias = "gtk_cell_renderer_get_fixed_size")]
316    #[doc(alias = "get_fixed_size")]
317    fn fixed_size(&self) -> (i32, i32) {
318        unsafe {
319            let mut width = mem::MaybeUninit::uninit();
320            let mut height = mem::MaybeUninit::uninit();
321            ffi::gtk_cell_renderer_get_fixed_size(
322                self.as_ref().to_glib_none().0,
323                width.as_mut_ptr(),
324                height.as_mut_ptr(),
325            );
326            (width.assume_init(), height.assume_init())
327        }
328    }
329
330    /// Fills in `xpad` and `ypad` with the appropriate values of `self`.
331    ///
332    /// # Returns
333    ///
334    ///
335    /// ## `xpad`
336    /// location to fill in with the x padding of the cell, or [`None`]
337    ///
338    /// ## `ypad`
339    /// location to fill in with the y padding of the cell, or [`None`]
340    #[doc(alias = "gtk_cell_renderer_get_padding")]
341    #[doc(alias = "get_padding")]
342    fn padding(&self) -> (i32, i32) {
343        unsafe {
344            let mut xpad = mem::MaybeUninit::uninit();
345            let mut ypad = mem::MaybeUninit::uninit();
346            ffi::gtk_cell_renderer_get_padding(
347                self.as_ref().to_glib_none().0,
348                xpad.as_mut_ptr(),
349                ypad.as_mut_ptr(),
350            );
351            (xpad.assume_init(), ypad.assume_init())
352        }
353    }
354
355    /// Retreives a renderer’s natural size when rendered to `widget`.
356    /// ## `widget`
357    /// the [`Widget`][crate::Widget] this cell will be rendering to
358    ///
359    /// # Returns
360    ///
361    ///
362    /// ## `minimum_size`
363    /// location to store the minimum size, or [`None`]
364    ///
365    /// ## `natural_size`
366    /// location to store the natural size, or [`None`]
367    #[doc(alias = "gtk_cell_renderer_get_preferred_height")]
368    #[doc(alias = "get_preferred_height")]
369    fn preferred_height(&self, widget: &impl IsA<Widget>) -> (i32, i32) {
370        unsafe {
371            let mut minimum_size = mem::MaybeUninit::uninit();
372            let mut natural_size = mem::MaybeUninit::uninit();
373            ffi::gtk_cell_renderer_get_preferred_height(
374                self.as_ref().to_glib_none().0,
375                widget.as_ref().to_glib_none().0,
376                minimum_size.as_mut_ptr(),
377                natural_size.as_mut_ptr(),
378            );
379            (minimum_size.assume_init(), natural_size.assume_init())
380        }
381    }
382
383    /// Retreives a cell renderers’s minimum and natural height if it were rendered to
384    /// `widget` with the specified `width`.
385    /// ## `widget`
386    /// the [`Widget`][crate::Widget] this cell will be rendering to
387    /// ## `width`
388    /// the size which is available for allocation
389    ///
390    /// # Returns
391    ///
392    ///
393    /// ## `minimum_height`
394    /// location for storing the minimum size, or [`None`]
395    ///
396    /// ## `natural_height`
397    /// location for storing the preferred size, or [`None`]
398    #[doc(alias = "gtk_cell_renderer_get_preferred_height_for_width")]
399    #[doc(alias = "get_preferred_height_for_width")]
400    fn preferred_height_for_width(&self, widget: &impl IsA<Widget>, width: i32) -> (i32, i32) {
401        unsafe {
402            let mut minimum_height = mem::MaybeUninit::uninit();
403            let mut natural_height = mem::MaybeUninit::uninit();
404            ffi::gtk_cell_renderer_get_preferred_height_for_width(
405                self.as_ref().to_glib_none().0,
406                widget.as_ref().to_glib_none().0,
407                width,
408                minimum_height.as_mut_ptr(),
409                natural_height.as_mut_ptr(),
410            );
411            (minimum_height.assume_init(), natural_height.assume_init())
412        }
413    }
414
415    /// Retrieves the minimum and natural size of a cell taking
416    /// into account the widget’s preference for height-for-width management.
417    /// ## `widget`
418    /// the [`Widget`][crate::Widget] this cell will be rendering to
419    ///
420    /// # Returns
421    ///
422    ///
423    /// ## `minimum_size`
424    /// location for storing the minimum size, or [`None`]
425    ///
426    /// ## `natural_size`
427    /// location for storing the natural size, or [`None`]
428    #[doc(alias = "gtk_cell_renderer_get_preferred_size")]
429    #[doc(alias = "get_preferred_size")]
430    fn preferred_size(&self, widget: &impl IsA<Widget>) -> (Requisition, Requisition) {
431        unsafe {
432            let mut minimum_size = Requisition::uninitialized();
433            let mut natural_size = Requisition::uninitialized();
434            ffi::gtk_cell_renderer_get_preferred_size(
435                self.as_ref().to_glib_none().0,
436                widget.as_ref().to_glib_none().0,
437                minimum_size.to_glib_none_mut().0,
438                natural_size.to_glib_none_mut().0,
439            );
440            (minimum_size, natural_size)
441        }
442    }
443
444    /// Retreives a renderer’s natural size when rendered to `widget`.
445    /// ## `widget`
446    /// the [`Widget`][crate::Widget] this cell will be rendering to
447    ///
448    /// # Returns
449    ///
450    ///
451    /// ## `minimum_size`
452    /// location to store the minimum size, or [`None`]
453    ///
454    /// ## `natural_size`
455    /// location to store the natural size, or [`None`]
456    #[doc(alias = "gtk_cell_renderer_get_preferred_width")]
457    #[doc(alias = "get_preferred_width")]
458    fn preferred_width(&self, widget: &impl IsA<Widget>) -> (i32, i32) {
459        unsafe {
460            let mut minimum_size = mem::MaybeUninit::uninit();
461            let mut natural_size = mem::MaybeUninit::uninit();
462            ffi::gtk_cell_renderer_get_preferred_width(
463                self.as_ref().to_glib_none().0,
464                widget.as_ref().to_glib_none().0,
465                minimum_size.as_mut_ptr(),
466                natural_size.as_mut_ptr(),
467            );
468            (minimum_size.assume_init(), natural_size.assume_init())
469        }
470    }
471
472    /// Retreives a cell renderers’s minimum and natural width if it were rendered to
473    /// `widget` with the specified `height`.
474    /// ## `widget`
475    /// the [`Widget`][crate::Widget] this cell will be rendering to
476    /// ## `height`
477    /// the size which is available for allocation
478    ///
479    /// # Returns
480    ///
481    ///
482    /// ## `minimum_width`
483    /// location for storing the minimum size, or [`None`]
484    ///
485    /// ## `natural_width`
486    /// location for storing the preferred size, or [`None`]
487    #[doc(alias = "gtk_cell_renderer_get_preferred_width_for_height")]
488    #[doc(alias = "get_preferred_width_for_height")]
489    fn preferred_width_for_height(&self, widget: &impl IsA<Widget>, height: i32) -> (i32, i32) {
490        unsafe {
491            let mut minimum_width = mem::MaybeUninit::uninit();
492            let mut natural_width = mem::MaybeUninit::uninit();
493            ffi::gtk_cell_renderer_get_preferred_width_for_height(
494                self.as_ref().to_glib_none().0,
495                widget.as_ref().to_glib_none().0,
496                height,
497                minimum_width.as_mut_ptr(),
498                natural_width.as_mut_ptr(),
499            );
500            (minimum_width.assume_init(), natural_width.assume_init())
501        }
502    }
503
504    /// Gets whether the cell renderer prefers a height-for-width layout
505    /// or a width-for-height layout.
506    ///
507    /// # Returns
508    ///
509    /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by this renderer.
510    #[doc(alias = "gtk_cell_renderer_get_request_mode")]
511    #[doc(alias = "get_request_mode")]
512    fn request_mode(&self) -> SizeRequestMode {
513        unsafe {
514            from_glib(ffi::gtk_cell_renderer_get_request_mode(
515                self.as_ref().to_glib_none().0,
516            ))
517        }
518    }
519
520    /// Returns the cell renderer’s sensitivity.
521    ///
522    /// # Returns
523    ///
524    /// [`true`] if the cell renderer is sensitive
525    #[doc(alias = "gtk_cell_renderer_get_sensitive")]
526    #[doc(alias = "get_sensitive")]
527    fn is_sensitive(&self) -> bool {
528        unsafe {
529            from_glib(ffi::gtk_cell_renderer_get_sensitive(
530                self.as_ref().to_glib_none().0,
531            ))
532        }
533    }
534
535    /// Translates the cell renderer state to [`StateFlags`][crate::StateFlags],
536    /// based on the cell renderer and widget sensitivity, and
537    /// the given [`CellRendererState`][crate::CellRendererState].
538    /// ## `widget`
539    /// a [`Widget`][crate::Widget], or [`None`]
540    /// ## `cell_state`
541    /// cell renderer state
542    ///
543    /// # Returns
544    ///
545    /// the widget state flags applying to `self`
546    #[doc(alias = "gtk_cell_renderer_get_state")]
547    #[doc(alias = "get_state")]
548    fn state(
549        &self,
550        widget: Option<&impl IsA<Widget>>,
551        cell_state: CellRendererState,
552    ) -> StateFlags {
553        unsafe {
554            from_glib(ffi::gtk_cell_renderer_get_state(
555                self.as_ref().to_glib_none().0,
556                widget.map(|p| p.as_ref()).to_glib_none().0,
557                cell_state.into_glib(),
558            ))
559        }
560    }
561
562    /// Returns the cell renderer’s visibility.
563    ///
564    /// # Returns
565    ///
566    /// [`true`] if the cell renderer is visible
567    #[doc(alias = "gtk_cell_renderer_get_visible")]
568    #[doc(alias = "get_visible")]
569    fn is_visible(&self) -> bool {
570        unsafe {
571            from_glib(ffi::gtk_cell_renderer_get_visible(
572                self.as_ref().to_glib_none().0,
573            ))
574        }
575    }
576
577    /// Checks whether the cell renderer can do something when activated.
578    ///
579    /// # Returns
580    ///
581    /// [`true`] if the cell renderer can do anything when activated
582    #[doc(alias = "gtk_cell_renderer_is_activatable")]
583    fn is_activatable(&self) -> bool {
584        unsafe {
585            from_glib(ffi::gtk_cell_renderer_is_activatable(
586                self.as_ref().to_glib_none().0,
587            ))
588        }
589    }
590
591    /// Invokes the virtual render function of the [`CellRenderer`][crate::CellRenderer]. The three
592    /// passed-in rectangles are areas in `cr`. Most renderers will draw within
593    /// `cell_area`; the xalign, yalign, xpad, and ypad fields of the [`CellRenderer`][crate::CellRenderer]
594    /// should be honored with respect to `cell_area`. `background_area` includes the
595    /// blank space around the cell, and also the area containing the tree expander;
596    /// so the `background_area` rectangles for all cells tile to cover the entire
597    /// `window`.
598    /// ## `cr`
599    /// a cairo context to draw to
600    /// ## `widget`
601    /// the widget owning `window`
602    /// ## `background_area`
603    /// entire cell area (including tree expanders and maybe
604    ///  padding on the sides)
605    /// ## `cell_area`
606    /// area normally rendered by a cell renderer
607    /// ## `flags`
608    /// flags that affect rendering
609    #[doc(alias = "gtk_cell_renderer_render")]
610    fn render(
611        &self,
612        cr: &cairo::Context,
613        widget: &impl IsA<Widget>,
614        background_area: &gdk::Rectangle,
615        cell_area: &gdk::Rectangle,
616        flags: CellRendererState,
617    ) {
618        unsafe {
619            ffi::gtk_cell_renderer_render(
620                self.as_ref().to_glib_none().0,
621                mut_override(cr.to_glib_none().0),
622                widget.as_ref().to_glib_none().0,
623                background_area.to_glib_none().0,
624                cell_area.to_glib_none().0,
625                flags.into_glib(),
626            );
627        }
628    }
629
630    /// Sets the renderer’s alignment within its available space.
631    /// ## `xalign`
632    /// the x alignment of the cell renderer
633    /// ## `yalign`
634    /// the y alignment of the cell renderer
635    #[doc(alias = "gtk_cell_renderer_set_alignment")]
636    fn set_alignment(&self, xalign: f32, yalign: f32) {
637        unsafe {
638            ffi::gtk_cell_renderer_set_alignment(self.as_ref().to_glib_none().0, xalign, yalign);
639        }
640    }
641
642    /// Sets the renderer size to be explicit, independent of the properties set.
643    /// ## `width`
644    /// the width of the cell renderer, or -1
645    /// ## `height`
646    /// the height of the cell renderer, or -1
647    #[doc(alias = "gtk_cell_renderer_set_fixed_size")]
648    fn set_fixed_size(&self, width: i32, height: i32) {
649        unsafe {
650            ffi::gtk_cell_renderer_set_fixed_size(self.as_ref().to_glib_none().0, width, height);
651        }
652    }
653
654    /// Sets the renderer’s padding.
655    /// ## `xpad`
656    /// the x padding of the cell renderer
657    /// ## `ypad`
658    /// the y padding of the cell renderer
659    #[doc(alias = "gtk_cell_renderer_set_padding")]
660    fn set_padding(&self, xpad: i32, ypad: i32) {
661        unsafe {
662            ffi::gtk_cell_renderer_set_padding(self.as_ref().to_glib_none().0, xpad, ypad);
663        }
664    }
665
666    /// Sets the cell renderer’s sensitivity.
667    /// ## `sensitive`
668    /// the sensitivity of the cell
669    #[doc(alias = "gtk_cell_renderer_set_sensitive")]
670    fn set_sensitive(&self, sensitive: bool) {
671        unsafe {
672            ffi::gtk_cell_renderer_set_sensitive(
673                self.as_ref().to_glib_none().0,
674                sensitive.into_glib(),
675            );
676        }
677    }
678
679    /// Sets the cell renderer’s visibility.
680    /// ## `visible`
681    /// the visibility of the cell
682    #[doc(alias = "gtk_cell_renderer_set_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            let f: &F = &*(f as *const F);
873            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
874        }
875        unsafe {
876            let f: Box_<F> = Box_::new(f);
877            connect_raw(
878                self.as_ptr() as *mut _,
879                b"editing-canceled\0".as_ptr() as *const _,
880                Some(transmute::<_, unsafe extern "C" fn()>(
881                    editing_canceled_trampoline::<Self, F> as *const (),
882                )),
883                Box_::into_raw(f),
884            )
885        }
886    }
887
888    /// This signal gets emitted when a cell starts to be edited.
889    /// The intended use of this signal is to do special setup
890    /// on `editable`, e.g. adding a [`EntryCompletion`][crate::EntryCompletion] or setting
891    /// up additional columns in a [`ComboBox`][crate::ComboBox].
892    ///
893    /// See [`CellEditableExt::start_editing()`][crate::prelude::CellEditableExt::start_editing()] for information on the lifecycle of
894    /// the `editable` and a way to do setup that doesn’t depend on the `renderer`.
895    ///
896    /// Note that GTK+ doesn't guarantee that cell renderers will
897    /// continue to use the same kind of widget for editing in future
898    /// releases, therefore you should check the type of `editable`
899    /// before doing any specific setup, as in the following example:
900    ///
901    ///
902    /// **⚠️ The following code is in C ⚠️**
903    ///
904    /// ```C
905    /// static void
906    /// text_editing_started (GtkCellRenderer *cell,
907    ///                       GtkCellEditable *editable,
908    ///                       const gchar     *path,
909    ///                       gpointer         data)
910    /// {
911    ///   if (GTK_IS_ENTRY (editable))
912    ///     {
913    ///       GtkEntry *entry = GTK_ENTRY (editable);
914    ///
915    ///       // ... create a GtkEntryCompletion
916    ///
917    ///       gtk_entry_set_completion (entry, completion);
918    ///     }
919    /// }
920    /// ```
921    /// ## `editable`
922    /// the [`CellEditable`][crate::CellEditable]
923    /// ## `path`
924    /// the path identifying the edited cell
925    #[doc(alias = "editing-started")]
926    fn connect_editing_started<F: Fn(&Self, &CellEditable, TreePath) + 'static>(
927        &self,
928        f: F,
929    ) -> SignalHandlerId {
930        unsafe extern "C" fn editing_started_trampoline<
931            P: IsA<CellRenderer>,
932            F: Fn(&P, &CellEditable, TreePath) + 'static,
933        >(
934            this: *mut ffi::GtkCellRenderer,
935            editable: *mut ffi::GtkCellEditable,
936            path: *mut libc::c_char,
937            f: glib::ffi::gpointer,
938        ) {
939            let f: &F = &*(f as *const F);
940            let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
941            f(
942                CellRenderer::from_glib_borrow(this).unsafe_cast_ref(),
943                &from_glib_borrow(editable),
944                path,
945            )
946        }
947        unsafe {
948            let f: Box_<F> = Box_::new(f);
949            connect_raw(
950                self.as_ptr() as *mut _,
951                b"editing-started\0".as_ptr() as *const _,
952                Some(transmute::<_, unsafe extern "C" fn()>(
953                    editing_started_trampoline::<Self, F> as *const (),
954                )),
955                Box_::into_raw(f),
956            )
957        }
958    }
959
960    #[doc(alias = "cell-background")]
961    fn connect_cell_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
962        unsafe extern "C" fn notify_cell_background_trampoline<
963            P: IsA<CellRenderer>,
964            F: Fn(&P) + 'static,
965        >(
966            this: *mut ffi::GtkCellRenderer,
967            _param_spec: glib::ffi::gpointer,
968            f: glib::ffi::gpointer,
969        ) {
970            let f: &F = &*(f as *const F);
971            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
972        }
973        unsafe {
974            let f: Box_<F> = Box_::new(f);
975            connect_raw(
976                self.as_ptr() as *mut _,
977                b"notify::cell-background\0".as_ptr() as *const _,
978                Some(transmute::<_, unsafe extern "C" fn()>(
979                    notify_cell_background_trampoline::<Self, F> as *const (),
980                )),
981                Box_::into_raw(f),
982            )
983        }
984    }
985
986    #[doc(alias = "cell-background-rgba")]
987    fn connect_cell_background_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
988        unsafe extern "C" fn notify_cell_background_rgba_trampoline<
989            P: IsA<CellRenderer>,
990            F: Fn(&P) + 'static,
991        >(
992            this: *mut ffi::GtkCellRenderer,
993            _param_spec: glib::ffi::gpointer,
994            f: glib::ffi::gpointer,
995        ) {
996            let f: &F = &*(f as *const F);
997            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
998        }
999        unsafe {
1000            let f: Box_<F> = Box_::new(f);
1001            connect_raw(
1002                self.as_ptr() as *mut _,
1003                b"notify::cell-background-rgba\0".as_ptr() as *const _,
1004                Some(transmute::<_, unsafe extern "C" fn()>(
1005                    notify_cell_background_rgba_trampoline::<Self, F> as *const (),
1006                )),
1007                Box_::into_raw(f),
1008            )
1009        }
1010    }
1011
1012    #[doc(alias = "cell-background-set")]
1013    fn connect_cell_background_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1014        unsafe extern "C" fn notify_cell_background_set_trampoline<
1015            P: IsA<CellRenderer>,
1016            F: Fn(&P) + 'static,
1017        >(
1018            this: *mut ffi::GtkCellRenderer,
1019            _param_spec: glib::ffi::gpointer,
1020            f: glib::ffi::gpointer,
1021        ) {
1022            let f: &F = &*(f as *const F);
1023            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1024        }
1025        unsafe {
1026            let f: Box_<F> = Box_::new(f);
1027            connect_raw(
1028                self.as_ptr() as *mut _,
1029                b"notify::cell-background-set\0".as_ptr() as *const _,
1030                Some(transmute::<_, unsafe extern "C" fn()>(
1031                    notify_cell_background_set_trampoline::<Self, F> as *const (),
1032                )),
1033                Box_::into_raw(f),
1034            )
1035        }
1036    }
1037
1038    #[doc(alias = "editing")]
1039    fn connect_editing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1040        unsafe extern "C" fn notify_editing_trampoline<
1041            P: IsA<CellRenderer>,
1042            F: Fn(&P) + 'static,
1043        >(
1044            this: *mut ffi::GtkCellRenderer,
1045            _param_spec: glib::ffi::gpointer,
1046            f: glib::ffi::gpointer,
1047        ) {
1048            let f: &F = &*(f as *const F);
1049            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1050        }
1051        unsafe {
1052            let f: Box_<F> = Box_::new(f);
1053            connect_raw(
1054                self.as_ptr() as *mut _,
1055                b"notify::editing\0".as_ptr() as *const _,
1056                Some(transmute::<_, unsafe extern "C" fn()>(
1057                    notify_editing_trampoline::<Self, F> as *const (),
1058                )),
1059                Box_::into_raw(f),
1060            )
1061        }
1062    }
1063
1064    #[doc(alias = "height")]
1065    fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1066        unsafe extern "C" fn notify_height_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1067            this: *mut ffi::GtkCellRenderer,
1068            _param_spec: glib::ffi::gpointer,
1069            f: glib::ffi::gpointer,
1070        ) {
1071            let f: &F = &*(f as *const F);
1072            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1073        }
1074        unsafe {
1075            let f: Box_<F> = Box_::new(f);
1076            connect_raw(
1077                self.as_ptr() as *mut _,
1078                b"notify::height\0".as_ptr() as *const _,
1079                Some(transmute::<_, unsafe extern "C" fn()>(
1080                    notify_height_trampoline::<Self, F> as *const (),
1081                )),
1082                Box_::into_raw(f),
1083            )
1084        }
1085    }
1086
1087    #[doc(alias = "is-expanded")]
1088    fn connect_is_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1089        unsafe extern "C" fn notify_is_expanded_trampoline<
1090            P: IsA<CellRenderer>,
1091            F: Fn(&P) + 'static,
1092        >(
1093            this: *mut ffi::GtkCellRenderer,
1094            _param_spec: glib::ffi::gpointer,
1095            f: glib::ffi::gpointer,
1096        ) {
1097            let f: &F = &*(f as *const F);
1098            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1099        }
1100        unsafe {
1101            let f: Box_<F> = Box_::new(f);
1102            connect_raw(
1103                self.as_ptr() as *mut _,
1104                b"notify::is-expanded\0".as_ptr() as *const _,
1105                Some(transmute::<_, unsafe extern "C" fn()>(
1106                    notify_is_expanded_trampoline::<Self, F> as *const (),
1107                )),
1108                Box_::into_raw(f),
1109            )
1110        }
1111    }
1112
1113    #[doc(alias = "is-expander")]
1114    fn connect_is_expander_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1115        unsafe extern "C" fn notify_is_expander_trampoline<
1116            P: IsA<CellRenderer>,
1117            F: Fn(&P) + 'static,
1118        >(
1119            this: *mut ffi::GtkCellRenderer,
1120            _param_spec: glib::ffi::gpointer,
1121            f: glib::ffi::gpointer,
1122        ) {
1123            let f: &F = &*(f as *const F);
1124            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1125        }
1126        unsafe {
1127            let f: Box_<F> = Box_::new(f);
1128            connect_raw(
1129                self.as_ptr() as *mut _,
1130                b"notify::is-expander\0".as_ptr() as *const _,
1131                Some(transmute::<_, unsafe extern "C" fn()>(
1132                    notify_is_expander_trampoline::<Self, F> as *const (),
1133                )),
1134                Box_::into_raw(f),
1135            )
1136        }
1137    }
1138
1139    #[doc(alias = "mode")]
1140    fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1141        unsafe extern "C" fn notify_mode_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1142            this: *mut ffi::GtkCellRenderer,
1143            _param_spec: glib::ffi::gpointer,
1144            f: glib::ffi::gpointer,
1145        ) {
1146            let f: &F = &*(f as *const F);
1147            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1148        }
1149        unsafe {
1150            let f: Box_<F> = Box_::new(f);
1151            connect_raw(
1152                self.as_ptr() as *mut _,
1153                b"notify::mode\0".as_ptr() as *const _,
1154                Some(transmute::<_, unsafe extern "C" fn()>(
1155                    notify_mode_trampoline::<Self, F> as *const (),
1156                )),
1157                Box_::into_raw(f),
1158            )
1159        }
1160    }
1161
1162    #[doc(alias = "sensitive")]
1163    fn connect_sensitive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1164        unsafe extern "C" fn notify_sensitive_trampoline<
1165            P: IsA<CellRenderer>,
1166            F: Fn(&P) + 'static,
1167        >(
1168            this: *mut ffi::GtkCellRenderer,
1169            _param_spec: glib::ffi::gpointer,
1170            f: glib::ffi::gpointer,
1171        ) {
1172            let f: &F = &*(f as *const F);
1173            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1174        }
1175        unsafe {
1176            let f: Box_<F> = Box_::new(f);
1177            connect_raw(
1178                self.as_ptr() as *mut _,
1179                b"notify::sensitive\0".as_ptr() as *const _,
1180                Some(transmute::<_, unsafe extern "C" fn()>(
1181                    notify_sensitive_trampoline::<Self, F> as *const (),
1182                )),
1183                Box_::into_raw(f),
1184            )
1185        }
1186    }
1187
1188    #[doc(alias = "visible")]
1189    fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1190        unsafe extern "C" fn notify_visible_trampoline<
1191            P: IsA<CellRenderer>,
1192            F: Fn(&P) + 'static,
1193        >(
1194            this: *mut ffi::GtkCellRenderer,
1195            _param_spec: glib::ffi::gpointer,
1196            f: glib::ffi::gpointer,
1197        ) {
1198            let f: &F = &*(f as *const F);
1199            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1200        }
1201        unsafe {
1202            let f: Box_<F> = Box_::new(f);
1203            connect_raw(
1204                self.as_ptr() as *mut _,
1205                b"notify::visible\0".as_ptr() as *const _,
1206                Some(transmute::<_, unsafe extern "C" fn()>(
1207                    notify_visible_trampoline::<Self, F> as *const (),
1208                )),
1209                Box_::into_raw(f),
1210            )
1211        }
1212    }
1213
1214    #[doc(alias = "width")]
1215    fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1216        unsafe extern "C" fn notify_width_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1217            this: *mut ffi::GtkCellRenderer,
1218            _param_spec: glib::ffi::gpointer,
1219            f: glib::ffi::gpointer,
1220        ) {
1221            let f: &F = &*(f as *const F);
1222            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1223        }
1224        unsafe {
1225            let f: Box_<F> = Box_::new(f);
1226            connect_raw(
1227                self.as_ptr() as *mut _,
1228                b"notify::width\0".as_ptr() as *const _,
1229                Some(transmute::<_, unsafe extern "C" fn()>(
1230                    notify_width_trampoline::<Self, F> as *const (),
1231                )),
1232                Box_::into_raw(f),
1233            )
1234        }
1235    }
1236
1237    #[doc(alias = "xalign")]
1238    fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1239        unsafe extern "C" fn notify_xalign_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1240            this: *mut ffi::GtkCellRenderer,
1241            _param_spec: glib::ffi::gpointer,
1242            f: glib::ffi::gpointer,
1243        ) {
1244            let f: &F = &*(f as *const F);
1245            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1246        }
1247        unsafe {
1248            let f: Box_<F> = Box_::new(f);
1249            connect_raw(
1250                self.as_ptr() as *mut _,
1251                b"notify::xalign\0".as_ptr() as *const _,
1252                Some(transmute::<_, unsafe extern "C" fn()>(
1253                    notify_xalign_trampoline::<Self, F> as *const (),
1254                )),
1255                Box_::into_raw(f),
1256            )
1257        }
1258    }
1259
1260    #[doc(alias = "xpad")]
1261    fn connect_xpad_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1262        unsafe extern "C" fn notify_xpad_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1263            this: *mut ffi::GtkCellRenderer,
1264            _param_spec: glib::ffi::gpointer,
1265            f: glib::ffi::gpointer,
1266        ) {
1267            let f: &F = &*(f as *const F);
1268            f(CellRenderer::from_glib_borrow(this).unsafe_cast_ref())
1269        }
1270        unsafe {
1271            let f: Box_<F> = Box_::new(f);
1272            connect_raw(
1273                self.as_ptr() as *mut _,
1274                b"notify::xpad\0".as_ptr() as *const _,
1275                Some(transmute::<_, unsafe extern "C" fn()>(
1276                    notify_xpad_trampoline::<Self, F> as *const (),
1277                )),
1278                Box_::into_raw(f),
1279            )
1280        }
1281    }
1282
1283    #[doc(alias = "yalign")]
1284    fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1285        unsafe extern "C" fn notify_yalign_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
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                b"notify::yalign\0".as_ptr() as *const _,
1298                Some(transmute::<_, unsafe extern "C" fn()>(
1299                    notify_yalign_trampoline::<Self, F> as *const (),
1300                )),
1301                Box_::into_raw(f),
1302            )
1303        }
1304    }
1305
1306    #[doc(alias = "ypad")]
1307    fn connect_ypad_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1308        unsafe extern "C" fn notify_ypad_trampoline<P: IsA<CellRenderer>, F: Fn(&P) + 'static>(
1309            this: *mut ffi::GtkCellRenderer,
1310            _param_spec: glib::ffi::gpointer,
1311            f: glib::ffi::gpointer,
1312        ) {
1313            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                b"notify::ypad\0".as_ptr() as *const _,
1321                Some(transmute::<_, unsafe extern "C" fn()>(
1322                    notify_ypad_trampoline::<Self, F> as *const (),
1323                )),
1324                Box_::into_raw(f),
1325            )
1326        }
1327    }
1328}
1329
1330impl<O: IsA<CellRenderer>> CellRendererExt for O {}
1331
1332impl fmt::Display for CellRenderer {
1333    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1334        f.write_str("CellRenderer")
1335    }
1336}