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
421/// Trait containing all [`struct@CellArea`] methods.
422///
423/// # Implementors
424///
425/// [`CellAreaBox`][struct@crate::CellAreaBox], [`CellArea`][struct@crate::CellArea]
426pub trait CellAreaExt: IsA<CellArea> + 'static {
427 /// Activates @self, usually by activating the currently focused
428 /// cell, however some subclasses which embed widgets in the area
429 /// can also activate a widget if it currently has the focus.
430 ///
431 /// # Deprecated since 4.10
432 ///
433 /// ## `context`
434 /// the [`CellArea`][crate::CellArea]Context in context with the current row data
435 /// ## `widget`
436 /// the [`Widget`][crate::Widget] that @self is rendering on
437 /// ## `cell_area`
438 /// the size and location of @self relative to @widget’s allocation
439 /// ## `flags`
440 /// the [`CellRenderer`][crate::CellRenderer]State flags for @self for this row of data.
441 /// ## `edit_only`
442 /// if [`true`] then only cell renderers that are [`CellRendererMode::Editable`][crate::CellRendererMode::Editable]
443 /// will be activated.
444 ///
445 /// # Returns
446 ///
447 /// Whether @self was successfully activated.
448 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
449 #[allow(deprecated)]
450 #[doc(alias = "gtk_cell_area_activate")]
451 fn activate(
452 &self,
453 context: &impl IsA<CellAreaContext>,
454 widget: &impl IsA<Widget>,
455 cell_area: &gdk::Rectangle,
456 flags: CellRendererState,
457 edit_only: bool,
458 ) -> bool {
459 unsafe {
460 from_glib(ffi::gtk_cell_area_activate(
461 self.as_ref().to_glib_none().0,
462 context.as_ref().to_glib_none().0,
463 widget.as_ref().to_glib_none().0,
464 cell_area.to_glib_none().0,
465 flags.into_glib(),
466 edit_only.into_glib(),
467 ))
468 }
469 }
470
471 /// This is used by [`CellArea`][crate::CellArea] subclasses when handling events
472 /// to activate cells, the base [`CellArea`][crate::CellArea] class activates cells
473 /// for keyboard events for free in its own GtkCellArea->activate()
474 /// implementation.
475 ///
476 /// # Deprecated since 4.10
477 ///
478 /// ## `widget`
479 /// the [`Widget`][crate::Widget] that @self is rendering onto
480 /// ## `renderer`
481 /// the [`CellRenderer`][crate::CellRenderer] in @self to activate
482 /// ## `event`
483 /// the [`gdk::Event`][crate::gdk::Event] for which cell activation should occur
484 /// ## `cell_area`
485 /// the [`gdk::Rectangle`][crate::gdk::Rectangle] in @widget relative coordinates
486 /// of @renderer for the current row.
487 /// ## `flags`
488 /// the [`CellRenderer`][crate::CellRenderer]State for @renderer
489 ///
490 /// # Returns
491 ///
492 /// whether cell activation was successful
493 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
494 #[allow(deprecated)]
495 #[doc(alias = "gtk_cell_area_activate_cell")]
496 fn activate_cell(
497 &self,
498 widget: &impl IsA<Widget>,
499 renderer: &impl IsA<CellRenderer>,
500 event: impl AsRef<gdk::Event>,
501 cell_area: &gdk::Rectangle,
502 flags: CellRendererState,
503 ) -> bool {
504 unsafe {
505 from_glib(ffi::gtk_cell_area_activate_cell(
506 self.as_ref().to_glib_none().0,
507 widget.as_ref().to_glib_none().0,
508 renderer.as_ref().to_glib_none().0,
509 event.as_ref().to_glib_none().0,
510 cell_area.to_glib_none().0,
511 flags.into_glib(),
512 ))
513 }
514 }
515
516 /// Adds @renderer to @self with the default child cell properties.
517 ///
518 /// # Deprecated since 4.10
519 ///
520 /// ## `renderer`
521 /// the [`CellRenderer`][crate::CellRenderer] to add to @self
522 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
523 #[allow(deprecated)]
524 #[doc(alias = "gtk_cell_area_add")]
525 fn add(&self, renderer: &impl IsA<CellRenderer>) {
526 unsafe {
527 ffi::gtk_cell_area_add(
528 self.as_ref().to_glib_none().0,
529 renderer.as_ref().to_glib_none().0,
530 );
531 }
532 }
533
534 /// Adds @sibling to @renderer’s focusable area, focus will be drawn
535 /// around @renderer and all of its siblings if @renderer can
536 /// focus for a given row.
537 ///
538 /// Events handled by focus siblings can also activate the given
539 /// focusable @renderer.
540 ///
541 /// # Deprecated since 4.10
542 ///
543 /// ## `renderer`
544 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
545 /// ## `sibling`
546 /// the [`CellRenderer`][crate::CellRenderer] to add to @renderer’s focus area
547 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
548 #[allow(deprecated)]
549 #[doc(alias = "gtk_cell_area_add_focus_sibling")]
550 fn add_focus_sibling(
551 &self,
552 renderer: &impl IsA<CellRenderer>,
553 sibling: &impl IsA<CellRenderer>,
554 ) {
555 unsafe {
556 ffi::gtk_cell_area_add_focus_sibling(
557 self.as_ref().to_glib_none().0,
558 renderer.as_ref().to_glib_none().0,
559 sibling.as_ref().to_glib_none().0,
560 );
561 }
562 }
563
564 /// Applies any connected attributes to the renderers in
565 /// @self by pulling the values from @tree_model.
566 ///
567 /// # Deprecated since 4.10
568 ///
569 /// ## `tree_model`
570 /// the [`TreeModel`][crate::TreeModel] to pull values from
571 /// ## `iter`
572 /// the [`TreeIter`][crate::TreeIter] in @tree_model to apply values for
573 /// ## `is_expander`
574 /// whether @iter has children
575 /// ## `is_expanded`
576 /// whether @iter is expanded in the view and
577 /// children are visible
578 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
579 #[allow(deprecated)]
580 #[doc(alias = "gtk_cell_area_apply_attributes")]
581 fn apply_attributes(
582 &self,
583 tree_model: &impl IsA<TreeModel>,
584 iter: &TreeIter,
585 is_expander: bool,
586 is_expanded: bool,
587 ) {
588 unsafe {
589 ffi::gtk_cell_area_apply_attributes(
590 self.as_ref().to_glib_none().0,
591 tree_model.as_ref().to_glib_none().0,
592 mut_override(iter.to_glib_none().0),
593 is_expander.into_glib(),
594 is_expanded.into_glib(),
595 );
596 }
597 }
598
599 /// Connects an @attribute to apply values from @column for the
600 /// [`TreeModel`][crate::TreeModel] in use.
601 ///
602 /// # Deprecated since 4.10
603 ///
604 /// ## `renderer`
605 /// the [`CellRenderer`][crate::CellRenderer] to connect an attribute for
606 /// ## `attribute`
607 /// the attribute name
608 /// ## `column`
609 /// the [`TreeModel`][crate::TreeModel] column to fetch attribute values from
610 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
611 #[allow(deprecated)]
612 #[doc(alias = "gtk_cell_area_attribute_connect")]
613 fn attribute_connect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str, column: i32) {
614 unsafe {
615 ffi::gtk_cell_area_attribute_connect(
616 self.as_ref().to_glib_none().0,
617 renderer.as_ref().to_glib_none().0,
618 attribute.to_glib_none().0,
619 column,
620 );
621 }
622 }
623
624 /// Disconnects @attribute for the @renderer in @self so that
625 /// attribute will no longer be updated with values from the
626 /// model.
627 ///
628 /// # Deprecated since 4.10
629 ///
630 /// ## `renderer`
631 /// the [`CellRenderer`][crate::CellRenderer] to disconnect an attribute for
632 /// ## `attribute`
633 /// the attribute name
634 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
635 #[allow(deprecated)]
636 #[doc(alias = "gtk_cell_area_attribute_disconnect")]
637 fn attribute_disconnect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) {
638 unsafe {
639 ffi::gtk_cell_area_attribute_disconnect(
640 self.as_ref().to_glib_none().0,
641 renderer.as_ref().to_glib_none().0,
642 attribute.to_glib_none().0,
643 );
644 }
645 }
646
647 /// Returns the model column that an attribute has been mapped to,
648 /// or -1 if the attribute is not mapped.
649 ///
650 /// # Deprecated since 4.10
651 ///
652 /// ## `renderer`
653 /// a [`CellRenderer`][crate::CellRenderer]
654 /// ## `attribute`
655 /// an attribute on the renderer
656 ///
657 /// # Returns
658 ///
659 /// the model column, or -1
660 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
661 #[allow(deprecated)]
662 #[doc(alias = "gtk_cell_area_attribute_get_column")]
663 fn attribute_get_column(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) -> i32 {
664 unsafe {
665 ffi::gtk_cell_area_attribute_get_column(
666 self.as_ref().to_glib_none().0,
667 renderer.as_ref().to_glib_none().0,
668 attribute.to_glib_none().0,
669 )
670 }
671 }
672
673 /// This is sometimes needed for cases where rows need to share
674 /// alignments in one orientation but may be separately grouped
675 /// in the opposing orientation.
676 ///
677 /// For instance, [`IconView`][crate::IconView] creates all icons (rows) to have
678 /// the same width and the cells theirin to have the same
679 /// horizontal alignments. However each row of icons may have
680 /// a separate collective height. [`IconView`][crate::IconView] uses this to
681 /// request the heights of each row based on a context which
682 /// was already used to request all the row widths that are
683 /// to be displayed.
684 ///
685 /// # Deprecated since 4.10
686 ///
687 /// ## `context`
688 /// the [`CellArea`][crate::CellArea]Context to copy
689 ///
690 /// # Returns
691 ///
692 /// a newly created [`CellArea`][crate::CellArea]Context copy of @context.
693 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
694 #[allow(deprecated)]
695 #[doc(alias = "gtk_cell_area_copy_context")]
696 fn copy_context(&self, context: &impl IsA<CellAreaContext>) -> CellAreaContext {
697 unsafe {
698 from_glib_full(ffi::gtk_cell_area_copy_context(
699 self.as_ref().to_glib_none().0,
700 context.as_ref().to_glib_none().0,
701 ))
702 }
703 }
704
705 /// Creates a [`CellArea`][crate::CellArea]Context to be used with @self for
706 /// all purposes. [`CellArea`][crate::CellArea]Context stores geometry information
707 /// for rows for which it was operated on, it is important to use
708 /// the same context for the same row of data at all times (i.e.
709 /// one should render and handle events with the same [`CellArea`][crate::CellArea]Context
710 /// which was used to request the size of those rows of data).
711 ///
712 /// # Deprecated since 4.10
713 ///
714 ///
715 /// # Returns
716 ///
717 /// a newly created [`CellArea`][crate::CellArea]Context which can be used with @self.
718 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
719 #[allow(deprecated)]
720 #[doc(alias = "gtk_cell_area_create_context")]
721 fn create_context(&self) -> CellAreaContext {
722 unsafe {
723 from_glib_full(ffi::gtk_cell_area_create_context(
724 self.as_ref().to_glib_none().0,
725 ))
726 }
727 }
728
729 /// Delegates event handling to a [`CellArea`][crate::CellArea].
730 ///
731 /// # Deprecated since 4.10
732 ///
733 /// ## `context`
734 /// the [`CellArea`][crate::CellArea]Context for this row of data.
735 /// ## `widget`
736 /// the [`Widget`][crate::Widget] that @self is rendering to
737 /// ## `event`
738 /// the [`gdk::Event`][crate::gdk::Event] to handle
739 /// ## `cell_area`
740 /// the @widget relative coordinates for @self
741 /// ## `flags`
742 /// the [`CellRenderer`][crate::CellRenderer]State for @self in this row.
743 ///
744 /// # Returns
745 ///
746 /// [`true`] if the event was handled by @self.
747 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
748 #[allow(deprecated)]
749 #[doc(alias = "gtk_cell_area_event")]
750 fn event(
751 &self,
752 context: &impl IsA<CellAreaContext>,
753 widget: &impl IsA<Widget>,
754 event: impl AsRef<gdk::Event>,
755 cell_area: &gdk::Rectangle,
756 flags: CellRendererState,
757 ) -> i32 {
758 unsafe {
759 ffi::gtk_cell_area_event(
760 self.as_ref().to_glib_none().0,
761 context.as_ref().to_glib_none().0,
762 widget.as_ref().to_glib_none().0,
763 event.as_ref().to_glib_none().0,
764 cell_area.to_glib_none().0,
765 flags.into_glib(),
766 )
767 }
768 }
769
770 /// This should be called by the @self’s owning layout widget
771 /// when focus is to be passed to @self, or moved within @self
772 /// for a given @direction and row data.
773 ///
774 /// Implementing [`CellArea`][crate::CellArea] classes should implement this
775 /// method to receive and navigate focus in its own way particular
776 /// to how it lays out cells.
777 ///
778 /// # Deprecated since 4.10
779 ///
780 /// ## `direction`
781 /// the [`DirectionType`][crate::DirectionType]
782 ///
783 /// # Returns
784 ///
785 /// [`true`] if focus remains inside @self as a result of this call.
786 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
787 #[allow(deprecated)]
788 #[doc(alias = "gtk_cell_area_focus")]
789 fn focus(&self, direction: DirectionType) -> bool {
790 unsafe {
791 from_glib(ffi::gtk_cell_area_focus(
792 self.as_ref().to_glib_none().0,
793 direction.into_glib(),
794 ))
795 }
796 }
797
798 /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self.
799 ///
800 /// # Deprecated since 4.10
801 ///
802 /// ## `callback`
803 /// the `GtkCellCallback` to call
804 /// ## `callback_data`
805 /// user provided data pointer
806 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
807 #[allow(deprecated)]
808 #[doc(alias = "gtk_cell_area_foreach")]
809 fn foreach<P: FnMut(&CellRenderer) -> bool>(&self, callback: P) {
810 let mut callback_data: P = callback;
811 unsafe extern "C" fn callback_func<P: FnMut(&CellRenderer) -> bool>(
812 renderer: *mut ffi::GtkCellRenderer,
813 data: glib::ffi::gpointer,
814 ) -> glib::ffi::gboolean {
815 let renderer = from_glib_borrow(renderer);
816 let callback = data as *mut P;
817 (*callback)(&renderer).into_glib()
818 }
819 let callback = Some(callback_func::<P> as _);
820 let super_callback0: &mut P = &mut callback_data;
821 unsafe {
822 ffi::gtk_cell_area_foreach(
823 self.as_ref().to_glib_none().0,
824 callback,
825 super_callback0 as *mut _ as *mut _,
826 );
827 }
828 }
829
830 /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self with the
831 /// allocated rectangle inside @cell_area.
832 /// ## `context`
833 /// the [`CellArea`][crate::CellArea]Context for this row of data.
834 /// ## `widget`
835 /// the [`Widget`][crate::Widget] that @self is rendering to
836 /// ## `cell_area`
837 /// the @widget relative coordinates and size for @self
838 /// ## `background_area`
839 /// the @widget relative coordinates of the background area
840 /// ## `callback`
841 /// the `GtkCellAllocCallback` to call
842 /// ## `callback_data`
843 /// user provided data pointer
844 #[doc(alias = "gtk_cell_area_foreach_alloc")]
845 fn foreach_alloc<P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool>(
846 &self,
847 context: &impl IsA<CellAreaContext>,
848 widget: &impl IsA<Widget>,
849 cell_area: &gdk::Rectangle,
850 background_area: &gdk::Rectangle,
851 callback: P,
852 ) {
853 let mut callback_data: P = callback;
854 unsafe extern "C" fn callback_func<
855 P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool,
856 >(
857 renderer: *mut ffi::GtkCellRenderer,
858 cell_area: *const gdk::ffi::GdkRectangle,
859 cell_background: *const gdk::ffi::GdkRectangle,
860 data: glib::ffi::gpointer,
861 ) -> glib::ffi::gboolean {
862 let renderer = from_glib_borrow(renderer);
863 let cell_area = from_glib_borrow(cell_area);
864 let cell_background = from_glib_borrow(cell_background);
865 let callback = data as *mut P;
866 (*callback)(&renderer, &cell_area, &cell_background).into_glib()
867 }
868 let callback = Some(callback_func::<P> as _);
869 let super_callback0: &mut P = &mut callback_data;
870 unsafe {
871 ffi::gtk_cell_area_foreach_alloc(
872 self.as_ref().to_glib_none().0,
873 context.as_ref().to_glib_none().0,
874 widget.as_ref().to_glib_none().0,
875 cell_area.to_glib_none().0,
876 background_area.to_glib_none().0,
877 callback,
878 super_callback0 as *mut _ as *mut _,
879 );
880 }
881 }
882
883 /// Derives the allocation of @renderer inside @self if @self
884 /// were to be rendered in @cell_area.
885 ///
886 /// # Deprecated since 4.10
887 ///
888 /// ## `context`
889 /// the [`CellArea`][crate::CellArea]Context used to hold sizes for @self.
890 /// ## `widget`
891 /// the [`Widget`][crate::Widget] that @self is rendering on
892 /// ## `renderer`
893 /// the [`CellRenderer`][crate::CellRenderer] to get the allocation for
894 /// ## `cell_area`
895 /// the whole allocated area for @self in @widget
896 /// for this row
897 ///
898 /// # Returns
899 ///
900 ///
901 /// ## `allocation`
902 /// where to store the allocation for @renderer
903 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
904 #[allow(deprecated)]
905 #[doc(alias = "gtk_cell_area_get_cell_allocation")]
906 #[doc(alias = "get_cell_allocation")]
907 fn cell_allocation(
908 &self,
909 context: &impl IsA<CellAreaContext>,
910 widget: &impl IsA<Widget>,
911 renderer: &impl IsA<CellRenderer>,
912 cell_area: &gdk::Rectangle,
913 ) -> gdk::Rectangle {
914 unsafe {
915 let mut allocation = gdk::Rectangle::uninitialized();
916 ffi::gtk_cell_area_get_cell_allocation(
917 self.as_ref().to_glib_none().0,
918 context.as_ref().to_glib_none().0,
919 widget.as_ref().to_glib_none().0,
920 renderer.as_ref().to_glib_none().0,
921 cell_area.to_glib_none().0,
922 allocation.to_glib_none_mut().0,
923 );
924 allocation
925 }
926 }
927
928 /// Gets the [`CellRenderer`][crate::CellRenderer] at @x and @y coordinates inside @self and optionally
929 /// returns the full cell allocation for it inside @cell_area.
930 ///
931 /// # Deprecated since 4.10
932 ///
933 /// ## `context`
934 /// the [`CellArea`][crate::CellArea]Context used to hold sizes for @self.
935 /// ## `widget`
936 /// the [`Widget`][crate::Widget] that @self is rendering on
937 /// ## `cell_area`
938 /// the whole allocated area for @self in @widget
939 /// for this row
940 /// ## `x`
941 /// the x position
942 /// ## `y`
943 /// the y position
944 ///
945 /// # Returns
946 ///
947 /// the [`CellRenderer`][crate::CellRenderer] at @x and @y.
948 ///
949 /// ## `alloc_area`
950 /// where to store the inner allocated area of the
951 /// returned cell renderer
952 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
953 #[allow(deprecated)]
954 #[doc(alias = "gtk_cell_area_get_cell_at_position")]
955 #[doc(alias = "get_cell_at_position")]
956 fn cell_at_position(
957 &self,
958 context: &impl IsA<CellAreaContext>,
959 widget: &impl IsA<Widget>,
960 cell_area: &gdk::Rectangle,
961 x: i32,
962 y: i32,
963 ) -> (CellRenderer, gdk::Rectangle) {
964 unsafe {
965 let mut alloc_area = gdk::Rectangle::uninitialized();
966 let ret = from_glib_none(ffi::gtk_cell_area_get_cell_at_position(
967 self.as_ref().to_glib_none().0,
968 context.as_ref().to_glib_none().0,
969 widget.as_ref().to_glib_none().0,
970 cell_area.to_glib_none().0,
971 x,
972 y,
973 alloc_area.to_glib_none_mut().0,
974 ));
975 (ret, alloc_area)
976 }
977 }
978
979 /// Gets the current [`TreePath`][crate::TreePath] string for the currently
980 /// applied [`TreeIter`][crate::TreeIter], this is implicitly updated when
981 /// gtk_cell_area_apply_attributes() is called and can be
982 /// used to interact with renderers from [`CellArea`][crate::CellArea]
983 /// subclasses.
984 ///
985 /// # Returns
986 ///
987 /// The current [`TreePath`][crate::TreePath] string for the current
988 /// attributes applied to @self. This string belongs to the area and
989 /// should not be freed.
990 #[doc(alias = "gtk_cell_area_get_current_path_string")]
991 #[doc(alias = "get_current_path_string")]
992 fn current_path_string(&self) -> glib::GString {
993 unsafe {
994 from_glib_none(ffi::gtk_cell_area_get_current_path_string(
995 self.as_ref().to_glib_none().0,
996 ))
997 }
998 }
999
1000 /// Gets the [`CellEditable`][crate::CellEditable] widget currently used
1001 /// to edit the currently edited cell.
1002 ///
1003 /// # Deprecated since 4.10
1004 ///
1005 ///
1006 /// # Returns
1007 ///
1008 /// The currently active [`CellEditable`][crate::CellEditable] widget
1009 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1010 #[allow(deprecated)]
1011 #[doc(alias = "gtk_cell_area_get_edit_widget")]
1012 #[doc(alias = "get_edit_widget")]
1013 #[doc(alias = "edit-widget")]
1014 fn edit_widget(&self) -> Option<CellEditable> {
1015 unsafe {
1016 from_glib_none(ffi::gtk_cell_area_get_edit_widget(
1017 self.as_ref().to_glib_none().0,
1018 ))
1019 }
1020 }
1021
1022 /// Gets the [`CellRenderer`][crate::CellRenderer] in @self that is currently
1023 /// being edited.
1024 ///
1025 /// # Deprecated since 4.10
1026 ///
1027 ///
1028 /// # Returns
1029 ///
1030 /// The currently edited [`CellRenderer`][crate::CellRenderer]
1031 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1032 #[allow(deprecated)]
1033 #[doc(alias = "gtk_cell_area_get_edited_cell")]
1034 #[doc(alias = "get_edited_cell")]
1035 #[doc(alias = "edited-cell")]
1036 fn edited_cell(&self) -> Option<CellRenderer> {
1037 unsafe {
1038 from_glib_none(ffi::gtk_cell_area_get_edited_cell(
1039 self.as_ref().to_glib_none().0,
1040 ))
1041 }
1042 }
1043
1044 /// Retrieves the currently focused cell for @self
1045 ///
1046 /// # Deprecated since 4.10
1047 ///
1048 ///
1049 /// # Returns
1050 ///
1051 /// the currently focused cell in @self.
1052 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1053 #[allow(deprecated)]
1054 #[doc(alias = "gtk_cell_area_get_focus_cell")]
1055 #[doc(alias = "get_focus_cell")]
1056 #[doc(alias = "focus-cell")]
1057 fn focus_cell(&self) -> Option<CellRenderer> {
1058 unsafe {
1059 from_glib_none(ffi::gtk_cell_area_get_focus_cell(
1060 self.as_ref().to_glib_none().0,
1061 ))
1062 }
1063 }
1064
1065 /// Gets the [`CellRenderer`][crate::CellRenderer] which is expected to be focusable
1066 /// for which @renderer is, or may be a sibling.
1067 ///
1068 /// This is handy for [`CellArea`][crate::CellArea] subclasses when handling events,
1069 /// after determining the renderer at the event location it can
1070 /// then chose to activate the focus cell for which the event
1071 /// cell may have been a sibling.
1072 ///
1073 /// # Deprecated since 4.10
1074 ///
1075 /// ## `renderer`
1076 /// the [`CellRenderer`][crate::CellRenderer]
1077 ///
1078 /// # Returns
1079 ///
1080 /// the [`CellRenderer`][crate::CellRenderer]
1081 /// for which @renderer is a sibling
1082 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1083 #[allow(deprecated)]
1084 #[doc(alias = "gtk_cell_area_get_focus_from_sibling")]
1085 #[doc(alias = "get_focus_from_sibling")]
1086 fn focus_from_sibling(&self, renderer: &impl IsA<CellRenderer>) -> Option<CellRenderer> {
1087 unsafe {
1088 from_glib_none(ffi::gtk_cell_area_get_focus_from_sibling(
1089 self.as_ref().to_glib_none().0,
1090 renderer.as_ref().to_glib_none().0,
1091 ))
1092 }
1093 }
1094
1095 /// Gets the focus sibling cell renderers for @renderer.
1096 ///
1097 /// # Deprecated since 4.10
1098 ///
1099 /// ## `renderer`
1100 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
1101 ///
1102 /// # Returns
1103 ///
1104 /// A `GList` of [`CellRenderer`][crate::CellRenderer]s.
1105 /// The returned list is internal and should not be freed.
1106 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1107 #[allow(deprecated)]
1108 #[doc(alias = "gtk_cell_area_get_focus_siblings")]
1109 #[doc(alias = "get_focus_siblings")]
1110 fn focus_siblings(&self, renderer: &impl IsA<CellRenderer>) -> Vec<CellRenderer> {
1111 unsafe {
1112 FromGlibPtrContainer::from_glib_none(ffi::gtk_cell_area_get_focus_siblings(
1113 self.as_ref().to_glib_none().0,
1114 renderer.as_ref().to_glib_none().0,
1115 ))
1116 }
1117 }
1118
1119 /// Retrieves a cell area’s initial minimum and natural height.
1120 ///
1121 /// @self will store some geometrical information in @context along the way;
1122 /// when requesting sizes over an arbitrary number of rows, it’s not important
1123 /// to check the @minimum_height and @natural_height of this call but rather to
1124 /// consult gtk_cell_area_context_get_preferred_height() after a series of
1125 /// requests.
1126 ///
1127 /// # Deprecated since 4.10
1128 ///
1129 /// ## `context`
1130 /// the [`CellArea`][crate::CellArea]Context to perform this request with
1131 /// ## `widget`
1132 /// the [`Widget`][crate::Widget] where @self will be rendering
1133 ///
1134 /// # Returns
1135 ///
1136 ///
1137 /// ## `minimum_height`
1138 /// location to store the minimum height
1139 ///
1140 /// ## `natural_height`
1141 /// location to store the natural height
1142 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1143 #[allow(deprecated)]
1144 #[doc(alias = "gtk_cell_area_get_preferred_height")]
1145 #[doc(alias = "get_preferred_height")]
1146 fn preferred_height(
1147 &self,
1148 context: &impl IsA<CellAreaContext>,
1149 widget: &impl IsA<Widget>,
1150 ) -> (i32, i32) {
1151 unsafe {
1152 let mut minimum_height = std::mem::MaybeUninit::uninit();
1153 let mut natural_height = std::mem::MaybeUninit::uninit();
1154 ffi::gtk_cell_area_get_preferred_height(
1155 self.as_ref().to_glib_none().0,
1156 context.as_ref().to_glib_none().0,
1157 widget.as_ref().to_glib_none().0,
1158 minimum_height.as_mut_ptr(),
1159 natural_height.as_mut_ptr(),
1160 );
1161 (minimum_height.assume_init(), natural_height.assume_init())
1162 }
1163 }
1164
1165 /// Retrieves a cell area’s minimum and natural height if it would be given
1166 /// the specified @width.
1167 ///
1168 /// @self stores some geometrical information in @context along the way
1169 /// while calling gtk_cell_area_get_preferred_width(). It’s important to
1170 /// perform a series of gtk_cell_area_get_preferred_width() requests with
1171 /// @context first and then call gtk_cell_area_get_preferred_height_for_width()
1172 /// on each cell area individually to get the height for width of each
1173 /// fully requested row.
1174 ///
1175 /// If at some point, the width of a single row changes, it should be
1176 /// requested with gtk_cell_area_get_preferred_width() again and then
1177 /// the full width of the requested rows checked again with
1178 /// gtk_cell_area_context_get_preferred_width().
1179 ///
1180 /// # Deprecated since 4.10
1181 ///
1182 /// ## `context`
1183 /// the [`CellArea`][crate::CellArea]Context which has already been requested for widths.
1184 /// ## `widget`
1185 /// the [`Widget`][crate::Widget] where @self will be rendering
1186 /// ## `width`
1187 /// the width for which to check the height of this area
1188 ///
1189 /// # Returns
1190 ///
1191 ///
1192 /// ## `minimum_height`
1193 /// location to store the minimum height
1194 ///
1195 /// ## `natural_height`
1196 /// location to store the natural height
1197 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1198 #[allow(deprecated)]
1199 #[doc(alias = "gtk_cell_area_get_preferred_height_for_width")]
1200 #[doc(alias = "get_preferred_height_for_width")]
1201 fn preferred_height_for_width(
1202 &self,
1203 context: &impl IsA<CellAreaContext>,
1204 widget: &impl IsA<Widget>,
1205 width: i32,
1206 ) -> (i32, i32) {
1207 unsafe {
1208 let mut minimum_height = std::mem::MaybeUninit::uninit();
1209 let mut natural_height = std::mem::MaybeUninit::uninit();
1210 ffi::gtk_cell_area_get_preferred_height_for_width(
1211 self.as_ref().to_glib_none().0,
1212 context.as_ref().to_glib_none().0,
1213 widget.as_ref().to_glib_none().0,
1214 width,
1215 minimum_height.as_mut_ptr(),
1216 natural_height.as_mut_ptr(),
1217 );
1218 (minimum_height.assume_init(), natural_height.assume_init())
1219 }
1220 }
1221
1222 /// Retrieves a cell area’s initial minimum and natural width.
1223 ///
1224 /// @self will store some geometrical information in @context along the way;
1225 /// when requesting sizes over an arbitrary number of rows, it’s not important
1226 /// to check the @minimum_width and @natural_width of this call but rather to
1227 /// consult gtk_cell_area_context_get_preferred_width() after a series of
1228 /// requests.
1229 ///
1230 /// # Deprecated since 4.10
1231 ///
1232 /// ## `context`
1233 /// the [`CellArea`][crate::CellArea]Context to perform this request with
1234 /// ## `widget`
1235 /// the [`Widget`][crate::Widget] where @self will be rendering
1236 ///
1237 /// # Returns
1238 ///
1239 ///
1240 /// ## `minimum_width`
1241 /// location to store the minimum width
1242 ///
1243 /// ## `natural_width`
1244 /// location to store the natural width
1245 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1246 #[allow(deprecated)]
1247 #[doc(alias = "gtk_cell_area_get_preferred_width")]
1248 #[doc(alias = "get_preferred_width")]
1249 fn preferred_width(
1250 &self,
1251 context: &impl IsA<CellAreaContext>,
1252 widget: &impl IsA<Widget>,
1253 ) -> (i32, i32) {
1254 unsafe {
1255 let mut minimum_width = std::mem::MaybeUninit::uninit();
1256 let mut natural_width = std::mem::MaybeUninit::uninit();
1257 ffi::gtk_cell_area_get_preferred_width(
1258 self.as_ref().to_glib_none().0,
1259 context.as_ref().to_glib_none().0,
1260 widget.as_ref().to_glib_none().0,
1261 minimum_width.as_mut_ptr(),
1262 natural_width.as_mut_ptr(),
1263 );
1264 (minimum_width.assume_init(), natural_width.assume_init())
1265 }
1266 }
1267
1268 /// Retrieves a cell area’s minimum and natural width if it would be given
1269 /// the specified @height.
1270 ///
1271 /// @self stores some geometrical information in @context along the way
1272 /// while calling gtk_cell_area_get_preferred_height(). It’s important to
1273 /// perform a series of gtk_cell_area_get_preferred_height() requests with
1274 /// @context first and then call gtk_cell_area_get_preferred_width_for_height()
1275 /// on each cell area individually to get the height for width of each
1276 /// fully requested row.
1277 ///
1278 /// If at some point, the height of a single row changes, it should be
1279 /// requested with gtk_cell_area_get_preferred_height() again and then
1280 /// the full height of the requested rows checked again with
1281 /// gtk_cell_area_context_get_preferred_height().
1282 ///
1283 /// # Deprecated since 4.10
1284 ///
1285 /// ## `context`
1286 /// the [`CellArea`][crate::CellArea]Context which has already been requested for widths.
1287 /// ## `widget`
1288 /// the [`Widget`][crate::Widget] where @self will be rendering
1289 /// ## `height`
1290 /// the height for which to check the width of this area
1291 ///
1292 /// # Returns
1293 ///
1294 ///
1295 /// ## `minimum_width`
1296 /// location to store the minimum width
1297 ///
1298 /// ## `natural_width`
1299 /// location to store the natural width
1300 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1301 #[allow(deprecated)]
1302 #[doc(alias = "gtk_cell_area_get_preferred_width_for_height")]
1303 #[doc(alias = "get_preferred_width_for_height")]
1304 fn preferred_width_for_height(
1305 &self,
1306 context: &impl IsA<CellAreaContext>,
1307 widget: &impl IsA<Widget>,
1308 height: i32,
1309 ) -> (i32, i32) {
1310 unsafe {
1311 let mut minimum_width = std::mem::MaybeUninit::uninit();
1312 let mut natural_width = std::mem::MaybeUninit::uninit();
1313 ffi::gtk_cell_area_get_preferred_width_for_height(
1314 self.as_ref().to_glib_none().0,
1315 context.as_ref().to_glib_none().0,
1316 widget.as_ref().to_glib_none().0,
1317 height,
1318 minimum_width.as_mut_ptr(),
1319 natural_width.as_mut_ptr(),
1320 );
1321 (minimum_width.assume_init(), natural_width.assume_init())
1322 }
1323 }
1324
1325 /// Gets whether the area prefers a height-for-width layout
1326 /// or a width-for-height layout.
1327 ///
1328 /// # Returns
1329 ///
1330 /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by @self.
1331 #[doc(alias = "gtk_cell_area_get_request_mode")]
1332 #[doc(alias = "get_request_mode")]
1333 fn request_mode(&self) -> SizeRequestMode {
1334 unsafe {
1335 from_glib(ffi::gtk_cell_area_get_request_mode(
1336 self.as_ref().to_glib_none().0,
1337 ))
1338 }
1339 }
1340
1341 /// Checks if @self contains @renderer.
1342 ///
1343 /// # Deprecated since 4.10
1344 ///
1345 /// ## `renderer`
1346 /// the [`CellRenderer`][crate::CellRenderer] to check
1347 ///
1348 /// # Returns
1349 ///
1350 /// [`true`] if @renderer is in the @self.
1351 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1352 #[allow(deprecated)]
1353 #[doc(alias = "gtk_cell_area_has_renderer")]
1354 fn has_renderer(&self, renderer: &impl IsA<CellRenderer>) -> bool {
1355 unsafe {
1356 from_glib(ffi::gtk_cell_area_has_renderer(
1357 self.as_ref().to_glib_none().0,
1358 renderer.as_ref().to_glib_none().0,
1359 ))
1360 }
1361 }
1362
1363 /// This is a convenience function for [`CellArea`][crate::CellArea] implementations
1364 /// to get the inner area where a given [`CellRenderer`][crate::CellRenderer] will be
1365 /// rendered. It removes any padding previously added by gtk_cell_area_request_renderer().
1366 ///
1367 /// # Deprecated since 4.10
1368 ///
1369 /// ## `widget`
1370 /// the [`Widget`][crate::Widget] that @self is rendering onto
1371 /// ## `cell_area`
1372 /// the @widget relative coordinates where one of @self’s cells
1373 /// is to be placed
1374 ///
1375 /// # Returns
1376 ///
1377 ///
1378 /// ## `inner_area`
1379 /// the return location for the inner cell area
1380 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1381 #[allow(deprecated)]
1382 #[doc(alias = "gtk_cell_area_inner_cell_area")]
1383 fn inner_cell_area(
1384 &self,
1385 widget: &impl IsA<Widget>,
1386 cell_area: &gdk::Rectangle,
1387 ) -> gdk::Rectangle {
1388 unsafe {
1389 let mut inner_area = gdk::Rectangle::uninitialized();
1390 ffi::gtk_cell_area_inner_cell_area(
1391 self.as_ref().to_glib_none().0,
1392 widget.as_ref().to_glib_none().0,
1393 cell_area.to_glib_none().0,
1394 inner_area.to_glib_none_mut().0,
1395 );
1396 inner_area
1397 }
1398 }
1399
1400 /// Returns whether the area can do anything when activated,
1401 /// after applying new attributes to @self.
1402 ///
1403 /// # Deprecated since 4.10
1404 ///
1405 ///
1406 /// # Returns
1407 ///
1408 /// whether @self can do anything when activated.
1409 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1410 #[allow(deprecated)]
1411 #[doc(alias = "gtk_cell_area_is_activatable")]
1412 fn is_activatable(&self) -> bool {
1413 unsafe {
1414 from_glib(ffi::gtk_cell_area_is_activatable(
1415 self.as_ref().to_glib_none().0,
1416 ))
1417 }
1418 }
1419
1420 /// Returns whether @sibling is one of @renderer’s focus siblings
1421 /// (see gtk_cell_area_add_focus_sibling()).
1422 ///
1423 /// # Deprecated since 4.10
1424 ///
1425 /// ## `renderer`
1426 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
1427 /// ## `sibling`
1428 /// the [`CellRenderer`][crate::CellRenderer] to check against @renderer’s sibling list
1429 ///
1430 /// # Returns
1431 ///
1432 /// [`true`] if @sibling is a focus sibling of @renderer
1433 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1434 #[allow(deprecated)]
1435 #[doc(alias = "gtk_cell_area_is_focus_sibling")]
1436 fn is_focus_sibling(
1437 &self,
1438 renderer: &impl IsA<CellRenderer>,
1439 sibling: &impl IsA<CellRenderer>,
1440 ) -> bool {
1441 unsafe {
1442 from_glib(ffi::gtk_cell_area_is_focus_sibling(
1443 self.as_ref().to_glib_none().0,
1444 renderer.as_ref().to_glib_none().0,
1445 sibling.as_ref().to_glib_none().0,
1446 ))
1447 }
1448 }
1449
1450 /// Removes @renderer from @self.
1451 ///
1452 /// # Deprecated since 4.10
1453 ///
1454 /// ## `renderer`
1455 /// the [`CellRenderer`][crate::CellRenderer] to remove from @self
1456 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1457 #[allow(deprecated)]
1458 #[doc(alias = "gtk_cell_area_remove")]
1459 fn remove(&self, renderer: &impl IsA<CellRenderer>) {
1460 unsafe {
1461 ffi::gtk_cell_area_remove(
1462 self.as_ref().to_glib_none().0,
1463 renderer.as_ref().to_glib_none().0,
1464 );
1465 }
1466 }
1467
1468 /// Removes @sibling from @renderer’s focus sibling list
1469 /// (see gtk_cell_area_add_focus_sibling()).
1470 ///
1471 /// # Deprecated since 4.10
1472 ///
1473 /// ## `renderer`
1474 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
1475 /// ## `sibling`
1476 /// the [`CellRenderer`][crate::CellRenderer] to remove from @renderer’s focus area
1477 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1478 #[allow(deprecated)]
1479 #[doc(alias = "gtk_cell_area_remove_focus_sibling")]
1480 fn remove_focus_sibling(
1481 &self,
1482 renderer: &impl IsA<CellRenderer>,
1483 sibling: &impl IsA<CellRenderer>,
1484 ) {
1485 unsafe {
1486 ffi::gtk_cell_area_remove_focus_sibling(
1487 self.as_ref().to_glib_none().0,
1488 renderer.as_ref().to_glib_none().0,
1489 sibling.as_ref().to_glib_none().0,
1490 );
1491 }
1492 }
1493
1494 /// This is a convenience function for [`CellArea`][crate::CellArea] implementations
1495 /// to request size for cell renderers. It’s important to use this
1496 /// function to request size and then use gtk_cell_area_inner_cell_area()
1497 /// at render and event time since this function will add padding
1498 /// around the cell for focus painting.
1499 ///
1500 /// # Deprecated since 4.10
1501 ///
1502 /// ## `renderer`
1503 /// the [`CellRenderer`][crate::CellRenderer] to request size for
1504 /// ## `orientation`
1505 /// the [`Orientation`][crate::Orientation] in which to request size
1506 /// ## `widget`
1507 /// the [`Widget`][crate::Widget] that @self is rendering onto
1508 /// ## `for_size`
1509 /// the allocation contextual size to request for, or -1 if
1510 /// the base request for the orientation is to be returned.
1511 ///
1512 /// # Returns
1513 ///
1514 ///
1515 /// ## `minimum_size`
1516 /// location to store the minimum size
1517 ///
1518 /// ## `natural_size`
1519 /// location to store the natural size
1520 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1521 #[allow(deprecated)]
1522 #[doc(alias = "gtk_cell_area_request_renderer")]
1523 fn request_renderer(
1524 &self,
1525 renderer: &impl IsA<CellRenderer>,
1526 orientation: Orientation,
1527 widget: &impl IsA<Widget>,
1528 for_size: i32,
1529 ) -> (i32, i32) {
1530 unsafe {
1531 let mut minimum_size = std::mem::MaybeUninit::uninit();
1532 let mut natural_size = std::mem::MaybeUninit::uninit();
1533 ffi::gtk_cell_area_request_renderer(
1534 self.as_ref().to_glib_none().0,
1535 renderer.as_ref().to_glib_none().0,
1536 orientation.into_glib(),
1537 widget.as_ref().to_glib_none().0,
1538 for_size,
1539 minimum_size.as_mut_ptr(),
1540 natural_size.as_mut_ptr(),
1541 );
1542 (minimum_size.assume_init(), natural_size.assume_init())
1543 }
1544 }
1545
1546 /// Explicitly sets the currently focused cell to @renderer.
1547 ///
1548 /// This is generally called by implementations of
1549 /// `GtkCellAreaClass.focus()` or `GtkCellAreaClass.event()`,
1550 /// however it can also be used to implement functions such
1551 /// as gtk_tree_view_set_cursor_on_cell().
1552 ///
1553 /// # Deprecated since 4.10
1554 ///
1555 /// ## `renderer`
1556 /// the [`CellRenderer`][crate::CellRenderer] to give focus to
1557 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1558 #[allow(deprecated)]
1559 #[doc(alias = "gtk_cell_area_set_focus_cell")]
1560 #[doc(alias = "focus-cell")]
1561 fn set_focus_cell(&self, renderer: Option<&impl IsA<CellRenderer>>) {
1562 unsafe {
1563 ffi::gtk_cell_area_set_focus_cell(
1564 self.as_ref().to_glib_none().0,
1565 renderer.map(|p| p.as_ref()).to_glib_none().0,
1566 );
1567 }
1568 }
1569
1570 /// Snapshots @self’s cells according to @self’s layout onto at
1571 /// the given coordinates.
1572 ///
1573 /// # Deprecated since 4.10
1574 ///
1575 /// ## `context`
1576 /// the [`CellArea`][crate::CellArea]Context for this row of data.
1577 /// ## `widget`
1578 /// the [`Widget`][crate::Widget] that @self is rendering to
1579 /// ## `snapshot`
1580 /// the [`Snapshot`][crate::Snapshot] to draw to
1581 /// ## `background_area`
1582 /// the @widget relative coordinates for @self’s background
1583 /// ## `cell_area`
1584 /// the @widget relative coordinates for @self
1585 /// ## `flags`
1586 /// the [`CellRenderer`][crate::CellRenderer]State for @self in this row.
1587 /// ## `paint_focus`
1588 /// whether @self should paint focus on focused cells for focused rows or not.
1589 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1590 #[allow(deprecated)]
1591 #[doc(alias = "gtk_cell_area_snapshot")]
1592 fn snapshot(
1593 &self,
1594 context: &impl IsA<CellAreaContext>,
1595 widget: &impl IsA<Widget>,
1596 snapshot: &impl IsA<Snapshot>,
1597 background_area: &gdk::Rectangle,
1598 cell_area: &gdk::Rectangle,
1599 flags: CellRendererState,
1600 paint_focus: bool,
1601 ) {
1602 unsafe {
1603 ffi::gtk_cell_area_snapshot(
1604 self.as_ref().to_glib_none().0,
1605 context.as_ref().to_glib_none().0,
1606 widget.as_ref().to_glib_none().0,
1607 snapshot.as_ref().to_glib_none().0,
1608 background_area.to_glib_none().0,
1609 cell_area.to_glib_none().0,
1610 flags.into_glib(),
1611 paint_focus.into_glib(),
1612 );
1613 }
1614 }
1615
1616 /// Explicitly stops the editing of the currently edited cell.
1617 ///
1618 /// If @canceled is [`true`], the currently edited cell renderer
1619 /// will emit the ::editing-canceled signal, otherwise the
1620 /// the ::editing-done signal will be emitted on the current
1621 /// edit widget.
1622 ///
1623 /// See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget().
1624 ///
1625 /// # Deprecated since 4.10
1626 ///
1627 /// ## `canceled`
1628 /// whether editing was canceled.
1629 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1630 #[allow(deprecated)]
1631 #[doc(alias = "gtk_cell_area_stop_editing")]
1632 fn stop_editing(&self, canceled: bool) {
1633 unsafe {
1634 ffi::gtk_cell_area_stop_editing(self.as_ref().to_glib_none().0, canceled.into_glib());
1635 }
1636 }
1637
1638 /// Indicates that editing has started on @renderer and that @editable
1639 /// should be added to the owning cell-layouting widget at @cell_area.
1640 /// ## `renderer`
1641 /// the [`CellRenderer`][crate::CellRenderer] that started the edited
1642 /// ## `editable`
1643 /// the [`CellEditable`][crate::CellEditable] widget to add
1644 /// ## `cell_area`
1645 /// the [`Widget`][crate::Widget] relative [`gdk::Rectangle`][crate::gdk::Rectangle] coordinates
1646 /// where @editable should be added
1647 /// ## `path`
1648 /// the [`TreePath`][crate::TreePath] string this edit was initiated for
1649 #[doc(alias = "add-editable")]
1650 fn connect_add_editable<
1651 F: Fn(&Self, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
1652 >(
1653 &self,
1654 f: F,
1655 ) -> SignalHandlerId {
1656 unsafe extern "C" fn add_editable_trampoline<
1657 P: IsA<CellArea>,
1658 F: Fn(&P, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
1659 >(
1660 this: *mut ffi::GtkCellArea,
1661 renderer: *mut ffi::GtkCellRenderer,
1662 editable: *mut ffi::GtkCellEditable,
1663 cell_area: *mut gdk::ffi::GdkRectangle,
1664 path: *mut std::ffi::c_char,
1665 f: glib::ffi::gpointer,
1666 ) {
1667 let f: &F = &*(f as *const F);
1668 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1669 f(
1670 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1671 &from_glib_borrow(renderer),
1672 &from_glib_borrow(editable),
1673 &from_glib_borrow(cell_area),
1674 path,
1675 )
1676 }
1677 unsafe {
1678 let f: Box_<F> = Box_::new(f);
1679 connect_raw(
1680 self.as_ptr() as *mut _,
1681 c"add-editable".as_ptr() as *const _,
1682 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1683 add_editable_trampoline::<Self, F> as *const (),
1684 )),
1685 Box_::into_raw(f),
1686 )
1687 }
1688 }
1689
1690 /// This signal is emitted whenever applying attributes to @area from @model
1691 /// ## `model`
1692 /// the [`TreeModel`][crate::TreeModel] to apply the attributes from
1693 /// ## `iter`
1694 /// the [`TreeIter`][crate::TreeIter] indicating which row to apply the attributes of
1695 /// ## `is_expander`
1696 /// whether the view shows children for this row
1697 /// ## `is_expanded`
1698 /// whether the view is currently showing the children of this row
1699 #[doc(alias = "apply-attributes")]
1700 fn connect_apply_attributes<F: Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>(
1701 &self,
1702 f: F,
1703 ) -> SignalHandlerId {
1704 unsafe extern "C" fn apply_attributes_trampoline<
1705 P: IsA<CellArea>,
1706 F: Fn(&P, &TreeModel, &TreeIter, bool, bool) + 'static,
1707 >(
1708 this: *mut ffi::GtkCellArea,
1709 model: *mut ffi::GtkTreeModel,
1710 iter: *mut ffi::GtkTreeIter,
1711 is_expander: glib::ffi::gboolean,
1712 is_expanded: glib::ffi::gboolean,
1713 f: glib::ffi::gpointer,
1714 ) {
1715 let f: &F = &*(f as *const F);
1716 f(
1717 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1718 &from_glib_borrow(model),
1719 &from_glib_borrow(iter),
1720 from_glib(is_expander),
1721 from_glib(is_expanded),
1722 )
1723 }
1724 unsafe {
1725 let f: Box_<F> = Box_::new(f);
1726 connect_raw(
1727 self.as_ptr() as *mut _,
1728 c"apply-attributes".as_ptr() as *const _,
1729 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1730 apply_attributes_trampoline::<Self, F> as *const (),
1731 )),
1732 Box_::into_raw(f),
1733 )
1734 }
1735 }
1736
1737 /// Indicates that focus changed on this @area. This signal
1738 /// is emitted either as a result of focus handling or event
1739 /// handling.
1740 ///
1741 /// It's possible that the signal is emitted even if the
1742 /// currently focused renderer did not change, this is
1743 /// because focus may change to the same renderer in the
1744 /// same cell area for a different row of data.
1745 /// ## `renderer`
1746 /// the [`CellRenderer`][crate::CellRenderer] that has focus
1747 /// ## `path`
1748 /// the current [`TreePath`][crate::TreePath] string set for @area
1749 #[doc(alias = "focus-changed")]
1750 fn connect_focus_changed<F: Fn(&Self, &CellRenderer, TreePath) + 'static>(
1751 &self,
1752 f: F,
1753 ) -> SignalHandlerId {
1754 unsafe extern "C" fn focus_changed_trampoline<
1755 P: IsA<CellArea>,
1756 F: Fn(&P, &CellRenderer, TreePath) + 'static,
1757 >(
1758 this: *mut ffi::GtkCellArea,
1759 renderer: *mut ffi::GtkCellRenderer,
1760 path: *mut std::ffi::c_char,
1761 f: glib::ffi::gpointer,
1762 ) {
1763 let f: &F = &*(f as *const F);
1764 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1765 f(
1766 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1767 &from_glib_borrow(renderer),
1768 path,
1769 )
1770 }
1771 unsafe {
1772 let f: Box_<F> = Box_::new(f);
1773 connect_raw(
1774 self.as_ptr() as *mut _,
1775 c"focus-changed".as_ptr() as *const _,
1776 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1777 focus_changed_trampoline::<Self, F> as *const (),
1778 )),
1779 Box_::into_raw(f),
1780 )
1781 }
1782 }
1783
1784 /// Indicates that editing finished on @renderer and that @editable
1785 /// should be removed from the owning cell-layouting widget.
1786 /// ## `renderer`
1787 /// the [`CellRenderer`][crate::CellRenderer] that finished editeding
1788 /// ## `editable`
1789 /// the [`CellEditable`][crate::CellEditable] widget to remove
1790 #[doc(alias = "remove-editable")]
1791 fn connect_remove_editable<F: Fn(&Self, &CellRenderer, &CellEditable) + 'static>(
1792 &self,
1793 f: F,
1794 ) -> SignalHandlerId {
1795 unsafe extern "C" fn remove_editable_trampoline<
1796 P: IsA<CellArea>,
1797 F: Fn(&P, &CellRenderer, &CellEditable) + 'static,
1798 >(
1799 this: *mut ffi::GtkCellArea,
1800 renderer: *mut ffi::GtkCellRenderer,
1801 editable: *mut ffi::GtkCellEditable,
1802 f: glib::ffi::gpointer,
1803 ) {
1804 let f: &F = &*(f as *const F);
1805 f(
1806 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1807 &from_glib_borrow(renderer),
1808 &from_glib_borrow(editable),
1809 )
1810 }
1811 unsafe {
1812 let f: Box_<F> = Box_::new(f);
1813 connect_raw(
1814 self.as_ptr() as *mut _,
1815 c"remove-editable".as_ptr() as *const _,
1816 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1817 remove_editable_trampoline::<Self, F> as *const (),
1818 )),
1819 Box_::into_raw(f),
1820 )
1821 }
1822 }
1823
1824 #[doc(alias = "edit-widget")]
1825 fn connect_edit_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1826 unsafe extern "C" fn notify_edit_widget_trampoline<
1827 P: IsA<CellArea>,
1828 F: Fn(&P) + 'static,
1829 >(
1830 this: *mut ffi::GtkCellArea,
1831 _param_spec: glib::ffi::gpointer,
1832 f: glib::ffi::gpointer,
1833 ) {
1834 let f: &F = &*(f as *const F);
1835 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1836 }
1837 unsafe {
1838 let f: Box_<F> = Box_::new(f);
1839 connect_raw(
1840 self.as_ptr() as *mut _,
1841 c"notify::edit-widget".as_ptr() as *const _,
1842 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1843 notify_edit_widget_trampoline::<Self, F> as *const (),
1844 )),
1845 Box_::into_raw(f),
1846 )
1847 }
1848 }
1849
1850 #[doc(alias = "edited-cell")]
1851 fn connect_edited_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1852 unsafe extern "C" fn notify_edited_cell_trampoline<
1853 P: IsA<CellArea>,
1854 F: Fn(&P) + 'static,
1855 >(
1856 this: *mut ffi::GtkCellArea,
1857 _param_spec: glib::ffi::gpointer,
1858 f: glib::ffi::gpointer,
1859 ) {
1860 let f: &F = &*(f as *const F);
1861 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1862 }
1863 unsafe {
1864 let f: Box_<F> = Box_::new(f);
1865 connect_raw(
1866 self.as_ptr() as *mut _,
1867 c"notify::edited-cell".as_ptr() as *const _,
1868 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1869 notify_edited_cell_trampoline::<Self, F> as *const (),
1870 )),
1871 Box_::into_raw(f),
1872 )
1873 }
1874 }
1875
1876 #[doc(alias = "focus-cell")]
1877 fn connect_focus_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1878 unsafe extern "C" fn notify_focus_cell_trampoline<P: IsA<CellArea>, F: Fn(&P) + 'static>(
1879 this: *mut ffi::GtkCellArea,
1880 _param_spec: glib::ffi::gpointer,
1881 f: glib::ffi::gpointer,
1882 ) {
1883 let f: &F = &*(f as *const F);
1884 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1885 }
1886 unsafe {
1887 let f: Box_<F> = Box_::new(f);
1888 connect_raw(
1889 self.as_ptr() as *mut _,
1890 c"notify::focus-cell".as_ptr() as *const _,
1891 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1892 notify_focus_cell_trampoline::<Self, F> as *const (),
1893 )),
1894 Box_::into_raw(f),
1895 )
1896 }
1897 }
1898}
1899
1900impl<O: IsA<CellArea>> CellAreaExt for O {}