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 /// iter);
23 /// }
24 /// }
25 /// }
26 /// }
27 /// return have_focus;
28 /// }
29 /// ```text
30 ///
31 /// Note that the layouting widget is responsible for matching the
32 /// [`DirectionType`][crate::DirectionType] values to the way it lays out its cells.
33 ///
34 /// ## Cell Properties
35 ///
36 /// The [`CellArea`][crate::CellArea] introduces cell properties for [`CellRenderer`][crate::CellRenderer]s.
37 /// This provides some general interfaces for defining the relationship
38 /// cell areas have with their cells. For instance in a [`CellAreaBox`][crate::CellAreaBox]
39 /// a cell might “expand” and receive extra space when the area is allocated
40 /// more than its full natural request, or a cell might be configured to “align”
41 /// with adjacent rows which were requested and rendered with the same
42 /// [`CellAreaContext`][crate::CellAreaContext].
43 ///
44 /// Use [`CellAreaClassExt::install_cell_property()`][crate::subclass::prelude::CellAreaClassExt::install_cell_property()] to install cell
45 /// properties for a cell area class and [`CellAreaClassExt::find_cell_property()`][crate::subclass::prelude::CellAreaClassExt::find_cell_property()]
46 /// or [`CellAreaClassExt::list_cell_properties()`][crate::subclass::prelude::CellAreaClassExt::list_cell_properties()] to get information about
47 /// existing cell properties.
48 ///
49 /// To set the value of a cell property, use [`CellAreaExtManual::cell_set_property()`][crate::prelude::CellAreaExtManual::cell_set_property()],
50 /// `Gtk::CellArea::cell_set()` or `Gtk::CellArea::cell_set_valist()`. To obtain
51 /// the value of a cell property, use [`CellAreaExtManual::cell_get_property()`][crate::prelude::CellAreaExtManual::cell_get_property()]
52 /// `Gtk::CellArea::cell_get()` or `Gtk::CellArea::cell_get_valist()`.
53 ///
54 /// This is an Abstract Base Class, you cannot instantiate it.
55 ///
56 /// ## Properties
57 ///
58 ///
59 /// #### `edit-widget`
60 /// The widget currently editing the edited cell
61 ///
62 /// This property is read-only and only changes as
63 /// a result of a call gtk_cell_area_activate_cell().
64 ///
65 /// Readable
66 ///
67 ///
68 /// #### `edited-cell`
69 /// The cell in the area that is currently edited
70 ///
71 /// This property is read-only and only changes as
72 /// a result of a call gtk_cell_area_activate_cell().
73 ///
74 /// Readable
75 ///
76 ///
77 /// #### `focus-cell`
78 /// The cell in the area that currently has focus
79 ///
80 /// Readable | Writable
81 ///
82 /// ## Signals
83 ///
84 ///
85 /// #### `add-editable`
86 /// Indicates that editing has started on @renderer and that @editable
87 /// should be added to the owning cell-layouting widget at @cell_area.
88 ///
89 ///
90 ///
91 ///
92 /// #### `apply-attributes`
93 /// This signal is emitted whenever applying attributes to @area from @model
94 ///
95 ///
96 ///
97 ///
98 /// #### `focus-changed`
99 /// Indicates that focus changed on this @area. This signal
100 /// is emitted either as a result of focus handling or event
101 /// handling.
102 ///
103 /// It's possible that the signal is emitted even if the
104 /// currently focused renderer did not change, this is
105 /// because focus may change to the same renderer in the
106 /// same cell area for a different row of data.
107 ///
108 ///
109 ///
110 ///
111 /// #### `remove-editable`
112 /// Indicates that editing finished on @renderer and that @editable
113 /// should be removed from the owning cell-layouting widget.
114 ///
115 ///
116 ///
117 /// # Implements
118 ///
119 /// [`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]
120 #[doc(alias = "GtkCellArea")]
121 pub struct CellArea(Object<ffi::GtkCellArea, ffi::GtkCellAreaClass>) @implements Buildable, CellLayout;
122
123 match fn {
124 type_ => || ffi::gtk_cell_area_get_type(),
125 }
126}
127
128impl CellArea {
129 pub const NONE: Option<&'static CellArea> = None;
130}
131
132/// Trait containing all [`struct@CellArea`] methods.
133///
134/// # Implementors
135///
136/// [`CellAreaBox`][struct@crate::CellAreaBox], [`CellArea`][struct@crate::CellArea]
137pub trait CellAreaExt: IsA<CellArea> + 'static {
138 /// Activates @self, usually by activating the currently focused
139 /// cell, however some subclasses which embed widgets in the area
140 /// can also activate a widget if it currently has the focus.
141 ///
142 /// # Deprecated since 4.10
143 ///
144 /// ## `context`
145 /// the [`CellArea`][crate::CellArea]Context in context with the current row data
146 /// ## `widget`
147 /// the [`Widget`][crate::Widget] that @self is rendering on
148 /// ## `cell_area`
149 /// the size and location of @self relative to @widget’s allocation
150 /// ## `flags`
151 /// the [`CellRenderer`][crate::CellRenderer]State flags for @self for this row of data.
152 /// ## `edit_only`
153 /// if [`true`] then only cell renderers that are [`CellRendererMode::Editable`][crate::CellRendererMode::Editable]
154 /// will be activated.
155 ///
156 /// # Returns
157 ///
158 /// Whether @self was successfully activated.
159 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
160 #[allow(deprecated)]
161 #[doc(alias = "gtk_cell_area_activate")]
162 fn activate(
163 &self,
164 context: &impl IsA<CellAreaContext>,
165 widget: &impl IsA<Widget>,
166 cell_area: &gdk::Rectangle,
167 flags: CellRendererState,
168 edit_only: bool,
169 ) -> bool {
170 unsafe {
171 from_glib(ffi::gtk_cell_area_activate(
172 self.as_ref().to_glib_none().0,
173 context.as_ref().to_glib_none().0,
174 widget.as_ref().to_glib_none().0,
175 cell_area.to_glib_none().0,
176 flags.into_glib(),
177 edit_only.into_glib(),
178 ))
179 }
180 }
181
182 /// activate()
183 /// implementation.
184 ///
185 /// # Deprecated since 4.10
186 ///
187 /// ## `widget`
188 /// the [`Widget`][crate::Widget] that @self is rendering onto
189 /// ## `renderer`
190 /// the [`CellRenderer`][crate::CellRenderer] in @self to activate
191 /// ## `event`
192 /// the [`gdk::Event`][crate::gdk::Event] for which cell activation should occur
193 /// ## `cell_area`
194 /// the [`gdk::Rectangle`][crate::gdk::Rectangle] in @widget relative coordinates
195 /// of @renderer for the current row.
196 /// ## `flags`
197 /// the [`CellRenderer`][crate::CellRenderer]State for @renderer
198 ///
199 /// # Returns
200 ///
201 /// whether cell activation was successful
202 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
203 #[allow(deprecated)]
204 #[doc(alias = "gtk_cell_area_activate_cell")]
205 fn activate_cell(
206 &self,
207 widget: &impl IsA<Widget>,
208 renderer: &impl IsA<CellRenderer>,
209 event: impl AsRef<gdk::Event>,
210 cell_area: &gdk::Rectangle,
211 flags: CellRendererState,
212 ) -> bool {
213 unsafe {
214 from_glib(ffi::gtk_cell_area_activate_cell(
215 self.as_ref().to_glib_none().0,
216 widget.as_ref().to_glib_none().0,
217 renderer.as_ref().to_glib_none().0,
218 event.as_ref().to_glib_none().0,
219 cell_area.to_glib_none().0,
220 flags.into_glib(),
221 ))
222 }
223 }
224
225 /// Adds @renderer to @self with the default child cell properties.
226 ///
227 /// # Deprecated since 4.10
228 ///
229 /// ## `renderer`
230 /// the [`CellRenderer`][crate::CellRenderer] to add to @self
231 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
232 #[allow(deprecated)]
233 #[doc(alias = "gtk_cell_area_add")]
234 fn add(&self, renderer: &impl IsA<CellRenderer>) {
235 unsafe {
236 ffi::gtk_cell_area_add(
237 self.as_ref().to_glib_none().0,
238 renderer.as_ref().to_glib_none().0,
239 );
240 }
241 }
242
243 /// Adds @sibling to @renderer’s focusable area, focus will be drawn
244 /// around @renderer and all of its siblings if @renderer can
245 /// focus for a given row.
246 ///
247 /// Events handled by focus siblings can also activate the given
248 /// focusable @renderer.
249 ///
250 /// # Deprecated since 4.10
251 ///
252 /// ## `renderer`
253 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
254 /// ## `sibling`
255 /// the [`CellRenderer`][crate::CellRenderer] to add to @renderer’s focus area
256 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
257 #[allow(deprecated)]
258 #[doc(alias = "gtk_cell_area_add_focus_sibling")]
259 fn add_focus_sibling(
260 &self,
261 renderer: &impl IsA<CellRenderer>,
262 sibling: &impl IsA<CellRenderer>,
263 ) {
264 unsafe {
265 ffi::gtk_cell_area_add_focus_sibling(
266 self.as_ref().to_glib_none().0,
267 renderer.as_ref().to_glib_none().0,
268 sibling.as_ref().to_glib_none().0,
269 );
270 }
271 }
272
273 /// Applies any connected attributes to the renderers in
274 /// @self by pulling the values from @tree_model.
275 ///
276 /// # Deprecated since 4.10
277 ///
278 /// ## `tree_model`
279 /// the [`TreeModel`][crate::TreeModel] to pull values from
280 /// ## `iter`
281 /// the [`TreeIter`][crate::TreeIter] in @tree_model to apply values for
282 /// ## `is_expander`
283 /// whether @iter has children
284 /// ## `is_expanded`
285 /// whether @iter is expanded in the view and
286 /// children are visible
287 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
288 #[allow(deprecated)]
289 #[doc(alias = "gtk_cell_area_apply_attributes")]
290 fn apply_attributes(
291 &self,
292 tree_model: &impl IsA<TreeModel>,
293 iter: &TreeIter,
294 is_expander: bool,
295 is_expanded: bool,
296 ) {
297 unsafe {
298 ffi::gtk_cell_area_apply_attributes(
299 self.as_ref().to_glib_none().0,
300 tree_model.as_ref().to_glib_none().0,
301 mut_override(iter.to_glib_none().0),
302 is_expander.into_glib(),
303 is_expanded.into_glib(),
304 );
305 }
306 }
307
308 /// Connects an @attribute to apply values from @column for the
309 /// [`TreeModel`][crate::TreeModel] in use.
310 ///
311 /// # Deprecated since 4.10
312 ///
313 /// ## `renderer`
314 /// the [`CellRenderer`][crate::CellRenderer] to connect an attribute for
315 /// ## `attribute`
316 /// the attribute name
317 /// ## `column`
318 /// the [`TreeModel`][crate::TreeModel] column to fetch attribute values from
319 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
320 #[allow(deprecated)]
321 #[doc(alias = "gtk_cell_area_attribute_connect")]
322 fn attribute_connect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str, column: i32) {
323 unsafe {
324 ffi::gtk_cell_area_attribute_connect(
325 self.as_ref().to_glib_none().0,
326 renderer.as_ref().to_glib_none().0,
327 attribute.to_glib_none().0,
328 column,
329 );
330 }
331 }
332
333 /// Disconnects @attribute for the @renderer in @self so that
334 /// attribute will no longer be updated with values from the
335 /// model.
336 ///
337 /// # Deprecated since 4.10
338 ///
339 /// ## `renderer`
340 /// the [`CellRenderer`][crate::CellRenderer] to disconnect an attribute for
341 /// ## `attribute`
342 /// the attribute name
343 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
344 #[allow(deprecated)]
345 #[doc(alias = "gtk_cell_area_attribute_disconnect")]
346 fn attribute_disconnect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) {
347 unsafe {
348 ffi::gtk_cell_area_attribute_disconnect(
349 self.as_ref().to_glib_none().0,
350 renderer.as_ref().to_glib_none().0,
351 attribute.to_glib_none().0,
352 );
353 }
354 }
355
356 /// Returns the model column that an attribute has been mapped to,
357 /// or -1 if the attribute is not mapped.
358 ///
359 /// # Deprecated since 4.10
360 ///
361 /// ## `renderer`
362 /// a [`CellRenderer`][crate::CellRenderer]
363 /// ## `attribute`
364 /// an attribute on the renderer
365 ///
366 /// # Returns
367 ///
368 /// the model column, or -1
369 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
370 #[allow(deprecated)]
371 #[doc(alias = "gtk_cell_area_attribute_get_column")]
372 fn attribute_get_column(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) -> i32 {
373 unsafe {
374 ffi::gtk_cell_area_attribute_get_column(
375 self.as_ref().to_glib_none().0,
376 renderer.as_ref().to_glib_none().0,
377 attribute.to_glib_none().0,
378 )
379 }
380 }
381
382 /// This is sometimes needed for cases where rows need to share
383 /// alignments in one orientation but may be separately grouped
384 /// in the opposing orientation.
385 ///
386 /// For instance, [`IconView`][crate::IconView] creates all icons (rows) to have
387 /// the same width and the cells theirin to have the same
388 /// horizontal alignments. However each row of icons may have
389 /// a separate collective height. [`IconView`][crate::IconView] uses this to
390 /// request the heights of each row based on a context which
391 /// was already used to request all the row widths that are
392 /// to be displayed.
393 ///
394 /// # Deprecated since 4.10
395 ///
396 /// ## `context`
397 /// the [`CellArea`][crate::CellArea]Context to copy
398 ///
399 /// # Returns
400 ///
401 /// a newly created [`CellArea`][crate::CellArea]Context copy of @context.
402 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
403 #[allow(deprecated)]
404 #[doc(alias = "gtk_cell_area_copy_context")]
405 fn copy_context(&self, context: &impl IsA<CellAreaContext>) -> CellAreaContext {
406 unsafe {
407 from_glib_full(ffi::gtk_cell_area_copy_context(
408 self.as_ref().to_glib_none().0,
409 context.as_ref().to_glib_none().0,
410 ))
411 }
412 }
413
414 /// Creates a [`CellArea`][crate::CellArea]Context to be used with @self for
415 /// all purposes. [`CellArea`][crate::CellArea]Context stores geometry information
416 /// for rows for which it was operated on, it is important to use
417 /// the same context for the same row of data at all times (i.e.
418 /// one should render and handle events with the same [`CellArea`][crate::CellArea]Context
419 /// which was used to request the size of those rows of data).
420 ///
421 /// # Deprecated since 4.10
422 ///
423 ///
424 /// # Returns
425 ///
426 /// a newly created [`CellArea`][crate::CellArea]Context which can be used with @self.
427 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
428 #[allow(deprecated)]
429 #[doc(alias = "gtk_cell_area_create_context")]
430 fn create_context(&self) -> CellAreaContext {
431 unsafe {
432 from_glib_full(ffi::gtk_cell_area_create_context(
433 self.as_ref().to_glib_none().0,
434 ))
435 }
436 }
437
438 /// Delegates event handling to a [`CellArea`][crate::CellArea].
439 ///
440 /// # Deprecated since 4.10
441 ///
442 /// ## `context`
443 /// the [`CellArea`][crate::CellArea]Context for this row of data.
444 /// ## `widget`
445 /// the [`Widget`][crate::Widget] that @self is rendering to
446 /// ## `event`
447 /// the [`gdk::Event`][crate::gdk::Event] to handle
448 /// ## `cell_area`
449 /// the @widget relative coordinates for @self
450 /// ## `flags`
451 /// the [`CellRenderer`][crate::CellRenderer]State for @self in this row.
452 ///
453 /// # Returns
454 ///
455 /// [`true`] if the event was handled by @self.
456 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
457 #[allow(deprecated)]
458 #[doc(alias = "gtk_cell_area_event")]
459 fn event(
460 &self,
461 context: &impl IsA<CellAreaContext>,
462 widget: &impl IsA<Widget>,
463 event: impl AsRef<gdk::Event>,
464 cell_area: &gdk::Rectangle,
465 flags: CellRendererState,
466 ) -> i32 {
467 unsafe {
468 ffi::gtk_cell_area_event(
469 self.as_ref().to_glib_none().0,
470 context.as_ref().to_glib_none().0,
471 widget.as_ref().to_glib_none().0,
472 event.as_ref().to_glib_none().0,
473 cell_area.to_glib_none().0,
474 flags.into_glib(),
475 )
476 }
477 }
478
479 /// This should be called by the @self’s owning layout widget
480 /// when focus is to be passed to @self, or moved within @self
481 /// for a given @direction and row data.
482 ///
483 /// Implementing [`CellArea`][crate::CellArea] classes should implement this
484 /// method to receive and navigate focus in its own way particular
485 /// to how it lays out cells.
486 ///
487 /// # Deprecated since 4.10
488 ///
489 /// ## `direction`
490 /// the [`DirectionType`][crate::DirectionType]
491 ///
492 /// # Returns
493 ///
494 /// [`true`] if focus remains inside @self as a result of this call.
495 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
496 #[allow(deprecated)]
497 #[doc(alias = "gtk_cell_area_focus")]
498 fn focus(&self, direction: DirectionType) -> bool {
499 unsafe {
500 from_glib(ffi::gtk_cell_area_focus(
501 self.as_ref().to_glib_none().0,
502 direction.into_glib(),
503 ))
504 }
505 }
506
507 /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self.
508 ///
509 /// # Deprecated since 4.10
510 ///
511 /// ## `callback`
512 /// the `GtkCellCallback` to call
513 /// ## `callback_data`
514 /// user provided data pointer
515 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
516 #[allow(deprecated)]
517 #[doc(alias = "gtk_cell_area_foreach")]
518 fn foreach<P: FnMut(&CellRenderer) -> bool>(&self, callback: P) {
519 let mut callback_data: P = callback;
520 unsafe extern "C" fn callback_func<P: FnMut(&CellRenderer) -> bool>(
521 renderer: *mut ffi::GtkCellRenderer,
522 data: glib::ffi::gpointer,
523 ) -> glib::ffi::gboolean {
524 unsafe {
525 let renderer = from_glib_borrow(renderer);
526 let callback = data as *mut P;
527 (*callback)(&renderer).into_glib()
528 }
529 }
530 let callback = Some(callback_func::<P> as _);
531 let super_callback0: &mut P = &mut callback_data;
532 unsafe {
533 ffi::gtk_cell_area_foreach(
534 self.as_ref().to_glib_none().0,
535 callback,
536 super_callback0 as *mut _ as *mut _,
537 );
538 }
539 }
540
541 /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self with the
542 /// allocated rectangle inside @cell_area.
543 ///
544 /// # Deprecated since 4.10
545 ///
546 /// ## `context`
547 /// the [`CellArea`][crate::CellArea]Context for this row of data.
548 /// ## `widget`
549 /// the [`Widget`][crate::Widget] that @self is rendering to
550 /// ## `cell_area`
551 /// the @widget relative coordinates and size for @self
552 /// ## `background_area`
553 /// the @widget relative coordinates of the background area
554 /// ## `callback`
555 /// the `GtkCellAllocCallback` to call
556 /// ## `callback_data`
557 /// user provided data pointer
558 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
559 #[allow(deprecated)]
560 #[doc(alias = "gtk_cell_area_foreach_alloc")]
561 fn foreach_alloc<P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool>(
562 &self,
563 context: &impl IsA<CellAreaContext>,
564 widget: &impl IsA<Widget>,
565 cell_area: &gdk::Rectangle,
566 background_area: &gdk::Rectangle,
567 callback: P,
568 ) {
569 let mut callback_data: P = callback;
570 unsafe extern "C" fn callback_func<
571 P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool,
572 >(
573 renderer: *mut ffi::GtkCellRenderer,
574 cell_area: *const gdk::ffi::GdkRectangle,
575 cell_background: *const gdk::ffi::GdkRectangle,
576 data: glib::ffi::gpointer,
577 ) -> glib::ffi::gboolean {
578 unsafe {
579 let renderer = from_glib_borrow(renderer);
580 let cell_area = from_glib_borrow(cell_area);
581 let cell_background = from_glib_borrow(cell_background);
582 let callback = data as *mut P;
583 (*callback)(&renderer, &cell_area, &cell_background).into_glib()
584 }
585 }
586 let callback = Some(callback_func::<P> as _);
587 let super_callback0: &mut P = &mut callback_data;
588 unsafe {
589 ffi::gtk_cell_area_foreach_alloc(
590 self.as_ref().to_glib_none().0,
591 context.as_ref().to_glib_none().0,
592 widget.as_ref().to_glib_none().0,
593 cell_area.to_glib_none().0,
594 background_area.to_glib_none().0,
595 callback,
596 super_callback0 as *mut _ as *mut _,
597 );
598 }
599 }
600
601 /// Derives the allocation of @renderer inside @self if @self
602 /// were to be rendered in @cell_area.
603 ///
604 /// # Deprecated since 4.10
605 ///
606 /// ## `context`
607 /// the [`CellArea`][crate::CellArea]Context used to hold sizes for @self.
608 /// ## `widget`
609 /// the [`Widget`][crate::Widget] that @self is rendering on
610 /// ## `renderer`
611 /// the [`CellRenderer`][crate::CellRenderer] to get the allocation for
612 /// ## `cell_area`
613 /// the whole allocated area for @self in @widget
614 /// for this row
615 ///
616 /// # Returns
617 ///
618 ///
619 /// ## `allocation`
620 /// where to store the allocation for @renderer
621 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
622 #[allow(deprecated)]
623 #[doc(alias = "gtk_cell_area_get_cell_allocation")]
624 #[doc(alias = "get_cell_allocation")]
625 fn cell_allocation(
626 &self,
627 context: &impl IsA<CellAreaContext>,
628 widget: &impl IsA<Widget>,
629 renderer: &impl IsA<CellRenderer>,
630 cell_area: &gdk::Rectangle,
631 ) -> gdk::Rectangle {
632 unsafe {
633 let mut allocation = gdk::Rectangle::uninitialized();
634 ffi::gtk_cell_area_get_cell_allocation(
635 self.as_ref().to_glib_none().0,
636 context.as_ref().to_glib_none().0,
637 widget.as_ref().to_glib_none().0,
638 renderer.as_ref().to_glib_none().0,
639 cell_area.to_glib_none().0,
640 allocation.to_glib_none_mut().0,
641 );
642 allocation
643 }
644 }
645
646 /// Gets the [`CellRenderer`][crate::CellRenderer] at @x and @y coordinates inside @self and optionally
647 /// returns the full cell allocation for it inside @cell_area.
648 ///
649 /// # Deprecated since 4.10
650 ///
651 /// ## `context`
652 /// the [`CellArea`][crate::CellArea]Context used to hold sizes for @self.
653 /// ## `widget`
654 /// the [`Widget`][crate::Widget] that @self is rendering on
655 /// ## `cell_area`
656 /// the whole allocated area for @self in @widget
657 /// for this row
658 /// ## `x`
659 /// the x position
660 /// ## `y`
661 /// the y position
662 ///
663 /// # Returns
664 ///
665 /// the [`CellRenderer`][crate::CellRenderer] at @x and @y.
666 ///
667 /// ## `alloc_area`
668 /// where to store the inner allocated area of the
669 /// returned cell renderer
670 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
671 #[allow(deprecated)]
672 #[doc(alias = "gtk_cell_area_get_cell_at_position")]
673 #[doc(alias = "get_cell_at_position")]
674 fn cell_at_position(
675 &self,
676 context: &impl IsA<CellAreaContext>,
677 widget: &impl IsA<Widget>,
678 cell_area: &gdk::Rectangle,
679 x: i32,
680 y: i32,
681 ) -> (CellRenderer, gdk::Rectangle) {
682 unsafe {
683 let mut alloc_area = gdk::Rectangle::uninitialized();
684 let ret = from_glib_none(ffi::gtk_cell_area_get_cell_at_position(
685 self.as_ref().to_glib_none().0,
686 context.as_ref().to_glib_none().0,
687 widget.as_ref().to_glib_none().0,
688 cell_area.to_glib_none().0,
689 x,
690 y,
691 alloc_area.to_glib_none_mut().0,
692 ));
693 (ret, alloc_area)
694 }
695 }
696
697 /// Gets the current [`TreePath`][crate::TreePath] string for the currently
698 /// applied [`TreeIter`][crate::TreeIter], this is implicitly updated when
699 /// gtk_cell_area_apply_attributes() is called and can be
700 /// used to interact with renderers from [`CellArea`][crate::CellArea]
701 /// subclasses.
702 ///
703 /// # Deprecated since 4.10
704 ///
705 ///
706 /// # Returns
707 ///
708 /// The current [`TreePath`][crate::TreePath] string for the current
709 /// attributes applied to @self. This string belongs to the area and
710 /// should not be freed.
711 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
712 #[allow(deprecated)]
713 #[doc(alias = "gtk_cell_area_get_current_path_string")]
714 #[doc(alias = "get_current_path_string")]
715 fn current_path_string(&self) -> glib::GString {
716 unsafe {
717 from_glib_none(ffi::gtk_cell_area_get_current_path_string(
718 self.as_ref().to_glib_none().0,
719 ))
720 }
721 }
722
723 /// Gets the [`CellEditable`][crate::CellEditable] widget currently used
724 /// to edit the currently edited cell.
725 ///
726 /// # Deprecated since 4.10
727 ///
728 ///
729 /// # Returns
730 ///
731 /// The currently active [`CellEditable`][crate::CellEditable] widget
732 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
733 #[allow(deprecated)]
734 #[doc(alias = "gtk_cell_area_get_edit_widget")]
735 #[doc(alias = "get_edit_widget")]
736 #[doc(alias = "edit-widget")]
737 fn edit_widget(&self) -> Option<CellEditable> {
738 unsafe {
739 from_glib_none(ffi::gtk_cell_area_get_edit_widget(
740 self.as_ref().to_glib_none().0,
741 ))
742 }
743 }
744
745 /// Gets the [`CellRenderer`][crate::CellRenderer] in @self that is currently
746 /// being edited.
747 ///
748 /// # Deprecated since 4.10
749 ///
750 ///
751 /// # Returns
752 ///
753 /// The currently edited [`CellRenderer`][crate::CellRenderer]
754 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
755 #[allow(deprecated)]
756 #[doc(alias = "gtk_cell_area_get_edited_cell")]
757 #[doc(alias = "get_edited_cell")]
758 #[doc(alias = "edited-cell")]
759 fn edited_cell(&self) -> Option<CellRenderer> {
760 unsafe {
761 from_glib_none(ffi::gtk_cell_area_get_edited_cell(
762 self.as_ref().to_glib_none().0,
763 ))
764 }
765 }
766
767 /// Retrieves the currently focused cell for @self
768 ///
769 /// # Deprecated since 4.10
770 ///
771 ///
772 /// # Returns
773 ///
774 /// the currently focused cell in @self.
775 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
776 #[allow(deprecated)]
777 #[doc(alias = "gtk_cell_area_get_focus_cell")]
778 #[doc(alias = "get_focus_cell")]
779 #[doc(alias = "focus-cell")]
780 fn focus_cell(&self) -> Option<CellRenderer> {
781 unsafe {
782 from_glib_none(ffi::gtk_cell_area_get_focus_cell(
783 self.as_ref().to_glib_none().0,
784 ))
785 }
786 }
787
788 /// Gets the [`CellRenderer`][crate::CellRenderer] which is expected to be focusable
789 /// for which @renderer is, or may be a sibling.
790 ///
791 /// This is handy for [`CellArea`][crate::CellArea] subclasses when handling events,
792 /// after determining the renderer at the event location it can
793 /// then chose to activate the focus cell for which the event
794 /// cell may have been a sibling.
795 ///
796 /// # Deprecated since 4.10
797 ///
798 /// ## `renderer`
799 /// the [`CellRenderer`][crate::CellRenderer]
800 ///
801 /// # Returns
802 ///
803 /// the [`CellRenderer`][crate::CellRenderer]
804 /// for which @renderer is a sibling
805 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
806 #[allow(deprecated)]
807 #[doc(alias = "gtk_cell_area_get_focus_from_sibling")]
808 #[doc(alias = "get_focus_from_sibling")]
809 fn focus_from_sibling(&self, renderer: &impl IsA<CellRenderer>) -> Option<CellRenderer> {
810 unsafe {
811 from_glib_none(ffi::gtk_cell_area_get_focus_from_sibling(
812 self.as_ref().to_glib_none().0,
813 renderer.as_ref().to_glib_none().0,
814 ))
815 }
816 }
817
818 /// Gets the focus sibling cell renderers for @renderer.
819 ///
820 /// # Deprecated since 4.10
821 ///
822 /// ## `renderer`
823 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
824 ///
825 /// # Returns
826 ///
827 /// A `GList` of [`CellRenderer`][crate::CellRenderer]s.
828 /// The returned list is internal and should not be freed.
829 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
830 #[allow(deprecated)]
831 #[doc(alias = "gtk_cell_area_get_focus_siblings")]
832 #[doc(alias = "get_focus_siblings")]
833 fn focus_siblings(&self, renderer: &impl IsA<CellRenderer>) -> Vec<CellRenderer> {
834 unsafe {
835 FromGlibPtrContainer::from_glib_none(ffi::gtk_cell_area_get_focus_siblings(
836 self.as_ref().to_glib_none().0,
837 renderer.as_ref().to_glib_none().0,
838 ))
839 }
840 }
841
842 /// Retrieves a cell area’s initial minimum and natural height.
843 ///
844 /// @self will store some geometrical information in @context along the way;
845 /// when requesting sizes over an arbitrary number of rows, it’s not important
846 /// to check the @minimum_height and @natural_height of this call but rather to
847 /// consult gtk_cell_area_context_get_preferred_height() after a series of
848 /// requests.
849 ///
850 /// # Deprecated since 4.10
851 ///
852 /// ## `context`
853 /// the [`CellArea`][crate::CellArea]Context to perform this request with
854 /// ## `widget`
855 /// the [`Widget`][crate::Widget] where @self will be rendering
856 ///
857 /// # Returns
858 ///
859 ///
860 /// ## `minimum_height`
861 /// location to store the minimum height
862 ///
863 /// ## `natural_height`
864 /// location to store the natural height
865 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
866 #[allow(deprecated)]
867 #[doc(alias = "gtk_cell_area_get_preferred_height")]
868 #[doc(alias = "get_preferred_height")]
869 fn preferred_height(
870 &self,
871 context: &impl IsA<CellAreaContext>,
872 widget: &impl IsA<Widget>,
873 ) -> (i32, i32) {
874 unsafe {
875 let mut minimum_height = std::mem::MaybeUninit::uninit();
876 let mut natural_height = std::mem::MaybeUninit::uninit();
877 ffi::gtk_cell_area_get_preferred_height(
878 self.as_ref().to_glib_none().0,
879 context.as_ref().to_glib_none().0,
880 widget.as_ref().to_glib_none().0,
881 minimum_height.as_mut_ptr(),
882 natural_height.as_mut_ptr(),
883 );
884 (minimum_height.assume_init(), natural_height.assume_init())
885 }
886 }
887
888 /// Retrieves a cell area’s minimum and natural height if it would be given
889 /// the specified @width.
890 ///
891 /// @self stores some geometrical information in @context along the way
892 /// while calling gtk_cell_area_get_preferred_width(). It’s important to
893 /// perform a series of gtk_cell_area_get_preferred_width() requests with
894 /// @context first and then call gtk_cell_area_get_preferred_height_for_width()
895 /// on each cell area individually to get the height for width of each
896 /// fully requested row.
897 ///
898 /// If at some point, the width of a single row changes, it should be
899 /// requested with gtk_cell_area_get_preferred_width() again and then
900 /// the full width of the requested rows checked again with
901 /// gtk_cell_area_context_get_preferred_width().
902 ///
903 /// # Deprecated since 4.10
904 ///
905 /// ## `context`
906 /// the [`CellArea`][crate::CellArea]Context which has already been requested for widths.
907 /// ## `widget`
908 /// the [`Widget`][crate::Widget] where @self will be rendering
909 /// ## `width`
910 /// the width for which to check the height of this area
911 ///
912 /// # Returns
913 ///
914 ///
915 /// ## `minimum_height`
916 /// location to store the minimum height
917 ///
918 /// ## `natural_height`
919 /// location to store the natural height
920 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
921 #[allow(deprecated)]
922 #[doc(alias = "gtk_cell_area_get_preferred_height_for_width")]
923 #[doc(alias = "get_preferred_height_for_width")]
924 fn preferred_height_for_width(
925 &self,
926 context: &impl IsA<CellAreaContext>,
927 widget: &impl IsA<Widget>,
928 width: i32,
929 ) -> (i32, i32) {
930 unsafe {
931 let mut minimum_height = std::mem::MaybeUninit::uninit();
932 let mut natural_height = std::mem::MaybeUninit::uninit();
933 ffi::gtk_cell_area_get_preferred_height_for_width(
934 self.as_ref().to_glib_none().0,
935 context.as_ref().to_glib_none().0,
936 widget.as_ref().to_glib_none().0,
937 width,
938 minimum_height.as_mut_ptr(),
939 natural_height.as_mut_ptr(),
940 );
941 (minimum_height.assume_init(), natural_height.assume_init())
942 }
943 }
944
945 /// Retrieves a cell area’s initial minimum and natural width.
946 ///
947 /// @self will store some geometrical information in @context along the way;
948 /// when requesting sizes over an arbitrary number of rows, it’s not important
949 /// to check the @minimum_width and @natural_width of this call but rather to
950 /// consult gtk_cell_area_context_get_preferred_width() after a series of
951 /// requests.
952 ///
953 /// # Deprecated since 4.10
954 ///
955 /// ## `context`
956 /// the [`CellArea`][crate::CellArea]Context to perform this request with
957 /// ## `widget`
958 /// the [`Widget`][crate::Widget] where @self will be rendering
959 ///
960 /// # Returns
961 ///
962 ///
963 /// ## `minimum_width`
964 /// location to store the minimum width
965 ///
966 /// ## `natural_width`
967 /// location to store the natural width
968 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
969 #[allow(deprecated)]
970 #[doc(alias = "gtk_cell_area_get_preferred_width")]
971 #[doc(alias = "get_preferred_width")]
972 fn preferred_width(
973 &self,
974 context: &impl IsA<CellAreaContext>,
975 widget: &impl IsA<Widget>,
976 ) -> (i32, i32) {
977 unsafe {
978 let mut minimum_width = std::mem::MaybeUninit::uninit();
979 let mut natural_width = std::mem::MaybeUninit::uninit();
980 ffi::gtk_cell_area_get_preferred_width(
981 self.as_ref().to_glib_none().0,
982 context.as_ref().to_glib_none().0,
983 widget.as_ref().to_glib_none().0,
984 minimum_width.as_mut_ptr(),
985 natural_width.as_mut_ptr(),
986 );
987 (minimum_width.assume_init(), natural_width.assume_init())
988 }
989 }
990
991 /// Retrieves a cell area’s minimum and natural width if it would be given
992 /// the specified @height.
993 ///
994 /// @self stores some geometrical information in @context along the way
995 /// while calling gtk_cell_area_get_preferred_height(). It’s important to
996 /// perform a series of gtk_cell_area_get_preferred_height() requests with
997 /// @context first and then call gtk_cell_area_get_preferred_width_for_height()
998 /// on each cell area individually to get the height for width of each
999 /// fully requested row.
1000 ///
1001 /// If at some point, the height of a single row changes, it should be
1002 /// requested with gtk_cell_area_get_preferred_height() again and then
1003 /// the full height of the requested rows checked again with
1004 /// gtk_cell_area_context_get_preferred_height().
1005 ///
1006 /// # Deprecated since 4.10
1007 ///
1008 /// ## `context`
1009 /// the [`CellArea`][crate::CellArea]Context which has already been requested for widths.
1010 /// ## `widget`
1011 /// the [`Widget`][crate::Widget] where @self will be rendering
1012 /// ## `height`
1013 /// the height for which to check the width of this area
1014 ///
1015 /// # Returns
1016 ///
1017 ///
1018 /// ## `minimum_width`
1019 /// location to store the minimum width
1020 ///
1021 /// ## `natural_width`
1022 /// location to store the natural width
1023 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1024 #[allow(deprecated)]
1025 #[doc(alias = "gtk_cell_area_get_preferred_width_for_height")]
1026 #[doc(alias = "get_preferred_width_for_height")]
1027 fn preferred_width_for_height(
1028 &self,
1029 context: &impl IsA<CellAreaContext>,
1030 widget: &impl IsA<Widget>,
1031 height: i32,
1032 ) -> (i32, i32) {
1033 unsafe {
1034 let mut minimum_width = std::mem::MaybeUninit::uninit();
1035 let mut natural_width = std::mem::MaybeUninit::uninit();
1036 ffi::gtk_cell_area_get_preferred_width_for_height(
1037 self.as_ref().to_glib_none().0,
1038 context.as_ref().to_glib_none().0,
1039 widget.as_ref().to_glib_none().0,
1040 height,
1041 minimum_width.as_mut_ptr(),
1042 natural_width.as_mut_ptr(),
1043 );
1044 (minimum_width.assume_init(), natural_width.assume_init())
1045 }
1046 }
1047
1048 /// Gets whether the area prefers a height-for-width layout
1049 /// or a width-for-height layout.
1050 ///
1051 /// # Deprecated since 4.10
1052 ///
1053 ///
1054 /// # Returns
1055 ///
1056 /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by @self.
1057 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1058 #[allow(deprecated)]
1059 #[doc(alias = "gtk_cell_area_get_request_mode")]
1060 #[doc(alias = "get_request_mode")]
1061 fn request_mode(&self) -> SizeRequestMode {
1062 unsafe {
1063 from_glib(ffi::gtk_cell_area_get_request_mode(
1064 self.as_ref().to_glib_none().0,
1065 ))
1066 }
1067 }
1068
1069 /// Checks if @self contains @renderer.
1070 ///
1071 /// # Deprecated since 4.10
1072 ///
1073 /// ## `renderer`
1074 /// the [`CellRenderer`][crate::CellRenderer] to check
1075 ///
1076 /// # Returns
1077 ///
1078 /// [`true`] if @renderer is in the @self.
1079 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1080 #[allow(deprecated)]
1081 #[doc(alias = "gtk_cell_area_has_renderer")]
1082 fn has_renderer(&self, renderer: &impl IsA<CellRenderer>) -> bool {
1083 unsafe {
1084 from_glib(ffi::gtk_cell_area_has_renderer(
1085 self.as_ref().to_glib_none().0,
1086 renderer.as_ref().to_glib_none().0,
1087 ))
1088 }
1089 }
1090
1091 /// This is a convenience function for [`CellArea`][crate::CellArea] implementations
1092 /// to get the inner area where a given [`CellRenderer`][crate::CellRenderer] will be
1093 /// rendered. It removes any padding previously added by gtk_cell_area_request_renderer().
1094 ///
1095 /// # Deprecated since 4.10
1096 ///
1097 /// ## `widget`
1098 /// the [`Widget`][crate::Widget] that @self is rendering onto
1099 /// ## `cell_area`
1100 /// the @widget relative coordinates where one of @self’s cells
1101 /// is to be placed
1102 ///
1103 /// # Returns
1104 ///
1105 ///
1106 /// ## `inner_area`
1107 /// the return location for the inner cell area
1108 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1109 #[allow(deprecated)]
1110 #[doc(alias = "gtk_cell_area_inner_cell_area")]
1111 fn inner_cell_area(
1112 &self,
1113 widget: &impl IsA<Widget>,
1114 cell_area: &gdk::Rectangle,
1115 ) -> gdk::Rectangle {
1116 unsafe {
1117 let mut inner_area = gdk::Rectangle::uninitialized();
1118 ffi::gtk_cell_area_inner_cell_area(
1119 self.as_ref().to_glib_none().0,
1120 widget.as_ref().to_glib_none().0,
1121 cell_area.to_glib_none().0,
1122 inner_area.to_glib_none_mut().0,
1123 );
1124 inner_area
1125 }
1126 }
1127
1128 /// Returns whether the area can do anything when activated,
1129 /// after applying new attributes to @self.
1130 ///
1131 /// # Deprecated since 4.10
1132 ///
1133 ///
1134 /// # Returns
1135 ///
1136 /// whether @self can do anything when activated.
1137 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1138 #[allow(deprecated)]
1139 #[doc(alias = "gtk_cell_area_is_activatable")]
1140 fn is_activatable(&self) -> bool {
1141 unsafe {
1142 from_glib(ffi::gtk_cell_area_is_activatable(
1143 self.as_ref().to_glib_none().0,
1144 ))
1145 }
1146 }
1147
1148 /// Returns whether @sibling is one of @renderer’s focus siblings
1149 /// (see gtk_cell_area_add_focus_sibling()).
1150 ///
1151 /// # Deprecated since 4.10
1152 ///
1153 /// ## `renderer`
1154 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
1155 /// ## `sibling`
1156 /// the [`CellRenderer`][crate::CellRenderer] to check against @renderer’s sibling list
1157 ///
1158 /// # Returns
1159 ///
1160 /// [`true`] if @sibling is a focus sibling of @renderer
1161 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1162 #[allow(deprecated)]
1163 #[doc(alias = "gtk_cell_area_is_focus_sibling")]
1164 fn is_focus_sibling(
1165 &self,
1166 renderer: &impl IsA<CellRenderer>,
1167 sibling: &impl IsA<CellRenderer>,
1168 ) -> bool {
1169 unsafe {
1170 from_glib(ffi::gtk_cell_area_is_focus_sibling(
1171 self.as_ref().to_glib_none().0,
1172 renderer.as_ref().to_glib_none().0,
1173 sibling.as_ref().to_glib_none().0,
1174 ))
1175 }
1176 }
1177
1178 /// Removes @renderer from @self.
1179 ///
1180 /// # Deprecated since 4.10
1181 ///
1182 /// ## `renderer`
1183 /// the [`CellRenderer`][crate::CellRenderer] to remove from @self
1184 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1185 #[allow(deprecated)]
1186 #[doc(alias = "gtk_cell_area_remove")]
1187 fn remove(&self, renderer: &impl IsA<CellRenderer>) {
1188 unsafe {
1189 ffi::gtk_cell_area_remove(
1190 self.as_ref().to_glib_none().0,
1191 renderer.as_ref().to_glib_none().0,
1192 );
1193 }
1194 }
1195
1196 /// Removes @sibling from @renderer’s focus sibling list
1197 /// (see gtk_cell_area_add_focus_sibling()).
1198 ///
1199 /// # Deprecated since 4.10
1200 ///
1201 /// ## `renderer`
1202 /// the [`CellRenderer`][crate::CellRenderer] expected to have focus
1203 /// ## `sibling`
1204 /// the [`CellRenderer`][crate::CellRenderer] to remove from @renderer’s focus area
1205 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1206 #[allow(deprecated)]
1207 #[doc(alias = "gtk_cell_area_remove_focus_sibling")]
1208 fn remove_focus_sibling(
1209 &self,
1210 renderer: &impl IsA<CellRenderer>,
1211 sibling: &impl IsA<CellRenderer>,
1212 ) {
1213 unsafe {
1214 ffi::gtk_cell_area_remove_focus_sibling(
1215 self.as_ref().to_glib_none().0,
1216 renderer.as_ref().to_glib_none().0,
1217 sibling.as_ref().to_glib_none().0,
1218 );
1219 }
1220 }
1221
1222 /// This is a convenience function for [`CellArea`][crate::CellArea] implementations
1223 /// to request size for cell renderers. It’s important to use this
1224 /// function to request size and then use gtk_cell_area_inner_cell_area()
1225 /// at render and event time since this function will add padding
1226 /// around the cell for focus painting.
1227 ///
1228 /// # Deprecated since 4.10
1229 ///
1230 /// ## `renderer`
1231 /// the [`CellRenderer`][crate::CellRenderer] to request size for
1232 /// ## `orientation`
1233 /// the [`Orientation`][crate::Orientation] in which to request size
1234 /// ## `widget`
1235 /// the [`Widget`][crate::Widget] that @self is rendering onto
1236 /// ## `for_size`
1237 /// the allocation contextual size to request for, or -1 if
1238 /// the base request for the orientation is to be returned.
1239 ///
1240 /// # Returns
1241 ///
1242 ///
1243 /// ## `minimum_size`
1244 /// location to store the minimum size
1245 ///
1246 /// ## `natural_size`
1247 /// location to store the natural size
1248 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1249 #[allow(deprecated)]
1250 #[doc(alias = "gtk_cell_area_request_renderer")]
1251 fn request_renderer(
1252 &self,
1253 renderer: &impl IsA<CellRenderer>,
1254 orientation: Orientation,
1255 widget: &impl IsA<Widget>,
1256 for_size: i32,
1257 ) -> (i32, i32) {
1258 unsafe {
1259 let mut minimum_size = std::mem::MaybeUninit::uninit();
1260 let mut natural_size = std::mem::MaybeUninit::uninit();
1261 ffi::gtk_cell_area_request_renderer(
1262 self.as_ref().to_glib_none().0,
1263 renderer.as_ref().to_glib_none().0,
1264 orientation.into_glib(),
1265 widget.as_ref().to_glib_none().0,
1266 for_size,
1267 minimum_size.as_mut_ptr(),
1268 natural_size.as_mut_ptr(),
1269 );
1270 (minimum_size.assume_init(), natural_size.assume_init())
1271 }
1272 }
1273
1274 /// Explicitly sets the currently focused cell to @renderer.
1275 ///
1276 /// This is generally called by implementations of
1277 /// `GtkCellAreaClass.focus()` or `GtkCellAreaClass.event()`,
1278 /// however it can also be used to implement functions such
1279 /// as gtk_tree_view_set_cursor_on_cell().
1280 ///
1281 /// # Deprecated since 4.10
1282 ///
1283 /// ## `renderer`
1284 /// the [`CellRenderer`][crate::CellRenderer] to give focus to
1285 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1286 #[allow(deprecated)]
1287 #[doc(alias = "gtk_cell_area_set_focus_cell")]
1288 #[doc(alias = "focus-cell")]
1289 fn set_focus_cell(&self, renderer: Option<&impl IsA<CellRenderer>>) {
1290 unsafe {
1291 ffi::gtk_cell_area_set_focus_cell(
1292 self.as_ref().to_glib_none().0,
1293 renderer.map(|p| p.as_ref()).to_glib_none().0,
1294 );
1295 }
1296 }
1297
1298 /// Snapshots @self’s cells according to @self’s layout onto at
1299 /// the given coordinates.
1300 ///
1301 /// # Deprecated since 4.10
1302 ///
1303 /// ## `context`
1304 /// the [`CellArea`][crate::CellArea]Context for this row of data.
1305 /// ## `widget`
1306 /// the [`Widget`][crate::Widget] that @self is rendering to
1307 /// ## `snapshot`
1308 /// the [`Snapshot`][crate::Snapshot] to draw to
1309 /// ## `background_area`
1310 /// the @widget relative coordinates for @self’s background
1311 /// ## `cell_area`
1312 /// the @widget relative coordinates for @self
1313 /// ## `flags`
1314 /// the [`CellRenderer`][crate::CellRenderer]State for @self in this row.
1315 /// ## `paint_focus`
1316 /// whether @self should paint focus on focused cells for focused rows or not.
1317 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1318 #[allow(deprecated)]
1319 #[doc(alias = "gtk_cell_area_snapshot")]
1320 fn snapshot(
1321 &self,
1322 context: &impl IsA<CellAreaContext>,
1323 widget: &impl IsA<Widget>,
1324 snapshot: &impl IsA<Snapshot>,
1325 background_area: &gdk::Rectangle,
1326 cell_area: &gdk::Rectangle,
1327 flags: CellRendererState,
1328 paint_focus: bool,
1329 ) {
1330 unsafe {
1331 ffi::gtk_cell_area_snapshot(
1332 self.as_ref().to_glib_none().0,
1333 context.as_ref().to_glib_none().0,
1334 widget.as_ref().to_glib_none().0,
1335 snapshot.as_ref().to_glib_none().0,
1336 background_area.to_glib_none().0,
1337 cell_area.to_glib_none().0,
1338 flags.into_glib(),
1339 paint_focus.into_glib(),
1340 );
1341 }
1342 }
1343
1344 /// Explicitly stops the editing of the currently edited cell.
1345 ///
1346 /// If @canceled is [`true`], the currently edited cell renderer
1347 /// will emit the ::editing-canceled signal, otherwise the
1348 /// the ::editing-done signal will be emitted on the current
1349 /// edit widget.
1350 ///
1351 /// See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget().
1352 ///
1353 /// # Deprecated since 4.10
1354 ///
1355 /// ## `canceled`
1356 /// whether editing was canceled.
1357 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1358 #[allow(deprecated)]
1359 #[doc(alias = "gtk_cell_area_stop_editing")]
1360 fn stop_editing(&self, canceled: bool) {
1361 unsafe {
1362 ffi::gtk_cell_area_stop_editing(self.as_ref().to_glib_none().0, canceled.into_glib());
1363 }
1364 }
1365
1366 /// Indicates that editing has started on @renderer and that @editable
1367 /// should be added to the owning cell-layouting widget at @cell_area.
1368 /// ## `renderer`
1369 /// the [`CellRenderer`][crate::CellRenderer] that started the edited
1370 /// ## `editable`
1371 /// the [`CellEditable`][crate::CellEditable] widget to add
1372 /// ## `cell_area`
1373 /// the [`Widget`][crate::Widget] relative [`gdk::Rectangle`][crate::gdk::Rectangle] coordinates
1374 /// where @editable should be added
1375 /// ## `path`
1376 /// the [`TreePath`][crate::TreePath] string this edit was initiated for
1377 #[doc(alias = "add-editable")]
1378 fn connect_add_editable<
1379 F: Fn(&Self, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
1380 >(
1381 &self,
1382 f: F,
1383 ) -> SignalHandlerId {
1384 unsafe extern "C" fn add_editable_trampoline<
1385 P: IsA<CellArea>,
1386 F: Fn(&P, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
1387 >(
1388 this: *mut ffi::GtkCellArea,
1389 renderer: *mut ffi::GtkCellRenderer,
1390 editable: *mut ffi::GtkCellEditable,
1391 cell_area: *mut gdk::ffi::GdkRectangle,
1392 path: *mut std::ffi::c_char,
1393 f: glib::ffi::gpointer,
1394 ) {
1395 unsafe {
1396 let f: &F = &*(f as *const F);
1397 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1398 f(
1399 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1400 &from_glib_borrow(renderer),
1401 &from_glib_borrow(editable),
1402 &from_glib_borrow(cell_area),
1403 path,
1404 )
1405 }
1406 }
1407 unsafe {
1408 let f: Box_<F> = Box_::new(f);
1409 connect_raw(
1410 self.as_ptr() as *mut _,
1411 c"add-editable".as_ptr(),
1412 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1413 add_editable_trampoline::<Self, F> as *const (),
1414 )),
1415 Box_::into_raw(f),
1416 )
1417 }
1418 }
1419
1420 /// This signal is emitted whenever applying attributes to @area from @model
1421 /// ## `model`
1422 /// the [`TreeModel`][crate::TreeModel] to apply the attributes from
1423 /// ## `iter`
1424 /// the [`TreeIter`][crate::TreeIter] indicating which row to apply the attributes of
1425 /// ## `is_expander`
1426 /// whether the view shows children for this row
1427 /// ## `is_expanded`
1428 /// whether the view is currently showing the children of this row
1429 #[doc(alias = "apply-attributes")]
1430 fn connect_apply_attributes<F: Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>(
1431 &self,
1432 f: F,
1433 ) -> SignalHandlerId {
1434 unsafe extern "C" fn apply_attributes_trampoline<
1435 P: IsA<CellArea>,
1436 F: Fn(&P, &TreeModel, &TreeIter, bool, bool) + 'static,
1437 >(
1438 this: *mut ffi::GtkCellArea,
1439 model: *mut ffi::GtkTreeModel,
1440 iter: *mut ffi::GtkTreeIter,
1441 is_expander: glib::ffi::gboolean,
1442 is_expanded: glib::ffi::gboolean,
1443 f: glib::ffi::gpointer,
1444 ) {
1445 unsafe {
1446 let f: &F = &*(f as *const F);
1447 f(
1448 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1449 &from_glib_borrow(model),
1450 &from_glib_borrow(iter),
1451 from_glib(is_expander),
1452 from_glib(is_expanded),
1453 )
1454 }
1455 }
1456 unsafe {
1457 let f: Box_<F> = Box_::new(f);
1458 connect_raw(
1459 self.as_ptr() as *mut _,
1460 c"apply-attributes".as_ptr(),
1461 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1462 apply_attributes_trampoline::<Self, F> as *const (),
1463 )),
1464 Box_::into_raw(f),
1465 )
1466 }
1467 }
1468
1469 /// Indicates that focus changed on this @area. This signal
1470 /// is emitted either as a result of focus handling or event
1471 /// handling.
1472 ///
1473 /// It's possible that the signal is emitted even if the
1474 /// currently focused renderer did not change, this is
1475 /// because focus may change to the same renderer in the
1476 /// same cell area for a different row of data.
1477 /// ## `renderer`
1478 /// the [`CellRenderer`][crate::CellRenderer] that has focus
1479 /// ## `path`
1480 /// the current [`TreePath`][crate::TreePath] string set for @area
1481 #[doc(alias = "focus-changed")]
1482 fn connect_focus_changed<F: Fn(&Self, &CellRenderer, TreePath) + 'static>(
1483 &self,
1484 f: F,
1485 ) -> SignalHandlerId {
1486 unsafe extern "C" fn focus_changed_trampoline<
1487 P: IsA<CellArea>,
1488 F: Fn(&P, &CellRenderer, TreePath) + 'static,
1489 >(
1490 this: *mut ffi::GtkCellArea,
1491 renderer: *mut ffi::GtkCellRenderer,
1492 path: *mut std::ffi::c_char,
1493 f: glib::ffi::gpointer,
1494 ) {
1495 unsafe {
1496 let f: &F = &*(f as *const F);
1497 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
1498 f(
1499 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1500 &from_glib_borrow(renderer),
1501 path,
1502 )
1503 }
1504 }
1505 unsafe {
1506 let f: Box_<F> = Box_::new(f);
1507 connect_raw(
1508 self.as_ptr() as *mut _,
1509 c"focus-changed".as_ptr(),
1510 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1511 focus_changed_trampoline::<Self, F> as *const (),
1512 )),
1513 Box_::into_raw(f),
1514 )
1515 }
1516 }
1517
1518 /// Indicates that editing finished on @renderer and that @editable
1519 /// should be removed from the owning cell-layouting widget.
1520 /// ## `renderer`
1521 /// the [`CellRenderer`][crate::CellRenderer] that finished editeding
1522 /// ## `editable`
1523 /// the [`CellEditable`][crate::CellEditable] widget to remove
1524 #[doc(alias = "remove-editable")]
1525 fn connect_remove_editable<F: Fn(&Self, &CellRenderer, &CellEditable) + 'static>(
1526 &self,
1527 f: F,
1528 ) -> SignalHandlerId {
1529 unsafe extern "C" fn remove_editable_trampoline<
1530 P: IsA<CellArea>,
1531 F: Fn(&P, &CellRenderer, &CellEditable) + 'static,
1532 >(
1533 this: *mut ffi::GtkCellArea,
1534 renderer: *mut ffi::GtkCellRenderer,
1535 editable: *mut ffi::GtkCellEditable,
1536 f: glib::ffi::gpointer,
1537 ) {
1538 unsafe {
1539 let f: &F = &*(f as *const F);
1540 f(
1541 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
1542 &from_glib_borrow(renderer),
1543 &from_glib_borrow(editable),
1544 )
1545 }
1546 }
1547 unsafe {
1548 let f: Box_<F> = Box_::new(f);
1549 connect_raw(
1550 self.as_ptr() as *mut _,
1551 c"remove-editable".as_ptr(),
1552 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1553 remove_editable_trampoline::<Self, F> as *const (),
1554 )),
1555 Box_::into_raw(f),
1556 )
1557 }
1558 }
1559
1560 #[doc(alias = "edit-widget")]
1561 fn connect_edit_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1562 unsafe extern "C" fn notify_edit_widget_trampoline<
1563 P: IsA<CellArea>,
1564 F: Fn(&P) + 'static,
1565 >(
1566 this: *mut ffi::GtkCellArea,
1567 _param_spec: glib::ffi::gpointer,
1568 f: glib::ffi::gpointer,
1569 ) {
1570 unsafe {
1571 let f: &F = &*(f as *const F);
1572 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1573 }
1574 }
1575 unsafe {
1576 let f: Box_<F> = Box_::new(f);
1577 connect_raw(
1578 self.as_ptr() as *mut _,
1579 c"notify::edit-widget".as_ptr(),
1580 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1581 notify_edit_widget_trampoline::<Self, F> as *const (),
1582 )),
1583 Box_::into_raw(f),
1584 )
1585 }
1586 }
1587
1588 #[doc(alias = "edited-cell")]
1589 fn connect_edited_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1590 unsafe extern "C" fn notify_edited_cell_trampoline<
1591 P: IsA<CellArea>,
1592 F: Fn(&P) + 'static,
1593 >(
1594 this: *mut ffi::GtkCellArea,
1595 _param_spec: glib::ffi::gpointer,
1596 f: glib::ffi::gpointer,
1597 ) {
1598 unsafe {
1599 let f: &F = &*(f as *const F);
1600 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1601 }
1602 }
1603 unsafe {
1604 let f: Box_<F> = Box_::new(f);
1605 connect_raw(
1606 self.as_ptr() as *mut _,
1607 c"notify::edited-cell".as_ptr(),
1608 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1609 notify_edited_cell_trampoline::<Self, F> as *const (),
1610 )),
1611 Box_::into_raw(f),
1612 )
1613 }
1614 }
1615
1616 #[doc(alias = "focus-cell")]
1617 fn connect_focus_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1618 unsafe extern "C" fn notify_focus_cell_trampoline<P: IsA<CellArea>, F: Fn(&P) + 'static>(
1619 this: *mut ffi::GtkCellArea,
1620 _param_spec: glib::ffi::gpointer,
1621 f: glib::ffi::gpointer,
1622 ) {
1623 unsafe {
1624 let f: &F = &*(f as *const F);
1625 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
1626 }
1627 }
1628 unsafe {
1629 let f: Box_<F> = Box_::new(f);
1630 connect_raw(
1631 self.as_ptr() as *mut _,
1632 c"notify::focus-cell".as_ptr(),
1633 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1634 notify_focus_cell_trampoline::<Self, F> as *const (),
1635 )),
1636 Box_::into_raw(f),
1637 )
1638 }
1639 }
1640}
1641
1642impl<O: IsA<CellArea>> CellAreaExt for O {}