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