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