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