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