gtk4/auto/cell_area.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6use crate::{
7 Buildable, CellAreaContext, CellEditable, CellLayout, CellRenderer, CellRendererState,
8 DirectionType, Orientation, SizeRequestMode, Snapshot, TreeIter, TreeModel, TreePath, Widget,
9 ffi,
10};
11use glib::{
12 object::ObjectType as _,
13 prelude::*,
14 signal::{SignalHandlerId, connect_raw},
15 translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20 /// List views use widgets for displaying their
21 /// contents
22 /// An abstract class for laying out [`CellRenderer`][crate::CellRenderer]s
23 ///
24 /// The [`CellArea`][crate::CellArea] is an abstract class for [`CellLayout`][crate::CellLayout]
25 /// widgets (also referred to as "layouting widgets") to interface with
26 /// an arbitrary number of [`CellRenderer`][crate::CellRenderer]s and interact with the user
27 /// for a given [`TreeModel`][crate::TreeModel] row.
28 ///
29 /// The cell area handles events, focus navigation, drawing and
30 /// size requests and allocations for a given row of data.
31 ///
32 /// Usually users dont have to interact with the [`CellArea`][crate::CellArea] directly
33 /// unless they are implementing a cell-layouting widget themselves.
34 ///
35 /// ## Requesting area sizes
36 ///
37 /// As outlined in
38 /// [GtkWidget’s geometry management section](class.Widget.html#height-for-width-geometry-management),
39 /// GTK uses a height-for-width
40 /// geometry management system to compute the sizes of widgets and user
41 /// interfaces. [`CellArea`][crate::CellArea] uses the same semantics to calculate the
42 /// size of an area for an arbitrary number of [`TreeModel`][crate::TreeModel] rows.
43 ///
44 /// When requesting the size of a cell area one needs to calculate
45 /// the size for a handful of rows, and this will be done differently by
46 /// different layouting widgets. For instance a [`TreeViewColumn`][crate::TreeViewColumn]
47 /// always lines up the areas from top to bottom while a [`IconView`][crate::IconView]
48 /// on the other hand might enforce that all areas received the same
49 /// width and wrap the areas around, requesting height for more cell
50 /// areas when allocated less width.
51 ///
52 /// It’s also important for areas to maintain some cell
53 /// alignments with areas rendered for adjacent rows (cells can
54 /// appear “columnized” inside an area even when the size of
55 /// cells are different in each row). For this reason the [`CellArea`][crate::CellArea]
56 /// uses a [`CellAreaContext`][crate::CellAreaContext] object to store the alignments
57 /// and sizes along the way (as well as the overall largest minimum
58 /// and natural size for all the rows which have been calculated
59 /// with the said context).
60 ///
61 /// The [`CellAreaContext`][crate::CellAreaContext] is an opaque object specific to the
62 /// [`CellArea`][crate::CellArea] which created it (see [`CellAreaExt::create_context()`][crate::prelude::CellAreaExt::create_context()]).
63 ///
64 /// The owning cell-layouting widget can create as many contexts as
65 /// it wishes to calculate sizes of rows which should receive the
66 /// same size in at least one orientation (horizontally or vertically),
67 /// However, it’s important that the same [`CellAreaContext`][crate::CellAreaContext] which
68 /// was used to request the sizes for a given [`TreeModel`][crate::TreeModel] row be
69 /// used when rendering or processing events for that row.
70 ///
71 /// In order to request the width of all the rows at the root level
72 /// of a [`TreeModel`][crate::TreeModel] one would do the following:
73 ///
74 /// **⚠️ The following code is in c ⚠️**
75 ///
76 /// ```c
77 /// GtkTreeIter iter;
78 /// int minimum_width;
79 /// int natural_width;
80 ///
81 /// valid = gtk_tree_model_get_iter_first (model, &iter);
82 /// while (valid)
83 /// {
84 /// gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
85 /// gtk_cell_area_get_preferred_width (area, context, widget, NULL, NULL);
86 ///
87 /// valid = gtk_tree_model_iter_next (model, &iter);
88 /// }
89 ///
90 /// gtk_cell_area_context_get_preferred_width (context, &minimum_width, &natural_width);
91 /// ```
92 ///
93 /// Note that in this example it’s not important to observe the
94 /// returned minimum and natural width of the area for each row
95 /// unless the cell-layouting object is actually interested in the
96 /// widths of individual rows. The overall width is however stored
97 /// in the accompanying [`CellAreaContext`][crate::CellAreaContext] object and can be consulted
98 /// at any time.
99 ///
100 /// This can be useful since [`CellLayout`][crate::CellLayout] widgets usually have to
101 /// support requesting and rendering rows in treemodels with an
102 /// exceedingly large amount of rows. The [`CellLayout`][crate::CellLayout] widget in
103 /// that case would calculate the required width of the rows in an
104 /// idle or timeout source (see `timeout_add()`) and when the widget
105 /// is requested its actual width in [`WidgetImpl::measure()`][crate::subclass::prelude::WidgetImpl::measure()]
106 /// it can simply consult the width accumulated so far in the
107 /// [`CellAreaContext`][crate::CellAreaContext] object.
108 ///
109 /// A simple example where rows are rendered from top to bottom and
110 /// take up the full width of the layouting widget would look like:
111 ///
112 /// **⚠️ The following code is in c ⚠️**
113 ///
114 /// ```c
115 /// static void
116 /// foo_get_preferred_width (GtkWidget *widget,
117 /// int *minimum_size,
118 /// int *natural_size)
119 /// {
120 /// Foo *self = FOO (widget);
121 /// FooPrivate *priv = foo_get_instance_private (self);
122 ///
123 /// foo_ensure_at_least_one_handfull_of_rows_have_been_requested (self);
124 ///
125 /// gtk_cell_area_context_get_preferred_width (priv->context, minimum_size, natural_size);
126 /// }
127 /// ```
128 ///
129 /// In the above example the `Foo` widget has to make sure that some
130 /// row sizes have been calculated (the amount of rows that `Foo` judged
131 /// was appropriate to request space for in a single timeout iteration)
132 /// before simply returning the amount of space required by the area via
133 /// the [`CellAreaContext`][crate::CellAreaContext].
134 ///
135 /// Requesting the height for width (or width for height) of an area is
136 /// a similar task except in this case the [`CellAreaContext`][crate::CellAreaContext] does not
137 /// store the data (actually, it does not know how much space the layouting
138 /// widget plans to allocate it for every row. It’s up to the layouting
139 /// widget to render each row of data with the appropriate height and
140 /// width which was requested by the [`CellArea`][crate::CellArea]).
141 ///
142 /// In order to request the height for width of all the rows at the
143 /// root level of a [`TreeModel`][crate::TreeModel] one would do the following:
144 ///
145 /// **⚠️ The following code is in c ⚠️**
146 ///
147 /// ```c
148 /// GtkTreeIter iter;
149 /// int minimum_height;
150 /// int natural_height;
151 /// int full_minimum_height = 0;
152 /// int full_natural_height = 0;
153 ///
154 /// valid = gtk_tree_model_get_iter_first (model, &iter);
155 /// while (valid)
156 /// {
157 /// gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
158 /// gtk_cell_area_get_preferred_height_for_width (area, context, widget,
159 /// width, &minimum_height, &natural_height);
160 ///
161 /// if (width_is_for_allocation)
162 /// cache_row_height (&iter, minimum_height, natural_height);
163 ///
164 /// full_minimum_height += minimum_height;
165 /// full_natural_height += natural_height;
166 ///
167 /// valid = gtk_tree_model_iter_next (model, &iter);
168 /// }
169 /// ```
170 ///
171 /// Note that in the above example we would need to cache the heights
172 /// returned for each row so that we would know what sizes to render the
173 /// areas for each row. However we would only want to really cache the
174 /// heights if the request is intended for the layouting widgets real
175 /// allocation.
176 ///
177 /// In some cases the layouting widget is requested the height for an
178 /// arbitrary for_width, this is a special case for layouting widgets
179 /// who need to request size for tens of thousands of rows. For this
180 /// case it’s only important that the layouting widget calculate
181 /// one reasonably sized chunk of rows and return that height
182 /// synchronously. The reasoning here is that any layouting widget is
183 /// at least capable of synchronously calculating enough height to fill
184 /// the screen height (or scrolled window height) in response to a single
185 /// call to [`WidgetImpl::measure()`][crate::subclass::prelude::WidgetImpl::measure()]. Returning
186 /// a perfect height for width that is larger than the screen area is
187 /// inconsequential since after the layouting receives an allocation
188 /// from a scrolled window it simply continues to drive the scrollbar
189 /// values while more and more height is required for the row heights
190 /// that are calculated in the background.
191 ///
192 /// ## Rendering Areas
193 ///
194 /// Once area sizes have been acquired at least for the rows in the
195 /// visible area of the layouting widget they can be rendered at
196 /// [`WidgetImpl::snapshot()`][crate::subclass::prelude::WidgetImpl::snapshot()] time.
197 ///
198 /// A crude example of how to render all the rows at the root level
199 /// runs as follows:
200 ///
201 /// **⚠️ The following code is in c ⚠️**
202 ///
203 /// ```c
204 /// GtkAllocation allocation;
205 /// GdkRectangle cell_area = { 0, };
206 /// GtkTreeIter iter;
207 /// int minimum_width;
208 /// int natural_width;
209 ///
210 /// gtk_widget_get_allocation (widget, &allocation);
211 /// cell_area.width = allocation.width;
212 ///
213 /// valid = gtk_tree_model_get_iter_first (model, &iter);
214 /// while (valid)
215 /// {
216 /// cell_area.height = get_cached_height_for_row (&iter);
217 ///
218 /// gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
219 /// gtk_cell_area_render (area, context, widget, cr,
220 /// &cell_area, &cell_area, state_flags, FALSE);
221 ///
222 /// cell_area.y += cell_area.height;
223 ///
224 /// valid = gtk_tree_model_iter_next (model, &iter);
225 /// }
226 /// ```
227 ///
228 /// Note that the cached height in this example really depends on how
229 /// the layouting widget works. The layouting widget might decide to
230 /// give every row its minimum or natural height or, if the model content
231 /// is expected to fit inside the layouting widget without scrolling, it
232 /// would make sense to calculate the allocation for each row at
233 /// the time the widget is allocated using `distribute_natural_allocation()`.
234 ///
235 /// ## Handling Events and Driving Keyboard Focus
236 ///
237 /// Passing events to the area is as simple as handling events on any
238 /// normal widget and then passing them to the [`CellAreaExt::event()`][crate::prelude::CellAreaExt::event()]
239 /// API as they come in. Usually [`CellArea`][crate::CellArea] is only interested in
240 /// button events, however some customized derived areas can be implemented
241 /// who are interested in handling other events. Handling an event can
242 /// trigger the [`focus-changed`][struct@crate::CellArea#focus-changed] signal to fire; as well
243 /// as [`add-editable`][struct@crate::CellArea#add-editable] in the case that an editable cell
244 /// was clicked and needs to start editing. You can call
245 /// [`CellAreaExt::stop_editing()`][crate::prelude::CellAreaExt::stop_editing()] at any time to cancel any cell editing
246 /// that is currently in progress.
247 ///
248 /// The [`CellArea`][crate::CellArea] drives keyboard focus from cell to cell in a way
249 /// similar to [`Widget`][crate::Widget]. For layouting widgets that support giving
250 /// focus to cells it’s important to remember to pass `GTK_CELL_RENDERER_FOCUSED`
251 /// to the area functions for the row that has focus and to tell the
252 /// area to paint the focus at render time.
253 ///
254 /// Layouting widgets that accept focus on cells should implement the
255 /// [`WidgetImpl::focus()`][crate::subclass::prelude::WidgetImpl::focus()] virtual method. The layouting widget is always
256 /// responsible for knowing where [`TreeModel`][crate::TreeModel] rows are rendered inside
257 /// the widget, so at [`WidgetImpl::focus()`][crate::subclass::prelude::WidgetImpl::focus()] time the layouting widget
258 /// should use the [`CellArea`][crate::CellArea] methods to navigate focus inside the area
259 /// and then observe the [`DirectionType`][crate::DirectionType] to pass the focus to adjacent
260 /// rows and areas.
261 ///
262 /// A basic example of how the [`WidgetImpl::focus()`][crate::subclass::prelude::WidgetImpl::focus()] virtual method
263 /// should be implemented:
264 ///
265 /// ```text
266 /// static gboolean
267 /// foo_focus (GtkWidget *widget,
268 /// GtkDirectionType direction)
269 /// {
270 /// Foo *self = FOO (widget);
271 /// FooPrivate *priv = foo_get_instance_private (self);
272 /// int focus_row = priv->focus_row;
273 /// gboolean have_focus = FALSE;
274 ///
275 /// if (!gtk_widget_has_focus (widget))
276 /// gtk_widget_grab_focus (widget);
277 ///
278 /// valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, priv->focus_row);
279 /// while (valid)
280 /// {
281 /// gtk_cell_area_apply_attributes (priv->area, priv->model, &iter, FALSE, FALSE);
282 ///
283 /// if (gtk_cell_area_focus (priv->area, direction))
284 /// {
285 /// priv->focus_row = focus_row;
286 /// have_focus = TRUE;
287 /// break;
288 /// }
289 /// else
290 /// {
291 /// if (direction == GTK_DIR_RIGHT ||
292 /// direction == GTK_DIR_LEFT)
293 /// break;
294 /// else if (direction == GTK_DIR_UP ||
295 /// direction == GTK_DIR_TAB_BACKWARD)
296 /// {
297 /// if (focus_row == 0)
298 /// break;
299 /// else
300 /// {
301 /// focus_row--;
302 /// valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, focus_row);
303 /// }
304 /// }
305 /// else
306 /// {
307 /// if (focus_row == last_row)
308 /// break;
309 /// else
310 /// {
311 /// focus_row++;
312 /// valid = gtk_tree_model_iter_next (priv->model, &iter);
313 /// }
314 /// }
315 /// }
316 /// }
317 /// return have_focus;
318 /// }
319 /// ```
320 ///
321 /// Note that the layouting widget is responsible for matching the
322 /// [`DirectionType`][crate::DirectionType] values to the way it lays out its cells.
323 ///
324 /// ## Cell Properties
325 ///
326 /// The [`CellArea`][crate::CellArea] introduces cell properties for [`CellRenderer`][crate::CellRenderer]s.
327 /// This provides some general interfaces for defining the relationship
328 /// cell areas have with their cells. For instance in a [`CellAreaBox`][crate::CellAreaBox]
329 /// a cell might “expand” and receive extra space when the area is allocated
330 /// more than its full natural request, or a cell might be configured to “align”
331 /// with adjacent rows which were requested and rendered with the same
332 /// [`CellAreaContext`][crate::CellAreaContext].
333 ///
334 /// Use [`CellAreaClassExt::install_cell_property()`][crate::subclass::prelude::CellAreaClassExt::install_cell_property()] to install cell
335 /// properties for a cell area class and [`CellAreaClassExt::find_cell_property()`][crate::subclass::prelude::CellAreaClassExt::find_cell_property()]
336 /// or [`CellAreaClassExt::list_cell_properties()`][crate::subclass::prelude::CellAreaClassExt::list_cell_properties()] to get information about
337 /// existing cell properties.
338 ///
339 /// To set the value of a cell property, use [`CellAreaExtManual::cell_set_property()`][crate::prelude::CellAreaExtManual::cell_set_property()],
340 /// `Gtk::CellArea::cell_set()` or `Gtk::CellArea::cell_set_valist()`. To obtain
341 /// the value of a cell property, use [`CellAreaExtManual::cell_get_property()`][crate::prelude::CellAreaExtManual::cell_get_property()]
342 /// `Gtk::CellArea::cell_get()` or `Gtk::CellArea::cell_get_valist()`.
343 ///
344 /// This is an Abstract Base Class, you cannot instantiate it.
345 ///
346 /// ## Properties
347 ///
348 ///
349 /// #### `edit-widget`
350 /// The widget currently editing the edited cell
351 ///
352 /// This property is read-only and only changes as
353 /// a result of a call gtk_cell_area_activate_cell().
354 ///
355 /// Readable
356 ///
357 ///
358 /// #### `edited-cell`
359 /// The cell in the area that is currently edited
360 ///
361 /// This property is read-only and only changes as
362 /// a result of a call gtk_cell_area_activate_cell().
363 ///
364 /// Readable
365 ///
366 ///
367 /// #### `focus-cell`
368 /// The cell in the area that currently has focus
369 ///
370 /// Readable | Writeable
371 ///
372 /// ## Signals
373 ///
374 ///
375 /// #### `add-editable`
376 /// Indicates that editing has started on @renderer and that @editable
377 /// should be added to the owning cell-layouting widget at @cell_area.
378 ///
379 ///
380 ///
381 ///
382 /// #### `apply-attributes`
383 /// This signal is emitted whenever applying attributes to @area from @model
384 ///
385 ///
386 ///
387 ///
388 /// #### `focus-changed`
389 /// Indicates that focus changed on this @area. This signal
390 /// is emitted either as a result of focus handling or event
391 /// handling.
392 ///
393 /// It's possible that the signal is emitted even if the
394 /// currently focused renderer did not change, this is
395 /// because focus may change to the same renderer in the
396 /// same cell area for a different row of data.
397 ///
398 ///
399 ///
400 ///
401 /// #### `remove-editable`
402 /// Indicates that editing finished on @renderer and that @editable
403 /// should be removed from the owning cell-layouting widget.
404 ///
405 ///
406 ///
407 /// # Implements
408 ///
409 /// [`CellAreaExt`][trait@crate::prelude::CellAreaExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`CellLayoutExt`][trait@crate::prelude::CellLayoutExt], [`CellAreaExtManual`][trait@crate::prelude::CellAreaExtManual], [`CellLayoutExtManual`][trait@crate::prelude::CellLayoutExtManual]
410 #[doc(alias = "GtkCellArea")]
411 pub struct CellArea(Object<ffi::GtkCellArea, ffi::GtkCellAreaClass>) @implements Buildable, CellLayout;
412
413 match fn {
414 type_ => || ffi::gtk_cell_area_get_type(),
415 }
416}
417
418impl CellArea {
419 pub const NONE: Option<&'static CellArea> = None;
420}
421
422/// Trait containing all [`struct@CellArea`] methods.
423///
424/// # Implementors
425///
426/// [`CellAreaBox`][struct@crate::CellAreaBox], [`CellArea`][struct@crate::CellArea]
427pub trait CellAreaExt: IsA<CellArea> + 'static {
428 /// Activates @self, usually by activating the currently focused
429 /// cell, however some subclasses which embed widgets in the area
430 /// can also activate a widget if it currently has the focus.
431 ///
432 /// # Deprecated since 4.10
433 ///
434 /// ## `context`
435 /// the [`CellArea`][crate::CellArea]Context in context with the current row data
436 /// ## `widget`
437 /// the [`Widget`][crate::Widget] that @self is rendering on
438 /// ## `cell_area`
439 /// the size and location of @self relative to @widget’s allocation
440 /// ## `flags`
441 /// the [`CellRenderer`][crate::CellRenderer]State flags for @self for this row of data.
442 /// ## `edit_only`
443 /// if [`true`] then only cell renderers that are [`CellRendererMode::Editable`][crate::CellRendererMode::Editable]
444 /// will be activated.
445 ///
446 /// # Returns
447 ///
448 /// Whether @self was successfully activated.
449 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
450 #[allow(deprecated)]
451 #[doc(alias = "gtk_cell_area_activate")]
452 fn activate(
453 &self,
454 context: &impl IsA<CellAreaContext>,
455 widget: &impl IsA<Widget>,
456 cell_area: &gdk::Rectangle,
457 flags: CellRendererState,
458 edit_only: bool,
459 ) -> bool {
460 unsafe {
461 from_glib(ffi::gtk_cell_area_activate(
462 self.as_ref().to_glib_none().0,
463 context.as_ref().to_glib_none().0,
464 widget.as_ref().to_glib_none().0,
465 cell_area.to_glib_none().0,
466 flags.into_glib(),
467 edit_only.into_glib(),
468 ))
469 }
470 }
471
472 /// This is used by [`CellArea`][crate::CellArea] subclasses when handling events
473 /// to activate cells, the base [`CellArea`][crate::CellArea] class activates cells
474 /// for keyboard events for free in its own GtkCellArea->activate()
475 /// implementation.
476 ///
477 /// # Deprecated since 4.10
478 ///
479 /// ## `widget`
480 /// the [`Widget`][crate::Widget] that @self is rendering onto
481 /// ## `renderer`
482 /// the [`CellRenderer`][crate::CellRenderer] in @self to activate
483 /// ## `event`
484 /// the [`gdk::Event`][crate::gdk::Event] for which cell activation should occur
485 /// ## `cell_area`
486 /// the [`gdk::Rectangle`][crate::gdk::Rectangle] in @widget relative coordinates
487 /// of @renderer for the current row.
488 /// ## `flags`
489 /// the [`CellRenderer`][crate::CellRenderer]State for @renderer
490 ///
491 /// # Returns
492 ///
493 /// whether cell activation was successful
494 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
495 #[allow(deprecated)]
496 #[doc(alias = "gtk_cell_area_activate_cell")]
497 fn activate_cell(
498 &self,
499 widget: &impl IsA<Widget>,
500 renderer: &impl IsA<CellRenderer>,
501 event: impl AsRef<gdk::Event>,
502 cell_area: &gdk::Rectangle,
503 flags: CellRendererState,
504 ) -> bool {
505 unsafe {
506 from_glib(ffi::gtk_cell_area_activate_cell(
507 self.as_ref().to_glib_none().0,
508 widget.as_ref().to_glib_none().0,
509 renderer.as_ref().to_glib_none().0,
510 event.as_ref().to_glib_none().0,
511 cell_area.to_glib_none().0,
512 flags.into_glib(),
513 ))
514 }
515 }
516
517 /// Adds @renderer to @self with the default child cell properties.
518 ///
519 /// # Deprecated since 4.10
520 ///
521 /// ## `renderer`
522 /// the [`CellRenderer`][crate::CellRenderer] to add to @self
523 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
524 #[allow(deprecated)]
525 #[doc(alias = "gtk_cell_area_add")]
526 fn add(&self, renderer: &impl IsA<CellRenderer>) {
527 unsafe {
528 ffi::gtk_cell_area_add(
529 self.as_ref().to_glib_none().0,
530 renderer.as_ref().to_glib_none().0,
531 );
532 }
533 }
534
535 /// Adds @sibling to @renderer’s focusable area, focus will be drawn
536 /// around @renderer and all of its siblings if @renderer can
537 /// focus for a given row.
538 ///
539 /// Events handled by focus siblings can also activate the given
540 /// focusable @renderer.
541 ///
542 /// # Deprecated since 4.10
543 ///
544 /// ## `renderer`
545 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
546 /// ## `sibling`
547 /// the [`CellRenderer`][crate::CellRenderer] to add to @renderer’s focus area
548 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
549 #[allow(deprecated)]
550 #[doc(alias = "gtk_cell_area_add_focus_sibling")]
551 fn add_focus_sibling(
552 &self,
553 renderer: &impl IsA<CellRenderer>,
554 sibling: &impl IsA<CellRenderer>,
555 ) {
556 unsafe {
557 ffi::gtk_cell_area_add_focus_sibling(
558 self.as_ref().to_glib_none().0,
559 renderer.as_ref().to_glib_none().0,
560 sibling.as_ref().to_glib_none().0,
561 );
562 }
563 }
564
565 /// Applies any connected attributes to the renderers in
566 /// @self by pulling the values from @tree_model.
567 ///
568 /// # Deprecated since 4.10
569 ///
570 /// ## `tree_model`
571 /// the [`TreeModel`][crate::TreeModel] to pull values from
572 /// ## `iter`
573 /// the [`TreeIter`][crate::TreeIter] in @tree_model to apply values for
574 /// ## `is_expander`
575 /// whether @iter has children
576 /// ## `is_expanded`
577 /// whether @iter is expanded in the view and
578 /// children are visible
579 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
580 #[allow(deprecated)]
581 #[doc(alias = "gtk_cell_area_apply_attributes")]
582 fn apply_attributes(
583 &self,
584 tree_model: &impl IsA<TreeModel>,
585 iter: &TreeIter,
586 is_expander: bool,
587 is_expanded: bool,
588 ) {
589 unsafe {
590 ffi::gtk_cell_area_apply_attributes(
591 self.as_ref().to_glib_none().0,
592 tree_model.as_ref().to_glib_none().0,
593 mut_override(iter.to_glib_none().0),
594 is_expander.into_glib(),
595 is_expanded.into_glib(),
596 );
597 }
598 }
599
600 /// Connects an @attribute to apply values from @column for the
601 /// [`TreeModel`][crate::TreeModel] in use.
602 ///
603 /// # Deprecated since 4.10
604 ///
605 /// ## `renderer`
606 /// the [`CellRenderer`][crate::CellRenderer] to connect an attribute for
607 /// ## `attribute`
608 /// the attribute name
609 /// ## `column`
610 /// the [`TreeModel`][crate::TreeModel] column to fetch attribute values from
611 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
612 #[allow(deprecated)]
613 #[doc(alias = "gtk_cell_area_attribute_connect")]
614 fn attribute_connect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str, column: i32) {
615 unsafe {
616 ffi::gtk_cell_area_attribute_connect(
617 self.as_ref().to_glib_none().0,
618 renderer.as_ref().to_glib_none().0,
619 attribute.to_glib_none().0,
620 column,
621 );
622 }
623 }
624
625 /// Disconnects @attribute for the @renderer in @self so that
626 /// attribute will no longer be updated with values from the
627 /// model.
628 ///
629 /// # Deprecated since 4.10
630 ///
631 /// ## `renderer`
632 /// the [`CellRenderer`][crate::CellRenderer] to disconnect an attribute for
633 /// ## `attribute`
634 /// the attribute name
635 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
636 #[allow(deprecated)]
637 #[doc(alias = "gtk_cell_area_attribute_disconnect")]
638 fn attribute_disconnect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) {
639 unsafe {
640 ffi::gtk_cell_area_attribute_disconnect(
641 self.as_ref().to_glib_none().0,
642 renderer.as_ref().to_glib_none().0,
643 attribute.to_glib_none().0,
644 );
645 }
646 }
647
648 /// Returns the model column that an attribute has been mapped to,
649 /// or -1 if the attribute is not mapped.
650 ///
651 /// # Deprecated since 4.10
652 ///
653 /// ## `renderer`
654 /// a [`CellRenderer`][crate::CellRenderer]
655 /// ## `attribute`
656 /// an attribute on the renderer
657 ///
658 /// # Returns
659 ///
660 /// the model column, or -1
661 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
662 #[allow(deprecated)]
663 #[doc(alias = "gtk_cell_area_attribute_get_column")]
664 fn attribute_get_column(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) -> i32 {
665 unsafe {
666 ffi::gtk_cell_area_attribute_get_column(
667 self.as_ref().to_glib_none().0,
668 renderer.as_ref().to_glib_none().0,
669 attribute.to_glib_none().0,
670 )
671 }
672 }
673
674 /// This is sometimes needed for cases where rows need to share
675 /// alignments in one orientation but may be separately grouped
676 /// in the opposing orientation.
677 ///
678 /// For instance, [`IconView`][crate::IconView] creates all icons (rows) to have
679 /// the same width and the cells theirin to have the same
680 /// horizontal alignments. However each row of icons may have
681 /// a separate collective height. [`IconView`][crate::IconView] uses this to
682 /// request the heights of each row based on a context which
683 /// was already used to request all the row widths that are
684 /// to be displayed.
685 ///
686 /// # Deprecated since 4.10
687 ///
688 /// ## `context`
689 /// the [`CellArea`][crate::CellArea]Context to copy
690 ///
691 /// # Returns
692 ///
693 /// a newly created [`CellArea`][crate::CellArea]Context copy of @context.
694 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
695 #[allow(deprecated)]
696 #[doc(alias = "gtk_cell_area_copy_context")]
697 fn copy_context(&self, context: &impl IsA<CellAreaContext>) -> CellAreaContext {
698 unsafe {
699 from_glib_full(ffi::gtk_cell_area_copy_context(
700 self.as_ref().to_glib_none().0,
701 context.as_ref().to_glib_none().0,
702 ))
703 }
704 }
705
706 /// Creates a [`CellArea`][crate::CellArea]Context to be used with @self for
707 /// all purposes. [`CellArea`][crate::CellArea]Context stores geometry information
708 /// for rows for which it was operated on, it is important to use
709 /// the same context for the same row of data at all times (i.e.
710 /// one should render and handle events with the same [`CellArea`][crate::CellArea]Context
711 /// which was used to request the size of those rows of data).
712 ///
713 /// # Deprecated since 4.10
714 ///
715 ///
716 /// # Returns
717 ///
718 /// a newly created [`CellArea`][crate::CellArea]Context which can be used with @self.
719 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
720 #[allow(deprecated)]
721 #[doc(alias = "gtk_cell_area_create_context")]
722 fn create_context(&self) -> CellAreaContext {
723 unsafe {
724 from_glib_full(ffi::gtk_cell_area_create_context(
725 self.as_ref().to_glib_none().0,
726 ))
727 }
728 }
729
730 /// Delegates event handling to a [`CellArea`][crate::CellArea].
731 ///
732 /// # Deprecated since 4.10
733 ///
734 /// ## `context`
735 /// the [`CellArea`][crate::CellArea]Context for this row of data.
736 /// ## `widget`
737 /// the [`Widget`][crate::Widget] that @self is rendering to
738 /// ## `event`
739 /// the [`gdk::Event`][crate::gdk::Event] to handle
740 /// ## `cell_area`
741 /// the @widget relative coordinates for @self
742 /// ## `flags`
743 /// the [`CellRenderer`][crate::CellRenderer]State for @self in this row.
744 ///
745 /// # Returns
746 ///
747 /// [`true`] if the event was handled by @self.
748 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
749 #[allow(deprecated)]
750 #[doc(alias = "gtk_cell_area_event")]
751 fn event(
752 &self,
753 context: &impl IsA<CellAreaContext>,
754 widget: &impl IsA<Widget>,
755 event: impl AsRef<gdk::Event>,
756 cell_area: &gdk::Rectangle,
757 flags: CellRendererState,
758 ) -> i32 {
759 unsafe {
760 ffi::gtk_cell_area_event(
761 self.as_ref().to_glib_none().0,
762 context.as_ref().to_glib_none().0,
763 widget.as_ref().to_glib_none().0,
764 event.as_ref().to_glib_none().0,
765 cell_area.to_glib_none().0,
766 flags.into_glib(),
767 )
768 }
769 }
770
771 /// This should be called by the @self’s owning layout widget
772 /// when focus is to be passed to @self, or moved within @self
773 /// for a given @direction and row data.
774 ///
775 /// Implementing [`CellArea`][crate::CellArea] classes should implement this
776 /// method to receive and navigate focus in its own way particular
777 /// to how it lays out cells.
778 ///
779 /// # Deprecated since 4.10
780 ///
781 /// ## `direction`
782 /// the [`DirectionType`][crate::DirectionType]
783 ///
784 /// # Returns
785 ///
786 /// [`true`] if focus remains inside @self as a result of this call.
787 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
788 #[allow(deprecated)]
789 #[doc(alias = "gtk_cell_area_focus")]
790 fn focus(&self, direction: DirectionType) -> bool {
791 unsafe {
792 from_glib(ffi::gtk_cell_area_focus(
793 self.as_ref().to_glib_none().0,
794 direction.into_glib(),
795 ))
796 }
797 }
798
799 /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self.
800 ///
801 /// # Deprecated since 4.10
802 ///
803 /// ## `callback`
804 /// the `GtkCellCallback` to call
805 /// ## `callback_data`
806 /// user provided data pointer
807 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
808 #[allow(deprecated)]
809 #[doc(alias = "gtk_cell_area_foreach")]
810 fn foreach<P: FnMut(&CellRenderer) -> bool>(&self, callback: P) {
811 let mut callback_data: P = callback;
812 unsafe extern "C" fn callback_func<P: FnMut(&CellRenderer) -> bool>(
813 renderer: *mut ffi::GtkCellRenderer,
814 data: glib::ffi::gpointer,
815 ) -> glib::ffi::gboolean {
816 unsafe {
817 let renderer = from_glib_borrow(renderer);
818 let callback = data as *mut P;
819 (*callback)(&renderer).into_glib()
820 }
821 }
822 let callback = Some(callback_func::<P> as _);
823 let super_callback0: &mut P = &mut callback_data;
824 unsafe {
825 ffi::gtk_cell_area_foreach(
826 self.as_ref().to_glib_none().0,
827 callback,
828 super_callback0 as *mut _ as *mut _,
829 );
830 }
831 }
832
833 /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self with the
834 /// allocated rectangle inside @cell_area.
835 /// ## `context`
836 /// the [`CellArea`][crate::CellArea]Context for this row of data.
837 /// ## `widget`
838 /// the [`Widget`][crate::Widget] that @self is rendering to
839 /// ## `cell_area`
840 /// the @widget relative coordinates and size for @self
841 /// ## `background_area`
842 /// the @widget relative coordinates of the background area
843 /// ## `callback`
844 /// the `GtkCellAllocCallback` to call
845 /// ## `callback_data`
846 /// user provided data pointer
847 #[doc(alias = "gtk_cell_area_foreach_alloc")]
848 fn foreach_alloc<P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool>(
849 &self,
850 context: &impl IsA<CellAreaContext>,
851 widget: &impl IsA<Widget>,
852 cell_area: &gdk::Rectangle,
853 background_area: &gdk::Rectangle,
854 callback: P,
855 ) {
856 let mut callback_data: P = callback;
857 unsafe extern "C" fn callback_func<
858 P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool,
859 >(
860 renderer: *mut ffi::GtkCellRenderer,
861 cell_area: *const gdk::ffi::GdkRectangle,
862 cell_background: *const gdk::ffi::GdkRectangle,
863 data: glib::ffi::gpointer,
864 ) -> glib::ffi::gboolean {
865 unsafe {
866 let renderer = from_glib_borrow(renderer);
867 let cell_area = from_glib_borrow(cell_area);
868 let cell_background = from_glib_borrow(cell_background);
869 let callback = data as *mut P;
870 (*callback)(&renderer, &cell_area, &cell_background).into_glib()
871 }
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 unsafe {
1673 let f: &F = &*(f as *const F);
1674 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1675 f(
1676 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1677 &from_glib_borrow(renderer),
1678 &from_glib_borrow(editable),
1679 &from_glib_borrow(cell_area),
1680 path,
1681 )
1682 }
1683 }
1684 unsafe {
1685 let f: Box_<F> = Box_::new(f);
1686 connect_raw(
1687 self.as_ptr() as *mut _,
1688 c"add-editable".as_ptr() as *const _,
1689 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1690 add_editable_trampoline::<Self, F> as *const (),
1691 )),
1692 Box_::into_raw(f),
1693 )
1694 }
1695 }
1696
1697 /// This signal is emitted whenever applying attributes to @area from @model
1698 /// ## `model`
1699 /// the [`TreeModel`][crate::TreeModel] to apply the attributes from
1700 /// ## `iter`
1701 /// the [`TreeIter`][crate::TreeIter] indicating which row to apply the attributes of
1702 /// ## `is_expander`
1703 /// whether the view shows children for this row
1704 /// ## `is_expanded`
1705 /// whether the view is currently showing the children of this row
1706 #[doc(alias = "apply-attributes")]
1707 fn connect_apply_attributes<F: Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>(
1708 &self,
1709 f: F,
1710 ) -> SignalHandlerId {
1711 unsafe extern "C" fn apply_attributes_trampoline<
1712 P: IsA<CellArea>,
1713 F: Fn(&P, &TreeModel, &TreeIter, bool, bool) + 'static,
1714 >(
1715 this: *mut ffi::GtkCellArea,
1716 model: *mut ffi::GtkTreeModel,
1717 iter: *mut ffi::GtkTreeIter,
1718 is_expander: glib::ffi::gboolean,
1719 is_expanded: glib::ffi::gboolean,
1720 f: glib::ffi::gpointer,
1721 ) {
1722 unsafe {
1723 let f: &F = &*(f as *const F);
1724 f(
1725 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1726 &from_glib_borrow(model),
1727 &from_glib_borrow(iter),
1728 from_glib(is_expander),
1729 from_glib(is_expanded),
1730 )
1731 }
1732 }
1733 unsafe {
1734 let f: Box_<F> = Box_::new(f);
1735 connect_raw(
1736 self.as_ptr() as *mut _,
1737 c"apply-attributes".as_ptr() as *const _,
1738 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1739 apply_attributes_trampoline::<Self, F> as *const (),
1740 )),
1741 Box_::into_raw(f),
1742 )
1743 }
1744 }
1745
1746 /// Indicates that focus changed on this @area. This signal
1747 /// is emitted either as a result of focus handling or event
1748 /// handling.
1749 ///
1750 /// It's possible that the signal is emitted even if the
1751 /// currently focused renderer did not change, this is
1752 /// because focus may change to the same renderer in the
1753 /// same cell area for a different row of data.
1754 /// ## `renderer`
1755 /// the [`CellRenderer`][crate::CellRenderer] that has focus
1756 /// ## `path`
1757 /// the current [`TreePath`][crate::TreePath] string set for @area
1758 #[doc(alias = "focus-changed")]
1759 fn connect_focus_changed<F: Fn(&Self, &CellRenderer, TreePath) + 'static>(
1760 &self,
1761 f: F,
1762 ) -> SignalHandlerId {
1763 unsafe extern "C" fn focus_changed_trampoline<
1764 P: IsA<CellArea>,
1765 F: Fn(&P, &CellRenderer, TreePath) + 'static,
1766 >(
1767 this: *mut ffi::GtkCellArea,
1768 renderer: *mut ffi::GtkCellRenderer,
1769 path: *mut std::ffi::c_char,
1770 f: glib::ffi::gpointer,
1771 ) {
1772 unsafe {
1773 let f: &F = &*(f as *const F);
1774 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1775 f(
1776 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1777 &from_glib_borrow(renderer),
1778 path,
1779 )
1780 }
1781 }
1782 unsafe {
1783 let f: Box_<F> = Box_::new(f);
1784 connect_raw(
1785 self.as_ptr() as *mut _,
1786 c"focus-changed".as_ptr() as *const _,
1787 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1788 focus_changed_trampoline::<Self, F> as *const (),
1789 )),
1790 Box_::into_raw(f),
1791 )
1792 }
1793 }
1794
1795 /// Indicates that editing finished on @renderer and that @editable
1796 /// should be removed from the owning cell-layouting widget.
1797 /// ## `renderer`
1798 /// the [`CellRenderer`][crate::CellRenderer] that finished editeding
1799 /// ## `editable`
1800 /// the [`CellEditable`][crate::CellEditable] widget to remove
1801 #[doc(alias = "remove-editable")]
1802 fn connect_remove_editable<F: Fn(&Self, &CellRenderer, &CellEditable) + 'static>(
1803 &self,
1804 f: F,
1805 ) -> SignalHandlerId {
1806 unsafe extern "C" fn remove_editable_trampoline<
1807 P: IsA<CellArea>,
1808 F: Fn(&P, &CellRenderer, &CellEditable) + 'static,
1809 >(
1810 this: *mut ffi::GtkCellArea,
1811 renderer: *mut ffi::GtkCellRenderer,
1812 editable: *mut ffi::GtkCellEditable,
1813 f: glib::ffi::gpointer,
1814 ) {
1815 unsafe {
1816 let f: &F = &*(f as *const F);
1817 f(
1818 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1819 &from_glib_borrow(renderer),
1820 &from_glib_borrow(editable),
1821 )
1822 }
1823 }
1824 unsafe {
1825 let f: Box_<F> = Box_::new(f);
1826 connect_raw(
1827 self.as_ptr() as *mut _,
1828 c"remove-editable".as_ptr() as *const _,
1829 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1830 remove_editable_trampoline::<Self, F> as *const (),
1831 )),
1832 Box_::into_raw(f),
1833 )
1834 }
1835 }
1836
1837 #[doc(alias = "edit-widget")]
1838 fn connect_edit_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1839 unsafe extern "C" fn notify_edit_widget_trampoline<
1840 P: IsA<CellArea>,
1841 F: Fn(&P) + 'static,
1842 >(
1843 this: *mut ffi::GtkCellArea,
1844 _param_spec: glib::ffi::gpointer,
1845 f: glib::ffi::gpointer,
1846 ) {
1847 unsafe {
1848 let f: &F = &*(f as *const F);
1849 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1850 }
1851 }
1852 unsafe {
1853 let f: Box_<F> = Box_::new(f);
1854 connect_raw(
1855 self.as_ptr() as *mut _,
1856 c"notify::edit-widget".as_ptr() as *const _,
1857 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1858 notify_edit_widget_trampoline::<Self, F> as *const (),
1859 )),
1860 Box_::into_raw(f),
1861 )
1862 }
1863 }
1864
1865 #[doc(alias = "edited-cell")]
1866 fn connect_edited_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1867 unsafe extern "C" fn notify_edited_cell_trampoline<
1868 P: IsA<CellArea>,
1869 F: Fn(&P) + 'static,
1870 >(
1871 this: *mut ffi::GtkCellArea,
1872 _param_spec: glib::ffi::gpointer,
1873 f: glib::ffi::gpointer,
1874 ) {
1875 unsafe {
1876 let f: &F = &*(f as *const F);
1877 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1878 }
1879 }
1880 unsafe {
1881 let f: Box_<F> = Box_::new(f);
1882 connect_raw(
1883 self.as_ptr() as *mut _,
1884 c"notify::edited-cell".as_ptr() as *const _,
1885 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1886 notify_edited_cell_trampoline::<Self, F> as *const (),
1887 )),
1888 Box_::into_raw(f),
1889 )
1890 }
1891 }
1892
1893 #[doc(alias = "focus-cell")]
1894 fn connect_focus_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1895 unsafe extern "C" fn notify_focus_cell_trampoline<P: IsA<CellArea>, F: Fn(&P) + 'static>(
1896 this: *mut ffi::GtkCellArea,
1897 _param_spec: glib::ffi::gpointer,
1898 f: glib::ffi::gpointer,
1899 ) {
1900 unsafe {
1901 let f: &F = &*(f as *const F);
1902 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1903 }
1904 }
1905 unsafe {
1906 let f: Box_<F> = Box_::new(f);
1907 connect_raw(
1908 self.as_ptr() as *mut _,
1909 c"notify::focus-cell".as_ptr() as *const _,
1910 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1911 notify_focus_cell_trampoline::<Self, F> as *const (),
1912 )),
1913 Box_::into_raw(f),
1914 )
1915 }
1916 }
1917}
1918
1919impl<O: IsA<CellArea>> CellAreaExt for O {}