Skip to main content

gtk/auto/
cell_area.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    Buildable, CellAreaContext, CellEditable, CellLayout, CellRenderer, CellRendererState,
7    DirectionType, Orientation, SizeRequestMode, TreeIter, TreeModel, 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    /// iter);
19    ///  }
20    ///  }
21    ///  }
22    ///  }
23    ///  return have_focus;
24    /// }
25    /// ]|
26    ///
27    /// Note that the layouting widget is responsible for matching the
28    /// GtkDirectionType values to the way it lays out its cells.
29    ///
30    /// # Cell Properties
31    ///
32    /// The [`CellArea`][crate::CellArea] introduces cell properties for `GtkCellRenderers`
33    /// in very much the same way that [`Container`][crate::Container] introduces
34    /// [child properties][child-properties]
35    /// for `GtkWidgets`. This provides some general interfaces for defining
36    /// the relationship cell areas have with their cells. For instance in a
37    /// [`CellAreaBox`][crate::CellAreaBox] a cell might “expand” and receive extra space when
38    /// the area is allocated more than its full natural request, or a cell
39    /// might be configured to “align” with adjacent rows which were requested
40    /// and rendered with the same [`CellAreaContext`][crate::CellAreaContext].
41    ///
42    /// Use `gtk_cell_area_class_install_cell_property()` to install cell
43    /// properties for a cell area class and `gtk_cell_area_class_find_cell_property()`
44    /// or `gtk_cell_area_class_list_cell_properties()` to get information about
45    /// existing cell properties.
46    ///
47    /// To set the value of a cell property, use [`CellAreaExt::cell_set_property()`][crate::prelude::CellAreaExt::cell_set_property()],
48    /// `gtk_cell_area_cell_set()` or `gtk_cell_area_cell_set_valist()`. To obtain
49    /// the value of a cell property, use [`CellAreaExt::cell_get_property()`][crate::prelude::CellAreaExt::cell_get_property()],
50    /// `gtk_cell_area_cell_get()` or `gtk_cell_area_cell_get_valist()`.
51    ///
52    /// This is an Abstract Base Class, you cannot instantiate it.
53    ///
54    /// ## Properties
55    ///
56    ///
57    /// #### `edit-widget`
58    ///  The widget currently editing the edited cell
59    ///
60    /// This property is read-only and only changes as
61    /// a result of a call [`CellAreaExt::activate_cell()`][crate::prelude::CellAreaExt::activate_cell()].
62    ///
63    /// Readable
64    ///
65    ///
66    /// #### `edited-cell`
67    ///  The cell in the area that is currently edited
68    ///
69    /// This property is read-only and only changes as
70    /// a result of a call [`CellAreaExt::activate_cell()`][crate::prelude::CellAreaExt::activate_cell()].
71    ///
72    /// Readable
73    ///
74    ///
75    /// #### `focus-cell`
76    ///  The cell in the area that currently has focus
77    ///
78    /// Readable | Writable
79    ///
80    /// ## Signals
81    ///
82    ///
83    /// #### `add-editable`
84    ///  Indicates that editing has started on `renderer` and that `editable`
85    /// should be added to the owning cell-layouting widget at `cell_area`.
86    ///
87    ///
88    ///
89    ///
90    /// #### `apply-attributes`
91    ///  This signal is emitted whenever applying attributes to `area` from `model`
92    ///
93    ///
94    ///
95    ///
96    /// #### `focus-changed`
97    ///  Indicates that focus changed on this `area`. This signal
98    /// is emitted either as a result of focus handling or event
99    /// handling.
100    ///
101    /// It's possible that the signal is emitted even if the
102    /// currently focused renderer did not change, this is
103    /// because focus may change to the same renderer in the
104    /// same cell area for a different row of data.
105    ///
106    ///
107    ///
108    ///
109    /// #### `remove-editable`
110    ///  Indicates that editing finished on `renderer` and that `editable`
111    /// should be removed from the owning cell-layouting widget.
112    ///
113    ///
114    ///
115    /// # Implements
116    ///
117    /// [`CellAreaExt`][trait@crate::prelude::CellAreaExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`CellLayoutExt`][trait@crate::prelude::CellLayoutExt], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
118    #[doc(alias = "GtkCellArea")]
119    pub struct CellArea(Object<ffi::GtkCellArea, ffi::GtkCellAreaClass>) @implements Buildable, CellLayout;
120
121    match fn {
122        type_ => || ffi::gtk_cell_area_get_type(),
123    }
124}
125
126impl CellArea {
127    pub const NONE: Option<&'static CellArea> = None;
128}
129
130/// Trait containing all [`struct@CellArea`] methods.
131///
132/// # Implementors
133///
134/// [`CellAreaBox`][struct@crate::CellAreaBox], [`CellArea`][struct@crate::CellArea]
135pub trait CellAreaExt: IsA<CellArea> + 'static {
136    /// Activates `self`, usually by activating the currently focused
137    /// cell, however some subclasses which embed widgets in the area
138    /// can also activate a widget if it currently has the focus.
139    /// ## `context`
140    /// the [`CellAreaContext`][crate::CellAreaContext] in context with the current row data
141    /// ## `widget`
142    /// the [`Widget`][crate::Widget] that `self` is rendering on
143    /// ## `cell_area`
144    /// the size and location of `self` relative to `widget`’s allocation
145    /// ## `flags`
146    /// the [`CellRendererState`][crate::CellRendererState] flags for `self` for this row of data.
147    /// ## `edit_only`
148    /// if [`true`] then only cell renderers that are [`CellRendererMode::Editable`][crate::CellRendererMode::Editable]
149    ///  will be activated.
150    ///
151    /// # Returns
152    ///
153    /// Whether `self` was successfully activated.
154    #[doc(alias = "gtk_cell_area_activate")]
155    fn activate(
156        &self,
157        context: &impl IsA<CellAreaContext>,
158        widget: &impl IsA<Widget>,
159        cell_area: &gdk::Rectangle,
160        flags: CellRendererState,
161        edit_only: bool,
162    ) -> bool {
163        unsafe {
164            from_glib(ffi::gtk_cell_area_activate(
165                self.as_ref().to_glib_none().0,
166                context.as_ref().to_glib_none().0,
167                widget.as_ref().to_glib_none().0,
168                cell_area.to_glib_none().0,
169                flags.into_glib(),
170                edit_only.into_glib(),
171            ))
172        }
173    }
174
175    /// `activate()`
176    /// implementation.
177    /// ## `widget`
178    /// the [`Widget`][crate::Widget] that `self` is rendering onto
179    /// ## `renderer`
180    /// the [`CellRenderer`][crate::CellRenderer] in `self` to activate
181    /// ## `event`
182    /// the `GdkEvent` for which cell activation should occur
183    /// ## `cell_area`
184    /// the [`gdk::Rectangle`][crate::gdk::Rectangle] in `widget` relative coordinates
185    ///  of `renderer` for the current row.
186    /// ## `flags`
187    /// the [`CellRendererState`][crate::CellRendererState] for `renderer`
188    ///
189    /// # Returns
190    ///
191    /// whether cell activation was successful
192    #[doc(alias = "gtk_cell_area_activate_cell")]
193    fn activate_cell(
194        &self,
195        widget: &impl IsA<Widget>,
196        renderer: &impl IsA<CellRenderer>,
197        event: &gdk::Event,
198        cell_area: &gdk::Rectangle,
199        flags: CellRendererState,
200    ) -> bool {
201        unsafe {
202            from_glib(ffi::gtk_cell_area_activate_cell(
203                self.as_ref().to_glib_none().0,
204                widget.as_ref().to_glib_none().0,
205                renderer.as_ref().to_glib_none().0,
206                mut_override(event.to_glib_none().0),
207                cell_area.to_glib_none().0,
208                flags.into_glib(),
209            ))
210        }
211    }
212
213    /// Adds `renderer` to `self` with the default child cell properties.
214    /// ## `renderer`
215    /// the [`CellRenderer`][crate::CellRenderer] to add to `self`
216    #[doc(alias = "gtk_cell_area_add")]
217    fn add(&self, renderer: &impl IsA<CellRenderer>) {
218        unsafe {
219            ffi::gtk_cell_area_add(
220                self.as_ref().to_glib_none().0,
221                renderer.as_ref().to_glib_none().0,
222            );
223        }
224    }
225
226    /// Adds `sibling` to `renderer`’s focusable area, focus will be drawn
227    /// around `renderer` and all of its siblings if `renderer` can
228    /// focus for a given row.
229    ///
230    /// Events handled by focus siblings can also activate the given
231    /// focusable `renderer`.
232    /// ## `renderer`
233    /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
234    /// ## `sibling`
235    /// the [`CellRenderer`][crate::CellRenderer] to add to `renderer`’s focus area
236    #[doc(alias = "gtk_cell_area_add_focus_sibling")]
237    fn add_focus_sibling(
238        &self,
239        renderer: &impl IsA<CellRenderer>,
240        sibling: &impl IsA<CellRenderer>,
241    ) {
242        unsafe {
243            ffi::gtk_cell_area_add_focus_sibling(
244                self.as_ref().to_glib_none().0,
245                renderer.as_ref().to_glib_none().0,
246                sibling.as_ref().to_glib_none().0,
247            );
248        }
249    }
250
251    //#[doc(alias = "gtk_cell_area_add_with_properties")]
252    //fn add_with_properties(&self, renderer: &impl IsA<CellRenderer>, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
253    //    unsafe { TODO: call ffi:gtk_cell_area_add_with_properties() }
254    //}
255
256    /// Applies any connected attributes to the renderers in
257    /// `self` by pulling the values from `tree_model`.
258    /// ## `tree_model`
259    /// the [`TreeModel`][crate::TreeModel] to pull values from
260    /// ## `iter`
261    /// the [`TreeIter`][crate::TreeIter] in `tree_model` to apply values for
262    /// ## `is_expander`
263    /// whether `iter` has children
264    /// ## `is_expanded`
265    /// whether `iter` is expanded in the view and
266    ///  children are visible
267    #[doc(alias = "gtk_cell_area_apply_attributes")]
268    fn apply_attributes(
269        &self,
270        tree_model: &impl IsA<TreeModel>,
271        iter: &TreeIter,
272        is_expander: bool,
273        is_expanded: bool,
274    ) {
275        unsafe {
276            ffi::gtk_cell_area_apply_attributes(
277                self.as_ref().to_glib_none().0,
278                tree_model.as_ref().to_glib_none().0,
279                mut_override(iter.to_glib_none().0),
280                is_expander.into_glib(),
281                is_expanded.into_glib(),
282            );
283        }
284    }
285
286    /// Connects an `attribute` to apply values from `column` for the
287    /// [`TreeModel`][crate::TreeModel] in use.
288    /// ## `renderer`
289    /// the [`CellRenderer`][crate::CellRenderer] to connect an attribute for
290    /// ## `attribute`
291    /// the attribute name
292    /// ## `column`
293    /// the [`TreeModel`][crate::TreeModel] column to fetch attribute values from
294    #[doc(alias = "gtk_cell_area_attribute_connect")]
295    fn attribute_connect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str, column: i32) {
296        unsafe {
297            ffi::gtk_cell_area_attribute_connect(
298                self.as_ref().to_glib_none().0,
299                renderer.as_ref().to_glib_none().0,
300                attribute.to_glib_none().0,
301                column,
302            );
303        }
304    }
305
306    /// Disconnects `attribute` for the `renderer` in `self` so that
307    /// attribute will no longer be updated with values from the
308    /// model.
309    /// ## `renderer`
310    /// the [`CellRenderer`][crate::CellRenderer] to disconnect an attribute for
311    /// ## `attribute`
312    /// the attribute name
313    #[doc(alias = "gtk_cell_area_attribute_disconnect")]
314    fn attribute_disconnect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) {
315        unsafe {
316            ffi::gtk_cell_area_attribute_disconnect(
317                self.as_ref().to_glib_none().0,
318                renderer.as_ref().to_glib_none().0,
319                attribute.to_glib_none().0,
320            );
321        }
322    }
323
324    /// Returns the model column that an attribute has been mapped to,
325    /// or -1 if the attribute is not mapped.
326    /// ## `renderer`
327    /// a [`CellRenderer`][crate::CellRenderer]
328    /// ## `attribute`
329    /// an attribute on the renderer
330    ///
331    /// # Returns
332    ///
333    /// the model column, or -1
334    #[doc(alias = "gtk_cell_area_attribute_get_column")]
335    fn attribute_get_column(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) -> i32 {
336        unsafe {
337            ffi::gtk_cell_area_attribute_get_column(
338                self.as_ref().to_glib_none().0,
339                renderer.as_ref().to_glib_none().0,
340                attribute.to_glib_none().0,
341            )
342        }
343    }
344
345    //#[doc(alias = "gtk_cell_area_cell_get")]
346    //fn cell_get(&self, renderer: &impl IsA<CellRenderer>, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
347    //    unsafe { TODO: call ffi:gtk_cell_area_cell_get() }
348    //}
349
350    /// Gets the value of a cell property for `renderer` in `self`.
351    /// ## `renderer`
352    /// a [`CellRenderer`][crate::CellRenderer] inside `self`
353    /// ## `property_name`
354    /// the name of the property to get
355    ///
356    /// # Returns
357    ///
358    ///
359    /// ## `value`
360    /// a location to return the value
361    #[doc(alias = "gtk_cell_area_cell_get_property")]
362    fn cell_get_property(
363        &self,
364        renderer: &impl IsA<CellRenderer>,
365        property_name: &str,
366    ) -> glib::Value {
367        unsafe {
368            let mut value = glib::Value::uninitialized();
369            ffi::gtk_cell_area_cell_get_property(
370                self.as_ref().to_glib_none().0,
371                renderer.as_ref().to_glib_none().0,
372                property_name.to_glib_none().0,
373                value.to_glib_none_mut().0,
374            );
375            value
376        }
377    }
378
379    //#[doc(alias = "gtk_cell_area_cell_get_valist")]
380    //fn cell_get_valist(&self, renderer: &impl IsA<CellRenderer>, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
381    //    unsafe { TODO: call ffi:gtk_cell_area_cell_get_valist() }
382    //}
383
384    //#[doc(alias = "gtk_cell_area_cell_set")]
385    //fn cell_set(&self, renderer: &impl IsA<CellRenderer>, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
386    //    unsafe { TODO: call ffi:gtk_cell_area_cell_set() }
387    //}
388
389    /// Sets a cell property for `renderer` in `self`.
390    /// ## `renderer`
391    /// a [`CellRenderer`][crate::CellRenderer] inside `self`
392    /// ## `property_name`
393    /// the name of the cell property to set
394    /// ## `value`
395    /// the value to set the cell property to
396    #[doc(alias = "gtk_cell_area_cell_set_property")]
397    fn cell_set_property(
398        &self,
399        renderer: &impl IsA<CellRenderer>,
400        property_name: &str,
401        value: &glib::Value,
402    ) {
403        unsafe {
404            ffi::gtk_cell_area_cell_set_property(
405                self.as_ref().to_glib_none().0,
406                renderer.as_ref().to_glib_none().0,
407                property_name.to_glib_none().0,
408                value.to_glib_none().0,
409            );
410        }
411    }
412
413    //#[doc(alias = "gtk_cell_area_cell_set_valist")]
414    //fn cell_set_valist(&self, renderer: &impl IsA<CellRenderer>, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
415    //    unsafe { TODO: call ffi:gtk_cell_area_cell_set_valist() }
416    //}
417
418    /// This is sometimes needed for cases where rows need to share
419    /// alignments in one orientation but may be separately grouped
420    /// in the opposing orientation.
421    ///
422    /// For instance, [`IconView`][crate::IconView] creates all icons (rows) to have
423    /// the same width and the cells theirin to have the same
424    /// horizontal alignments. However each row of icons may have
425    /// a separate collective height. [`IconView`][crate::IconView] uses this to
426    /// request the heights of each row based on a context which
427    /// was already used to request all the row widths that are
428    /// to be displayed.
429    /// ## `context`
430    /// the [`CellAreaContext`][crate::CellAreaContext] to copy
431    ///
432    /// # Returns
433    ///
434    /// a newly created [`CellAreaContext`][crate::CellAreaContext] copy of `context`.
435    #[doc(alias = "gtk_cell_area_copy_context")]
436    fn copy_context(&self, context: &impl IsA<CellAreaContext>) -> Option<CellAreaContext> {
437        unsafe {
438            from_glib_full(ffi::gtk_cell_area_copy_context(
439                self.as_ref().to_glib_none().0,
440                context.as_ref().to_glib_none().0,
441            ))
442        }
443    }
444
445    /// Creates a [`CellAreaContext`][crate::CellAreaContext] to be used with `self` for
446    /// all purposes. [`CellAreaContext`][crate::CellAreaContext] stores geometry information
447    /// for rows for which it was operated on, it is important to use
448    /// the same context for the same row of data at all times (i.e.
449    /// one should render and handle events with the same [`CellAreaContext`][crate::CellAreaContext]
450    /// which was used to request the size of those rows of data).
451    ///
452    /// # Returns
453    ///
454    /// a newly created [`CellAreaContext`][crate::CellAreaContext] which can be used with `self`.
455    #[doc(alias = "gtk_cell_area_create_context")]
456    fn create_context(&self) -> Option<CellAreaContext> {
457        unsafe {
458            from_glib_full(ffi::gtk_cell_area_create_context(
459                self.as_ref().to_glib_none().0,
460            ))
461        }
462    }
463
464    /// Delegates event handling to a [`CellArea`][crate::CellArea].
465    /// ## `context`
466    /// the [`CellAreaContext`][crate::CellAreaContext] for this row of data.
467    /// ## `widget`
468    /// the [`Widget`][crate::Widget] that `self` is rendering to
469    /// ## `event`
470    /// the `GdkEvent` to handle
471    /// ## `cell_area`
472    /// the `widget` relative coordinates for `self`
473    /// ## `flags`
474    /// the [`CellRendererState`][crate::CellRendererState] for `self` in this row.
475    ///
476    /// # Returns
477    ///
478    /// [`true`] if the event was handled by `self`.
479    #[doc(alias = "gtk_cell_area_event")]
480    fn event(
481        &self,
482        context: &impl IsA<CellAreaContext>,
483        widget: &impl IsA<Widget>,
484        event: &gdk::Event,
485        cell_area: &gdk::Rectangle,
486        flags: CellRendererState,
487    ) -> i32 {
488        unsafe {
489            ffi::gtk_cell_area_event(
490                self.as_ref().to_glib_none().0,
491                context.as_ref().to_glib_none().0,
492                widget.as_ref().to_glib_none().0,
493                mut_override(event.to_glib_none().0),
494                cell_area.to_glib_none().0,
495                flags.into_glib(),
496            )
497        }
498    }
499
500    /// This should be called by the `self`’s owning layout widget
501    /// when focus is to be passed to `self`, or moved within `self`
502    /// for a given `direction` and row data.
503    ///
504    /// Implementing [`CellArea`][crate::CellArea] classes should implement this
505    /// method to receive and navigate focus in its own way particular
506    /// to how it lays out cells.
507    /// ## `direction`
508    /// the [`DirectionType`][crate::DirectionType]
509    ///
510    /// # Returns
511    ///
512    /// [`true`] if focus remains inside `self` as a result of this call.
513    #[doc(alias = "gtk_cell_area_focus")]
514    fn focus(&self, direction: DirectionType) -> bool {
515        unsafe {
516            from_glib(ffi::gtk_cell_area_focus(
517                self.as_ref().to_glib_none().0,
518                direction.into_glib(),
519            ))
520        }
521    }
522
523    /// Calls `callback` for every [`CellRenderer`][crate::CellRenderer] in `self`.
524    /// ## `callback`
525    /// the `GtkCellCallback` to call
526    /// ## `callback_data`
527    /// user provided data pointer
528    #[doc(alias = "gtk_cell_area_foreach")]
529    fn foreach<P: FnMut(&CellRenderer) -> bool>(&self, callback: P) {
530        let mut callback_data: P = callback;
531        unsafe extern "C" fn callback_func<P: FnMut(&CellRenderer) -> bool>(
532            renderer: *mut ffi::GtkCellRenderer,
533            data: glib::ffi::gpointer,
534        ) -> glib::ffi::gboolean {
535            unsafe {
536                let renderer = from_glib_borrow(renderer);
537                let callback = data as *mut P;
538                (*callback)(&renderer).into_glib()
539            }
540        }
541        let callback = Some(callback_func::<P> as _);
542        let super_callback0: &mut P = &mut callback_data;
543        unsafe {
544            ffi::gtk_cell_area_foreach(
545                self.as_ref().to_glib_none().0,
546                callback,
547                super_callback0 as *mut _ as *mut _,
548            );
549        }
550    }
551
552    /// Calls `callback` for every [`CellRenderer`][crate::CellRenderer] in `self` with the
553    /// allocated rectangle inside `cell_area`.
554    /// ## `context`
555    /// the [`CellAreaContext`][crate::CellAreaContext] for this row of data.
556    /// ## `widget`
557    /// the [`Widget`][crate::Widget] that `self` is rendering to
558    /// ## `cell_area`
559    /// the `widget` relative coordinates and size for `self`
560    /// ## `background_area`
561    /// the `widget` relative coordinates of the background area
562    /// ## `callback`
563    /// the `GtkCellAllocCallback` to call
564    /// ## `callback_data`
565    /// user provided data pointer
566    #[doc(alias = "gtk_cell_area_foreach_alloc")]
567    fn foreach_alloc<P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool>(
568        &self,
569        context: &impl IsA<CellAreaContext>,
570        widget: &impl IsA<Widget>,
571        cell_area: &gdk::Rectangle,
572        background_area: &gdk::Rectangle,
573        callback: P,
574    ) {
575        let mut callback_data: P = callback;
576        unsafe extern "C" fn callback_func<
577            P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool,
578        >(
579            renderer: *mut ffi::GtkCellRenderer,
580            cell_area: *const gdk::ffi::GdkRectangle,
581            cell_background: *const gdk::ffi::GdkRectangle,
582            data: glib::ffi::gpointer,
583        ) -> glib::ffi::gboolean {
584            unsafe {
585                let renderer = from_glib_borrow(renderer);
586                let cell_area = from_glib_borrow(cell_area);
587                let cell_background = from_glib_borrow(cell_background);
588                let callback = data as *mut P;
589                (*callback)(&renderer, &cell_area, &cell_background).into_glib()
590            }
591        }
592        let callback = Some(callback_func::<P> as _);
593        let super_callback0: &mut P = &mut callback_data;
594        unsafe {
595            ffi::gtk_cell_area_foreach_alloc(
596                self.as_ref().to_glib_none().0,
597                context.as_ref().to_glib_none().0,
598                widget.as_ref().to_glib_none().0,
599                cell_area.to_glib_none().0,
600                background_area.to_glib_none().0,
601                callback,
602                super_callback0 as *mut _ as *mut _,
603            );
604        }
605    }
606
607    /// Derives the allocation of `renderer` inside `self` if `self`
608    /// were to be renderered in `cell_area`.
609    /// ## `context`
610    /// the [`CellAreaContext`][crate::CellAreaContext] used to hold sizes for `self`.
611    /// ## `widget`
612    /// the [`Widget`][crate::Widget] that `self` is rendering on
613    /// ## `renderer`
614    /// the [`CellRenderer`][crate::CellRenderer] to get the allocation for
615    /// ## `cell_area`
616    /// the whole allocated area for `self` in `widget`
617    ///  for this row
618    ///
619    /// # Returns
620    ///
621    ///
622    /// ## `allocation`
623    /// where to store the allocation for `renderer`
624    #[doc(alias = "gtk_cell_area_get_cell_allocation")]
625    #[doc(alias = "get_cell_allocation")]
626    fn cell_allocation(
627        &self,
628        context: &impl IsA<CellAreaContext>,
629        widget: &impl IsA<Widget>,
630        renderer: &impl IsA<CellRenderer>,
631        cell_area: &gdk::Rectangle,
632    ) -> gdk::Rectangle {
633        unsafe {
634            let mut allocation = gdk::Rectangle::uninitialized();
635            ffi::gtk_cell_area_get_cell_allocation(
636                self.as_ref().to_glib_none().0,
637                context.as_ref().to_glib_none().0,
638                widget.as_ref().to_glib_none().0,
639                renderer.as_ref().to_glib_none().0,
640                cell_area.to_glib_none().0,
641                allocation.to_glib_none_mut().0,
642            );
643            allocation
644        }
645    }
646
647    /// Gets the [`CellRenderer`][crate::CellRenderer] at `x` and `y` coordinates inside `self` and optionally
648    /// returns the full cell allocation for it inside `cell_area`.
649    /// ## `context`
650    /// the [`CellAreaContext`][crate::CellAreaContext] used to hold sizes for `self`.
651    /// ## `widget`
652    /// the [`Widget`][crate::Widget] that `self` is rendering on
653    /// ## `cell_area`
654    /// the whole allocated area for `self` in `widget`
655    ///  for this row
656    /// ## `x`
657    /// the x position
658    /// ## `y`
659    /// the y position
660    ///
661    /// # Returns
662    ///
663    /// the [`CellRenderer`][crate::CellRenderer] at `x` and `y`.
664    ///
665    /// ## `alloc_area`
666    /// where to store the inner allocated area of the
667    ///  returned cell renderer, or [`None`].
668    #[doc(alias = "gtk_cell_area_get_cell_at_position")]
669    #[doc(alias = "get_cell_at_position")]
670    fn cell_at_position(
671        &self,
672        context: &impl IsA<CellAreaContext>,
673        widget: &impl IsA<Widget>,
674        cell_area: &gdk::Rectangle,
675        x: i32,
676        y: i32,
677    ) -> (CellRenderer, gdk::Rectangle) {
678        unsafe {
679            let mut alloc_area = gdk::Rectangle::uninitialized();
680            let ret = from_glib_none(ffi::gtk_cell_area_get_cell_at_position(
681                self.as_ref().to_glib_none().0,
682                context.as_ref().to_glib_none().0,
683                widget.as_ref().to_glib_none().0,
684                cell_area.to_glib_none().0,
685                x,
686                y,
687                alloc_area.to_glib_none_mut().0,
688            ));
689            (ret, alloc_area)
690        }
691    }
692
693    /// Gets the current [`TreePath`][crate::TreePath] string for the currently
694    /// applied [`TreeIter`][crate::TreeIter], this is implicitly updated when
695    /// [`apply_attributes()`][Self::apply_attributes()] is called and can be
696    /// used to interact with renderers from [`CellArea`][crate::CellArea]
697    /// subclasses.
698    ///
699    /// # Returns
700    ///
701    /// The current [`TreePath`][crate::TreePath] string for the current
702    /// attributes applied to `self`. This string belongs to the area and
703    /// should not be freed.
704    #[doc(alias = "gtk_cell_area_get_current_path_string")]
705    #[doc(alias = "get_current_path_string")]
706    fn current_path_string(&self) -> Option<glib::GString> {
707        unsafe {
708            from_glib_none(ffi::gtk_cell_area_get_current_path_string(
709                self.as_ref().to_glib_none().0,
710            ))
711        }
712    }
713
714    /// Gets the [`CellEditable`][crate::CellEditable] widget currently used
715    /// to edit the currently edited cell.
716    ///
717    /// # Returns
718    ///
719    /// The currently active [`CellEditable`][crate::CellEditable] widget
720    #[doc(alias = "gtk_cell_area_get_edit_widget")]
721    #[doc(alias = "get_edit_widget")]
722    #[doc(alias = "edit-widget")]
723    fn edit_widget(&self) -> Option<CellEditable> {
724        unsafe {
725            from_glib_none(ffi::gtk_cell_area_get_edit_widget(
726                self.as_ref().to_glib_none().0,
727            ))
728        }
729    }
730
731    /// Gets the [`CellRenderer`][crate::CellRenderer] in `self` that is currently
732    /// being edited.
733    ///
734    /// # Returns
735    ///
736    /// The currently edited [`CellRenderer`][crate::CellRenderer]
737    #[doc(alias = "gtk_cell_area_get_edited_cell")]
738    #[doc(alias = "get_edited_cell")]
739    #[doc(alias = "edited-cell")]
740    fn edited_cell(&self) -> Option<CellRenderer> {
741        unsafe {
742            from_glib_none(ffi::gtk_cell_area_get_edited_cell(
743                self.as_ref().to_glib_none().0,
744            ))
745        }
746    }
747
748    /// Retrieves the currently focused cell for `self`
749    ///
750    /// # Returns
751    ///
752    /// the currently focused cell in `self`.
753    #[doc(alias = "gtk_cell_area_get_focus_cell")]
754    #[doc(alias = "get_focus_cell")]
755    #[doc(alias = "focus-cell")]
756    fn focus_cell(&self) -> Option<CellRenderer> {
757        unsafe {
758            from_glib_none(ffi::gtk_cell_area_get_focus_cell(
759                self.as_ref().to_glib_none().0,
760            ))
761        }
762    }
763
764    /// Gets the [`CellRenderer`][crate::CellRenderer] which is expected to be focusable
765    /// for which `renderer` is, or may be a sibling.
766    ///
767    /// This is handy for [`CellArea`][crate::CellArea] subclasses when handling events,
768    /// after determining the renderer at the event location it can
769    /// then chose to activate the focus cell for which the event
770    /// cell may have been a sibling.
771    /// ## `renderer`
772    /// the [`CellRenderer`][crate::CellRenderer]
773    ///
774    /// # Returns
775    ///
776    /// the [`CellRenderer`][crate::CellRenderer] for which `renderer`
777    ///  is a sibling, or [`None`].
778    #[doc(alias = "gtk_cell_area_get_focus_from_sibling")]
779    #[doc(alias = "get_focus_from_sibling")]
780    fn focus_from_sibling(&self, renderer: &impl IsA<CellRenderer>) -> Option<CellRenderer> {
781        unsafe {
782            from_glib_none(ffi::gtk_cell_area_get_focus_from_sibling(
783                self.as_ref().to_glib_none().0,
784                renderer.as_ref().to_glib_none().0,
785            ))
786        }
787    }
788
789    /// Gets the focus sibling cell renderers for `renderer`.
790    /// ## `renderer`
791    /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
792    ///
793    /// # Returns
794    ///
795    /// A `GList` of `GtkCellRenderers`.
796    ///  The returned list is internal and should not be freed.
797    #[doc(alias = "gtk_cell_area_get_focus_siblings")]
798    #[doc(alias = "get_focus_siblings")]
799    fn focus_siblings(&self, renderer: &impl IsA<CellRenderer>) -> Vec<CellRenderer> {
800        unsafe {
801            FromGlibPtrContainer::from_glib_none(ffi::gtk_cell_area_get_focus_siblings(
802                self.as_ref().to_glib_none().0,
803                renderer.as_ref().to_glib_none().0,
804            ))
805        }
806    }
807
808    /// Retrieves a cell area’s initial minimum and natural height.
809    ///
810    /// `self` will store some geometrical information in `context` along the way;
811    /// when requesting sizes over an arbitrary number of rows, it’s not important
812    /// to check the `minimum_height` and `natural_height` of this call but rather to
813    /// consult [`CellAreaContextExt::preferred_height()`][crate::prelude::CellAreaContextExt::preferred_height()] after a series of
814    /// requests.
815    /// ## `context`
816    /// the [`CellAreaContext`][crate::CellAreaContext] to perform this request with
817    /// ## `widget`
818    /// the [`Widget`][crate::Widget] where `self` will be rendering
819    ///
820    /// # Returns
821    ///
822    ///
823    /// ## `minimum_height`
824    /// location to store the minimum height, or [`None`]
825    ///
826    /// ## `natural_height`
827    /// location to store the natural height, or [`None`]
828    #[doc(alias = "gtk_cell_area_get_preferred_height")]
829    #[doc(alias = "get_preferred_height")]
830    fn preferred_height(
831        &self,
832        context: &impl IsA<CellAreaContext>,
833        widget: &impl IsA<Widget>,
834    ) -> (i32, i32) {
835        unsafe {
836            let mut minimum_height = std::mem::MaybeUninit::uninit();
837            let mut natural_height = std::mem::MaybeUninit::uninit();
838            ffi::gtk_cell_area_get_preferred_height(
839                self.as_ref().to_glib_none().0,
840                context.as_ref().to_glib_none().0,
841                widget.as_ref().to_glib_none().0,
842                minimum_height.as_mut_ptr(),
843                natural_height.as_mut_ptr(),
844            );
845            (minimum_height.assume_init(), natural_height.assume_init())
846        }
847    }
848
849    /// Retrieves a cell area’s minimum and natural height if it would be given
850    /// the specified `width`.
851    ///
852    /// `self` stores some geometrical information in `context` along the way
853    /// while calling [`preferred_width()`][Self::preferred_width()]. It’s important to
854    /// perform a series of [`preferred_width()`][Self::preferred_width()] requests with
855    /// `context` first and then call [`preferred_height_for_width()`][Self::preferred_height_for_width()]
856    /// on each cell area individually to get the height for width of each
857    /// fully requested row.
858    ///
859    /// If at some point, the width of a single row changes, it should be
860    /// requested with [`preferred_width()`][Self::preferred_width()] again and then
861    /// the full width of the requested rows checked again with
862    /// [`CellAreaContextExt::preferred_width()`][crate::prelude::CellAreaContextExt::preferred_width()].
863    /// ## `context`
864    /// the [`CellAreaContext`][crate::CellAreaContext] which has already been requested for widths.
865    /// ## `widget`
866    /// the [`Widget`][crate::Widget] where `self` will be rendering
867    /// ## `width`
868    /// the width for which to check the height of this area
869    ///
870    /// # Returns
871    ///
872    ///
873    /// ## `minimum_height`
874    /// location to store the minimum height, or [`None`]
875    ///
876    /// ## `natural_height`
877    /// location to store the natural height, or [`None`]
878    #[doc(alias = "gtk_cell_area_get_preferred_height_for_width")]
879    #[doc(alias = "get_preferred_height_for_width")]
880    fn preferred_height_for_width(
881        &self,
882        context: &impl IsA<CellAreaContext>,
883        widget: &impl IsA<Widget>,
884        width: i32,
885    ) -> (i32, i32) {
886        unsafe {
887            let mut minimum_height = std::mem::MaybeUninit::uninit();
888            let mut natural_height = std::mem::MaybeUninit::uninit();
889            ffi::gtk_cell_area_get_preferred_height_for_width(
890                self.as_ref().to_glib_none().0,
891                context.as_ref().to_glib_none().0,
892                widget.as_ref().to_glib_none().0,
893                width,
894                minimum_height.as_mut_ptr(),
895                natural_height.as_mut_ptr(),
896            );
897            (minimum_height.assume_init(), natural_height.assume_init())
898        }
899    }
900
901    /// Retrieves a cell area’s initial minimum and natural width.
902    ///
903    /// `self` will store some geometrical information in `context` along the way;
904    /// when requesting sizes over an arbitrary number of rows, it’s not important
905    /// to check the `minimum_width` and `natural_width` of this call but rather to
906    /// consult [`CellAreaContextExt::preferred_width()`][crate::prelude::CellAreaContextExt::preferred_width()] after a series of
907    /// requests.
908    /// ## `context`
909    /// the [`CellAreaContext`][crate::CellAreaContext] to perform this request with
910    /// ## `widget`
911    /// the [`Widget`][crate::Widget] where `self` will be rendering
912    ///
913    /// # Returns
914    ///
915    ///
916    /// ## `minimum_width`
917    /// location to store the minimum width, or [`None`]
918    ///
919    /// ## `natural_width`
920    /// location to store the natural width, or [`None`]
921    #[doc(alias = "gtk_cell_area_get_preferred_width")]
922    #[doc(alias = "get_preferred_width")]
923    fn preferred_width(
924        &self,
925        context: &impl IsA<CellAreaContext>,
926        widget: &impl IsA<Widget>,
927    ) -> (i32, i32) {
928        unsafe {
929            let mut minimum_width = std::mem::MaybeUninit::uninit();
930            let mut natural_width = std::mem::MaybeUninit::uninit();
931            ffi::gtk_cell_area_get_preferred_width(
932                self.as_ref().to_glib_none().0,
933                context.as_ref().to_glib_none().0,
934                widget.as_ref().to_glib_none().0,
935                minimum_width.as_mut_ptr(),
936                natural_width.as_mut_ptr(),
937            );
938            (minimum_width.assume_init(), natural_width.assume_init())
939        }
940    }
941
942    /// Retrieves a cell area’s minimum and natural width if it would be given
943    /// the specified `height`.
944    ///
945    /// `self` stores some geometrical information in `context` along the way
946    /// while calling [`preferred_height()`][Self::preferred_height()]. It’s important to
947    /// perform a series of [`preferred_height()`][Self::preferred_height()] requests with
948    /// `context` first and then call [`preferred_width_for_height()`][Self::preferred_width_for_height()]
949    /// on each cell area individually to get the height for width of each
950    /// fully requested row.
951    ///
952    /// If at some point, the height of a single row changes, it should be
953    /// requested with [`preferred_height()`][Self::preferred_height()] again and then
954    /// the full height of the requested rows checked again with
955    /// [`CellAreaContextExt::preferred_height()`][crate::prelude::CellAreaContextExt::preferred_height()].
956    /// ## `context`
957    /// the [`CellAreaContext`][crate::CellAreaContext] which has already been requested for widths.
958    /// ## `widget`
959    /// the [`Widget`][crate::Widget] where `self` will be rendering
960    /// ## `height`
961    /// the height for which to check the width of this area
962    ///
963    /// # Returns
964    ///
965    ///
966    /// ## `minimum_width`
967    /// location to store the minimum width, or [`None`]
968    ///
969    /// ## `natural_width`
970    /// location to store the natural width, or [`None`]
971    #[doc(alias = "gtk_cell_area_get_preferred_width_for_height")]
972    #[doc(alias = "get_preferred_width_for_height")]
973    fn preferred_width_for_height(
974        &self,
975        context: &impl IsA<CellAreaContext>,
976        widget: &impl IsA<Widget>,
977        height: i32,
978    ) -> (i32, i32) {
979        unsafe {
980            let mut minimum_width = std::mem::MaybeUninit::uninit();
981            let mut natural_width = std::mem::MaybeUninit::uninit();
982            ffi::gtk_cell_area_get_preferred_width_for_height(
983                self.as_ref().to_glib_none().0,
984                context.as_ref().to_glib_none().0,
985                widget.as_ref().to_glib_none().0,
986                height,
987                minimum_width.as_mut_ptr(),
988                natural_width.as_mut_ptr(),
989            );
990            (minimum_width.assume_init(), natural_width.assume_init())
991        }
992    }
993
994    /// Gets whether the area prefers a height-for-width layout
995    /// or a width-for-height layout.
996    ///
997    /// # Returns
998    ///
999    /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by `self`.
1000    #[doc(alias = "gtk_cell_area_get_request_mode")]
1001    #[doc(alias = "get_request_mode")]
1002    fn request_mode(&self) -> SizeRequestMode {
1003        unsafe {
1004            from_glib(ffi::gtk_cell_area_get_request_mode(
1005                self.as_ref().to_glib_none().0,
1006            ))
1007        }
1008    }
1009
1010    /// Checks if `self` contains `renderer`.
1011    /// ## `renderer`
1012    /// the [`CellRenderer`][crate::CellRenderer] to check
1013    ///
1014    /// # Returns
1015    ///
1016    /// [`true`] if `renderer` is in the `self`.
1017    #[doc(alias = "gtk_cell_area_has_renderer")]
1018    fn has_renderer(&self, renderer: &impl IsA<CellRenderer>) -> bool {
1019        unsafe {
1020            from_glib(ffi::gtk_cell_area_has_renderer(
1021                self.as_ref().to_glib_none().0,
1022                renderer.as_ref().to_glib_none().0,
1023            ))
1024        }
1025    }
1026
1027    /// This is a convenience function for [`CellArea`][crate::CellArea] implementations
1028    /// to get the inner area where a given [`CellRenderer`][crate::CellRenderer] will be
1029    /// rendered. It removes any padding previously added by [`request_renderer()`][Self::request_renderer()].
1030    /// ## `widget`
1031    /// the [`Widget`][crate::Widget] that `self` is rendering onto
1032    /// ## `cell_area`
1033    /// the `widget` relative coordinates where one of `self`’s cells
1034    ///  is to be placed
1035    ///
1036    /// # Returns
1037    ///
1038    ///
1039    /// ## `inner_area`
1040    /// the return location for the inner cell area
1041    #[doc(alias = "gtk_cell_area_inner_cell_area")]
1042    fn inner_cell_area(
1043        &self,
1044        widget: &impl IsA<Widget>,
1045        cell_area: &gdk::Rectangle,
1046    ) -> gdk::Rectangle {
1047        unsafe {
1048            let mut inner_area = gdk::Rectangle::uninitialized();
1049            ffi::gtk_cell_area_inner_cell_area(
1050                self.as_ref().to_glib_none().0,
1051                widget.as_ref().to_glib_none().0,
1052                cell_area.to_glib_none().0,
1053                inner_area.to_glib_none_mut().0,
1054            );
1055            inner_area
1056        }
1057    }
1058
1059    /// Returns whether the area can do anything when activated,
1060    /// after applying new attributes to `self`.
1061    ///
1062    /// # Returns
1063    ///
1064    /// whether `self` can do anything when activated.
1065    #[doc(alias = "gtk_cell_area_is_activatable")]
1066    fn is_activatable(&self) -> bool {
1067        unsafe {
1068            from_glib(ffi::gtk_cell_area_is_activatable(
1069                self.as_ref().to_glib_none().0,
1070            ))
1071        }
1072    }
1073
1074    /// Returns whether `sibling` is one of `renderer`’s focus siblings
1075    /// (see [`add_focus_sibling()`][Self::add_focus_sibling()]).
1076    /// ## `renderer`
1077    /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
1078    /// ## `sibling`
1079    /// the [`CellRenderer`][crate::CellRenderer] to check against `renderer`’s sibling list
1080    ///
1081    /// # Returns
1082    ///
1083    /// [`true`] if `sibling` is a focus sibling of `renderer`
1084    #[doc(alias = "gtk_cell_area_is_focus_sibling")]
1085    fn is_focus_sibling(
1086        &self,
1087        renderer: &impl IsA<CellRenderer>,
1088        sibling: &impl IsA<CellRenderer>,
1089    ) -> bool {
1090        unsafe {
1091            from_glib(ffi::gtk_cell_area_is_focus_sibling(
1092                self.as_ref().to_glib_none().0,
1093                renderer.as_ref().to_glib_none().0,
1094                sibling.as_ref().to_glib_none().0,
1095            ))
1096        }
1097    }
1098
1099    /// Removes `renderer` from `self`.
1100    /// ## `renderer`
1101    /// the [`CellRenderer`][crate::CellRenderer] to remove from `self`
1102    #[doc(alias = "gtk_cell_area_remove")]
1103    fn remove(&self, renderer: &impl IsA<CellRenderer>) {
1104        unsafe {
1105            ffi::gtk_cell_area_remove(
1106                self.as_ref().to_glib_none().0,
1107                renderer.as_ref().to_glib_none().0,
1108            );
1109        }
1110    }
1111
1112    /// Removes `sibling` from `renderer`’s focus sibling list
1113    /// (see [`add_focus_sibling()`][Self::add_focus_sibling()]).
1114    /// ## `renderer`
1115    /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
1116    /// ## `sibling`
1117    /// the [`CellRenderer`][crate::CellRenderer] to remove from `renderer`’s focus area
1118    #[doc(alias = "gtk_cell_area_remove_focus_sibling")]
1119    fn remove_focus_sibling(
1120        &self,
1121        renderer: &impl IsA<CellRenderer>,
1122        sibling: &impl IsA<CellRenderer>,
1123    ) {
1124        unsafe {
1125            ffi::gtk_cell_area_remove_focus_sibling(
1126                self.as_ref().to_glib_none().0,
1127                renderer.as_ref().to_glib_none().0,
1128                sibling.as_ref().to_glib_none().0,
1129            );
1130        }
1131    }
1132
1133    /// Renders `self`’s cells according to `self`’s layout onto `widget` at
1134    /// the given coordinates.
1135    /// ## `context`
1136    /// the [`CellAreaContext`][crate::CellAreaContext] for this row of data.
1137    /// ## `widget`
1138    /// the [`Widget`][crate::Widget] that `self` is rendering to
1139    /// ## `cr`
1140    /// the [`cairo::Context`][crate::cairo::Context] to render with
1141    /// ## `background_area`
1142    /// the `widget` relative coordinates for `self`’s background
1143    /// ## `cell_area`
1144    /// the `widget` relative coordinates for `self`
1145    /// ## `flags`
1146    /// the [`CellRendererState`][crate::CellRendererState] for `self` in this row.
1147    /// ## `paint_focus`
1148    /// whether `self` should paint focus on focused cells for focused rows or not.
1149    #[doc(alias = "gtk_cell_area_render")]
1150    fn render(
1151        &self,
1152        context: &impl IsA<CellAreaContext>,
1153        widget: &impl IsA<Widget>,
1154        cr: &cairo::Context,
1155        background_area: &gdk::Rectangle,
1156        cell_area: &gdk::Rectangle,
1157        flags: CellRendererState,
1158        paint_focus: bool,
1159    ) {
1160        unsafe {
1161            ffi::gtk_cell_area_render(
1162                self.as_ref().to_glib_none().0,
1163                context.as_ref().to_glib_none().0,
1164                widget.as_ref().to_glib_none().0,
1165                mut_override(cr.to_glib_none().0),
1166                background_area.to_glib_none().0,
1167                cell_area.to_glib_none().0,
1168                flags.into_glib(),
1169                paint_focus.into_glib(),
1170            );
1171        }
1172    }
1173
1174    /// This is a convenience function for [`CellArea`][crate::CellArea] implementations
1175    /// to request size for cell renderers. It’s important to use this
1176    /// function to request size and then use [`inner_cell_area()`][Self::inner_cell_area()]
1177    /// at render and event time since this function will add padding
1178    /// around the cell for focus painting.
1179    /// ## `renderer`
1180    /// the [`CellRenderer`][crate::CellRenderer] to request size for
1181    /// ## `orientation`
1182    /// the [`Orientation`][crate::Orientation] in which to request size
1183    /// ## `widget`
1184    /// the [`Widget`][crate::Widget] that `self` is rendering onto
1185    /// ## `for_size`
1186    /// the allocation contextual size to request for, or -1 if
1187    /// the base request for the orientation is to be returned.
1188    ///
1189    /// # Returns
1190    ///
1191    ///
1192    /// ## `minimum_size`
1193    /// location to store the minimum size, or [`None`]
1194    ///
1195    /// ## `natural_size`
1196    /// location to store the natural size, or [`None`]
1197    #[doc(alias = "gtk_cell_area_request_renderer")]
1198    fn request_renderer(
1199        &self,
1200        renderer: &impl IsA<CellRenderer>,
1201        orientation: Orientation,
1202        widget: &impl IsA<Widget>,
1203        for_size: i32,
1204    ) -> (i32, i32) {
1205        unsafe {
1206            let mut minimum_size = std::mem::MaybeUninit::uninit();
1207            let mut natural_size = std::mem::MaybeUninit::uninit();
1208            ffi::gtk_cell_area_request_renderer(
1209                self.as_ref().to_glib_none().0,
1210                renderer.as_ref().to_glib_none().0,
1211                orientation.into_glib(),
1212                widget.as_ref().to_glib_none().0,
1213                for_size,
1214                minimum_size.as_mut_ptr(),
1215                natural_size.as_mut_ptr(),
1216            );
1217            (minimum_size.assume_init(), natural_size.assume_init())
1218        }
1219    }
1220
1221    /// Explicitly sets the currently focused cell to `renderer`.
1222    ///
1223    /// This is generally called by implementations of
1224    /// `GtkCellAreaClass.focus()` or `GtkCellAreaClass.event()`,
1225    /// however it can also be used to implement functions such
1226    /// as [`TreeViewExt::set_cursor_on_cell()`][crate::prelude::TreeViewExt::set_cursor_on_cell()].
1227    /// ## `renderer`
1228    /// the [`CellRenderer`][crate::CellRenderer] to give focus to
1229    #[doc(alias = "gtk_cell_area_set_focus_cell")]
1230    #[doc(alias = "focus-cell")]
1231    fn set_focus_cell(&self, renderer: &impl IsA<CellRenderer>) {
1232        unsafe {
1233            ffi::gtk_cell_area_set_focus_cell(
1234                self.as_ref().to_glib_none().0,
1235                renderer.as_ref().to_glib_none().0,
1236            );
1237        }
1238    }
1239
1240    /// Explicitly stops the editing of the currently edited cell.
1241    ///
1242    /// If `canceled` is [`true`], the currently edited cell renderer
1243    /// will emit the ::editing-canceled signal, otherwise the
1244    /// the ::editing-done signal will be emitted on the current
1245    /// edit widget.
1246    ///
1247    /// See [`edited_cell()`][Self::edited_cell()] and [`edit_widget()`][Self::edit_widget()].
1248    /// ## `canceled`
1249    /// whether editing was canceled.
1250    #[doc(alias = "gtk_cell_area_stop_editing")]
1251    fn stop_editing(&self, canceled: bool) {
1252        unsafe {
1253            ffi::gtk_cell_area_stop_editing(self.as_ref().to_glib_none().0, canceled.into_glib());
1254        }
1255    }
1256
1257    /// Indicates that editing has started on `renderer` and that `editable`
1258    /// should be added to the owning cell-layouting widget at `cell_area`.
1259    /// ## `renderer`
1260    /// the [`CellRenderer`][crate::CellRenderer] that started the edited
1261    /// ## `editable`
1262    /// the [`CellEditable`][crate::CellEditable] widget to add
1263    /// ## `cell_area`
1264    /// the [`Widget`][crate::Widget] relative [`gdk::Rectangle`][crate::gdk::Rectangle] coordinates
1265    ///  where `editable` should be added
1266    /// ## `path`
1267    /// the [`TreePath`][crate::TreePath] string this edit was initiated for
1268    #[doc(alias = "add-editable")]
1269    fn connect_add_editable<
1270        F: Fn(&Self, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
1271    >(
1272        &self,
1273        f: F,
1274    ) -> SignalHandlerId {
1275        unsafe extern "C" fn add_editable_trampoline<
1276            P: IsA<CellArea>,
1277            F: Fn(&P, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
1278        >(
1279            this: *mut ffi::GtkCellArea,
1280            renderer: *mut ffi::GtkCellRenderer,
1281            editable: *mut ffi::GtkCellEditable,
1282            cell_area: *mut gdk::ffi::GdkRectangle,
1283            path: *mut std::ffi::c_char,
1284            f: glib::ffi::gpointer,
1285        ) {
1286            unsafe {
1287                let f: &F = &*(f as *const F);
1288                let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1289                f(
1290                    CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1291                    &from_glib_borrow(renderer),
1292                    &from_glib_borrow(editable),
1293                    &from_glib_borrow(cell_area),
1294                    path,
1295                )
1296            }
1297        }
1298        unsafe {
1299            let f: Box_<F> = Box_::new(f);
1300            connect_raw(
1301                self.as_ptr() as *mut _,
1302                c"add-editable".as_ptr(),
1303                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1304                    add_editable_trampoline::<Self, F> as *const (),
1305                )),
1306                Box_::into_raw(f),
1307            )
1308        }
1309    }
1310
1311    /// This signal is emitted whenever applying attributes to `area` from `model`
1312    /// ## `model`
1313    /// the [`TreeModel`][crate::TreeModel] to apply the attributes from
1314    /// ## `iter`
1315    /// the [`TreeIter`][crate::TreeIter] indicating which row to apply the attributes of
1316    /// ## `is_expander`
1317    /// whether the view shows children for this row
1318    /// ## `is_expanded`
1319    /// whether the view is currently showing the children of this row
1320    #[doc(alias = "apply-attributes")]
1321    fn connect_apply_attributes<F: Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>(
1322        &self,
1323        f: F,
1324    ) -> SignalHandlerId {
1325        unsafe extern "C" fn apply_attributes_trampoline<
1326            P: IsA<CellArea>,
1327            F: Fn(&P, &TreeModel, &TreeIter, bool, bool) + 'static,
1328        >(
1329            this: *mut ffi::GtkCellArea,
1330            model: *mut ffi::GtkTreeModel,
1331            iter: *mut ffi::GtkTreeIter,
1332            is_expander: glib::ffi::gboolean,
1333            is_expanded: glib::ffi::gboolean,
1334            f: glib::ffi::gpointer,
1335        ) {
1336            unsafe {
1337                let f: &F = &*(f as *const F);
1338                f(
1339                    CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1340                    &from_glib_borrow(model),
1341                    &from_glib_borrow(iter),
1342                    from_glib(is_expander),
1343                    from_glib(is_expanded),
1344                )
1345            }
1346        }
1347        unsafe {
1348            let f: Box_<F> = Box_::new(f);
1349            connect_raw(
1350                self.as_ptr() as *mut _,
1351                c"apply-attributes".as_ptr(),
1352                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1353                    apply_attributes_trampoline::<Self, F> as *const (),
1354                )),
1355                Box_::into_raw(f),
1356            )
1357        }
1358    }
1359
1360    /// Indicates that focus changed on this `area`. This signal
1361    /// is emitted either as a result of focus handling or event
1362    /// handling.
1363    ///
1364    /// It's possible that the signal is emitted even if the
1365    /// currently focused renderer did not change, this is
1366    /// because focus may change to the same renderer in the
1367    /// same cell area for a different row of data.
1368    /// ## `renderer`
1369    /// the [`CellRenderer`][crate::CellRenderer] that has focus
1370    /// ## `path`
1371    /// the current [`TreePath`][crate::TreePath] string set for `area`
1372    #[doc(alias = "focus-changed")]
1373    fn connect_focus_changed<F: Fn(&Self, &CellRenderer, TreePath) + 'static>(
1374        &self,
1375        f: F,
1376    ) -> SignalHandlerId {
1377        unsafe extern "C" fn focus_changed_trampoline<
1378            P: IsA<CellArea>,
1379            F: Fn(&P, &CellRenderer, TreePath) + 'static,
1380        >(
1381            this: *mut ffi::GtkCellArea,
1382            renderer: *mut ffi::GtkCellRenderer,
1383            path: *mut std::ffi::c_char,
1384            f: glib::ffi::gpointer,
1385        ) {
1386            unsafe {
1387                let f: &F = &*(f as *const F);
1388                let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1389                f(
1390                    CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1391                    &from_glib_borrow(renderer),
1392                    path,
1393                )
1394            }
1395        }
1396        unsafe {
1397            let f: Box_<F> = Box_::new(f);
1398            connect_raw(
1399                self.as_ptr() as *mut _,
1400                c"focus-changed".as_ptr(),
1401                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1402                    focus_changed_trampoline::<Self, F> as *const (),
1403                )),
1404                Box_::into_raw(f),
1405            )
1406        }
1407    }
1408
1409    /// Indicates that editing finished on `renderer` and that `editable`
1410    /// should be removed from the owning cell-layouting widget.
1411    /// ## `renderer`
1412    /// the [`CellRenderer`][crate::CellRenderer] that finished editeding
1413    /// ## `editable`
1414    /// the [`CellEditable`][crate::CellEditable] widget to remove
1415    #[doc(alias = "remove-editable")]
1416    fn connect_remove_editable<F: Fn(&Self, &CellRenderer, &CellEditable) + 'static>(
1417        &self,
1418        f: F,
1419    ) -> SignalHandlerId {
1420        unsafe extern "C" fn remove_editable_trampoline<
1421            P: IsA<CellArea>,
1422            F: Fn(&P, &CellRenderer, &CellEditable) + 'static,
1423        >(
1424            this: *mut ffi::GtkCellArea,
1425            renderer: *mut ffi::GtkCellRenderer,
1426            editable: *mut ffi::GtkCellEditable,
1427            f: glib::ffi::gpointer,
1428        ) {
1429            unsafe {
1430                let f: &F = &*(f as *const F);
1431                f(
1432                    CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1433                    &from_glib_borrow(renderer),
1434                    &from_glib_borrow(editable),
1435                )
1436            }
1437        }
1438        unsafe {
1439            let f: Box_<F> = Box_::new(f);
1440            connect_raw(
1441                self.as_ptr() as *mut _,
1442                c"remove-editable".as_ptr(),
1443                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1444                    remove_editable_trampoline::<Self, F> as *const (),
1445                )),
1446                Box_::into_raw(f),
1447            )
1448        }
1449    }
1450
1451    #[doc(alias = "edit-widget")]
1452    fn connect_edit_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1453        unsafe extern "C" fn notify_edit_widget_trampoline<
1454            P: IsA<CellArea>,
1455            F: Fn(&P) + 'static,
1456        >(
1457            this: *mut ffi::GtkCellArea,
1458            _param_spec: glib::ffi::gpointer,
1459            f: glib::ffi::gpointer,
1460        ) {
1461            unsafe {
1462                let f: &F = &*(f as *const F);
1463                f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1464            }
1465        }
1466        unsafe {
1467            let f: Box_<F> = Box_::new(f);
1468            connect_raw(
1469                self.as_ptr() as *mut _,
1470                c"notify::edit-widget".as_ptr(),
1471                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1472                    notify_edit_widget_trampoline::<Self, F> as *const (),
1473                )),
1474                Box_::into_raw(f),
1475            )
1476        }
1477    }
1478
1479    #[doc(alias = "edited-cell")]
1480    fn connect_edited_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1481        unsafe extern "C" fn notify_edited_cell_trampoline<
1482            P: IsA<CellArea>,
1483            F: Fn(&P) + 'static,
1484        >(
1485            this: *mut ffi::GtkCellArea,
1486            _param_spec: glib::ffi::gpointer,
1487            f: glib::ffi::gpointer,
1488        ) {
1489            unsafe {
1490                let f: &F = &*(f as *const F);
1491                f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1492            }
1493        }
1494        unsafe {
1495            let f: Box_<F> = Box_::new(f);
1496            connect_raw(
1497                self.as_ptr() as *mut _,
1498                c"notify::edited-cell".as_ptr(),
1499                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1500                    notify_edited_cell_trampoline::<Self, F> as *const (),
1501                )),
1502                Box_::into_raw(f),
1503            )
1504        }
1505    }
1506
1507    #[doc(alias = "focus-cell")]
1508    fn connect_focus_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1509        unsafe extern "C" fn notify_focus_cell_trampoline<P: IsA<CellArea>, F: Fn(&P) + 'static>(
1510            this: *mut ffi::GtkCellArea,
1511            _param_spec: glib::ffi::gpointer,
1512            f: glib::ffi::gpointer,
1513        ) {
1514            unsafe {
1515                let f: &F = &*(f as *const F);
1516                f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1517            }
1518        }
1519        unsafe {
1520            let f: Box_<F> = Box_::new(f);
1521            connect_raw(
1522                self.as_ptr() as *mut _,
1523                c"notify::focus-cell".as_ptr(),
1524                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1525                    notify_focus_cell_trampoline::<Self, F> as *const (),
1526                )),
1527                Box_::into_raw(f),
1528            )
1529        }
1530    }
1531}
1532
1533impl<O: IsA<CellArea>> CellAreaExt for O {}