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