1#![allow(deprecated)]
5
6use crate::{
7 ffi, Buildable, CellAreaContext, CellEditable, CellLayout, CellRenderer, CellRendererState,
8 DirectionType, Orientation, SizeRequestMode, Snapshot, TreeIter, TreeModel, TreePath, Widget,
9};
10use glib::{
11 object::ObjectType as _,
12 prelude::*,
13 signal::{connect_raw, SignalHandlerId},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 #[doc(alias = "GtkCellArea")]
20 pub struct CellArea(Object<ffi::GtkCellArea, ffi::GtkCellAreaClass>) @implements Buildable, CellLayout;
21
22 match fn {
23 type_ => || ffi::gtk_cell_area_get_type(),
24 }
25}
26
27impl CellArea {
28 pub const NONE: Option<&'static CellArea> = None;
29}
30
31pub trait CellAreaExt: IsA<CellArea> + 'static {
32 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
33 #[allow(deprecated)]
34 #[doc(alias = "gtk_cell_area_activate")]
35 fn activate(
36 &self,
37 context: &impl IsA<CellAreaContext>,
38 widget: &impl IsA<Widget>,
39 cell_area: &gdk::Rectangle,
40 flags: CellRendererState,
41 edit_only: bool,
42 ) -> bool {
43 unsafe {
44 from_glib(ffi::gtk_cell_area_activate(
45 self.as_ref().to_glib_none().0,
46 context.as_ref().to_glib_none().0,
47 widget.as_ref().to_glib_none().0,
48 cell_area.to_glib_none().0,
49 flags.into_glib(),
50 edit_only.into_glib(),
51 ))
52 }
53 }
54
55 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
56 #[allow(deprecated)]
57 #[doc(alias = "gtk_cell_area_activate_cell")]
58 fn activate_cell(
59 &self,
60 widget: &impl IsA<Widget>,
61 renderer: &impl IsA<CellRenderer>,
62 event: impl AsRef<gdk::Event>,
63 cell_area: &gdk::Rectangle,
64 flags: CellRendererState,
65 ) -> bool {
66 unsafe {
67 from_glib(ffi::gtk_cell_area_activate_cell(
68 self.as_ref().to_glib_none().0,
69 widget.as_ref().to_glib_none().0,
70 renderer.as_ref().to_glib_none().0,
71 event.as_ref().to_glib_none().0,
72 cell_area.to_glib_none().0,
73 flags.into_glib(),
74 ))
75 }
76 }
77
78 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
79 #[allow(deprecated)]
80 #[doc(alias = "gtk_cell_area_add")]
81 fn add(&self, renderer: &impl IsA<CellRenderer>) {
82 unsafe {
83 ffi::gtk_cell_area_add(
84 self.as_ref().to_glib_none().0,
85 renderer.as_ref().to_glib_none().0,
86 );
87 }
88 }
89
90 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
91 #[allow(deprecated)]
92 #[doc(alias = "gtk_cell_area_add_focus_sibling")]
93 fn add_focus_sibling(
94 &self,
95 renderer: &impl IsA<CellRenderer>,
96 sibling: &impl IsA<CellRenderer>,
97 ) {
98 unsafe {
99 ffi::gtk_cell_area_add_focus_sibling(
100 self.as_ref().to_glib_none().0,
101 renderer.as_ref().to_glib_none().0,
102 sibling.as_ref().to_glib_none().0,
103 );
104 }
105 }
106
107 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
108 #[allow(deprecated)]
109 #[doc(alias = "gtk_cell_area_apply_attributes")]
110 fn apply_attributes(
111 &self,
112 tree_model: &impl IsA<TreeModel>,
113 iter: &TreeIter,
114 is_expander: bool,
115 is_expanded: bool,
116 ) {
117 unsafe {
118 ffi::gtk_cell_area_apply_attributes(
119 self.as_ref().to_glib_none().0,
120 tree_model.as_ref().to_glib_none().0,
121 mut_override(iter.to_glib_none().0),
122 is_expander.into_glib(),
123 is_expanded.into_glib(),
124 );
125 }
126 }
127
128 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
129 #[allow(deprecated)]
130 #[doc(alias = "gtk_cell_area_attribute_connect")]
131 fn attribute_connect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str, column: i32) {
132 unsafe {
133 ffi::gtk_cell_area_attribute_connect(
134 self.as_ref().to_glib_none().0,
135 renderer.as_ref().to_glib_none().0,
136 attribute.to_glib_none().0,
137 column,
138 );
139 }
140 }
141
142 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
143 #[allow(deprecated)]
144 #[doc(alias = "gtk_cell_area_attribute_disconnect")]
145 fn attribute_disconnect(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) {
146 unsafe {
147 ffi::gtk_cell_area_attribute_disconnect(
148 self.as_ref().to_glib_none().0,
149 renderer.as_ref().to_glib_none().0,
150 attribute.to_glib_none().0,
151 );
152 }
153 }
154
155 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
156 #[allow(deprecated)]
157 #[doc(alias = "gtk_cell_area_attribute_get_column")]
158 fn attribute_get_column(&self, renderer: &impl IsA<CellRenderer>, attribute: &str) -> i32 {
159 unsafe {
160 ffi::gtk_cell_area_attribute_get_column(
161 self.as_ref().to_glib_none().0,
162 renderer.as_ref().to_glib_none().0,
163 attribute.to_glib_none().0,
164 )
165 }
166 }
167
168 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
169 #[allow(deprecated)]
170 #[doc(alias = "gtk_cell_area_copy_context")]
171 fn copy_context(&self, context: &impl IsA<CellAreaContext>) -> CellAreaContext {
172 unsafe {
173 from_glib_full(ffi::gtk_cell_area_copy_context(
174 self.as_ref().to_glib_none().0,
175 context.as_ref().to_glib_none().0,
176 ))
177 }
178 }
179
180 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
181 #[allow(deprecated)]
182 #[doc(alias = "gtk_cell_area_create_context")]
183 fn create_context(&self) -> CellAreaContext {
184 unsafe {
185 from_glib_full(ffi::gtk_cell_area_create_context(
186 self.as_ref().to_glib_none().0,
187 ))
188 }
189 }
190
191 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
192 #[allow(deprecated)]
193 #[doc(alias = "gtk_cell_area_event")]
194 fn event(
195 &self,
196 context: &impl IsA<CellAreaContext>,
197 widget: &impl IsA<Widget>,
198 event: impl AsRef<gdk::Event>,
199 cell_area: &gdk::Rectangle,
200 flags: CellRendererState,
201 ) -> i32 {
202 unsafe {
203 ffi::gtk_cell_area_event(
204 self.as_ref().to_glib_none().0,
205 context.as_ref().to_glib_none().0,
206 widget.as_ref().to_glib_none().0,
207 event.as_ref().to_glib_none().0,
208 cell_area.to_glib_none().0,
209 flags.into_glib(),
210 )
211 }
212 }
213
214 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
215 #[allow(deprecated)]
216 #[doc(alias = "gtk_cell_area_focus")]
217 fn focus(&self, direction: DirectionType) -> bool {
218 unsafe {
219 from_glib(ffi::gtk_cell_area_focus(
220 self.as_ref().to_glib_none().0,
221 direction.into_glib(),
222 ))
223 }
224 }
225
226 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
227 #[allow(deprecated)]
228 #[doc(alias = "gtk_cell_area_foreach")]
229 fn foreach<P: FnMut(&CellRenderer) -> bool>(&self, callback: P) {
230 let mut callback_data: P = callback;
231 unsafe extern "C" fn callback_func<P: FnMut(&CellRenderer) -> bool>(
232 renderer: *mut ffi::GtkCellRenderer,
233 data: glib::ffi::gpointer,
234 ) -> glib::ffi::gboolean {
235 let renderer = from_glib_borrow(renderer);
236 let callback = data as *mut P;
237 (*callback)(&renderer).into_glib()
238 }
239 let callback = Some(callback_func::<P> as _);
240 let super_callback0: &mut P = &mut callback_data;
241 unsafe {
242 ffi::gtk_cell_area_foreach(
243 self.as_ref().to_glib_none().0,
244 callback,
245 super_callback0 as *mut _ as *mut _,
246 );
247 }
248 }
249
250 #[doc(alias = "gtk_cell_area_foreach_alloc")]
251 fn foreach_alloc<P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool>(
252 &self,
253 context: &impl IsA<CellAreaContext>,
254 widget: &impl IsA<Widget>,
255 cell_area: &gdk::Rectangle,
256 background_area: &gdk::Rectangle,
257 callback: P,
258 ) {
259 let mut callback_data: P = callback;
260 unsafe extern "C" fn callback_func<
261 P: FnMut(&CellRenderer, &gdk::Rectangle, &gdk::Rectangle) -> bool,
262 >(
263 renderer: *mut ffi::GtkCellRenderer,
264 cell_area: *const gdk::ffi::GdkRectangle,
265 cell_background: *const gdk::ffi::GdkRectangle,
266 data: glib::ffi::gpointer,
267 ) -> glib::ffi::gboolean {
268 let renderer = from_glib_borrow(renderer);
269 let cell_area = from_glib_borrow(cell_area);
270 let cell_background = from_glib_borrow(cell_background);
271 let callback = data as *mut P;
272 (*callback)(&renderer, &cell_area, &cell_background).into_glib()
273 }
274 let callback = Some(callback_func::<P> as _);
275 let super_callback0: &mut P = &mut callback_data;
276 unsafe {
277 ffi::gtk_cell_area_foreach_alloc(
278 self.as_ref().to_glib_none().0,
279 context.as_ref().to_glib_none().0,
280 widget.as_ref().to_glib_none().0,
281 cell_area.to_glib_none().0,
282 background_area.to_glib_none().0,
283 callback,
284 super_callback0 as *mut _ as *mut _,
285 );
286 }
287 }
288
289 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
290 #[allow(deprecated)]
291 #[doc(alias = "gtk_cell_area_get_cell_allocation")]
292 #[doc(alias = "get_cell_allocation")]
293 fn cell_allocation(
294 &self,
295 context: &impl IsA<CellAreaContext>,
296 widget: &impl IsA<Widget>,
297 renderer: &impl IsA<CellRenderer>,
298 cell_area: &gdk::Rectangle,
299 ) -> gdk::Rectangle {
300 unsafe {
301 let mut allocation = gdk::Rectangle::uninitialized();
302 ffi::gtk_cell_area_get_cell_allocation(
303 self.as_ref().to_glib_none().0,
304 context.as_ref().to_glib_none().0,
305 widget.as_ref().to_glib_none().0,
306 renderer.as_ref().to_glib_none().0,
307 cell_area.to_glib_none().0,
308 allocation.to_glib_none_mut().0,
309 );
310 allocation
311 }
312 }
313
314 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
315 #[allow(deprecated)]
316 #[doc(alias = "gtk_cell_area_get_cell_at_position")]
317 #[doc(alias = "get_cell_at_position")]
318 fn cell_at_position(
319 &self,
320 context: &impl IsA<CellAreaContext>,
321 widget: &impl IsA<Widget>,
322 cell_area: &gdk::Rectangle,
323 x: i32,
324 y: i32,
325 ) -> (CellRenderer, gdk::Rectangle) {
326 unsafe {
327 let mut alloc_area = gdk::Rectangle::uninitialized();
328 let ret = from_glib_none(ffi::gtk_cell_area_get_cell_at_position(
329 self.as_ref().to_glib_none().0,
330 context.as_ref().to_glib_none().0,
331 widget.as_ref().to_glib_none().0,
332 cell_area.to_glib_none().0,
333 x,
334 y,
335 alloc_area.to_glib_none_mut().0,
336 ));
337 (ret, alloc_area)
338 }
339 }
340
341 #[doc(alias = "gtk_cell_area_get_current_path_string")]
342 #[doc(alias = "get_current_path_string")]
343 fn current_path_string(&self) -> glib::GString {
344 unsafe {
345 from_glib_none(ffi::gtk_cell_area_get_current_path_string(
346 self.as_ref().to_glib_none().0,
347 ))
348 }
349 }
350
351 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
352 #[allow(deprecated)]
353 #[doc(alias = "gtk_cell_area_get_edit_widget")]
354 #[doc(alias = "get_edit_widget")]
355 #[doc(alias = "edit-widget")]
356 fn edit_widget(&self) -> Option<CellEditable> {
357 unsafe {
358 from_glib_none(ffi::gtk_cell_area_get_edit_widget(
359 self.as_ref().to_glib_none().0,
360 ))
361 }
362 }
363
364 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
365 #[allow(deprecated)]
366 #[doc(alias = "gtk_cell_area_get_edited_cell")]
367 #[doc(alias = "get_edited_cell")]
368 #[doc(alias = "edited-cell")]
369 fn edited_cell(&self) -> Option<CellRenderer> {
370 unsafe {
371 from_glib_none(ffi::gtk_cell_area_get_edited_cell(
372 self.as_ref().to_glib_none().0,
373 ))
374 }
375 }
376
377 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
378 #[allow(deprecated)]
379 #[doc(alias = "gtk_cell_area_get_focus_cell")]
380 #[doc(alias = "get_focus_cell")]
381 #[doc(alias = "focus-cell")]
382 fn focus_cell(&self) -> Option<CellRenderer> {
383 unsafe {
384 from_glib_none(ffi::gtk_cell_area_get_focus_cell(
385 self.as_ref().to_glib_none().0,
386 ))
387 }
388 }
389
390 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
391 #[allow(deprecated)]
392 #[doc(alias = "gtk_cell_area_get_focus_from_sibling")]
393 #[doc(alias = "get_focus_from_sibling")]
394 fn focus_from_sibling(&self, renderer: &impl IsA<CellRenderer>) -> Option<CellRenderer> {
395 unsafe {
396 from_glib_none(ffi::gtk_cell_area_get_focus_from_sibling(
397 self.as_ref().to_glib_none().0,
398 renderer.as_ref().to_glib_none().0,
399 ))
400 }
401 }
402
403 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
404 #[allow(deprecated)]
405 #[doc(alias = "gtk_cell_area_get_focus_siblings")]
406 #[doc(alias = "get_focus_siblings")]
407 fn focus_siblings(&self, renderer: &impl IsA<CellRenderer>) -> Vec<CellRenderer> {
408 unsafe {
409 FromGlibPtrContainer::from_glib_none(ffi::gtk_cell_area_get_focus_siblings(
410 self.as_ref().to_glib_none().0,
411 renderer.as_ref().to_glib_none().0,
412 ))
413 }
414 }
415
416 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
417 #[allow(deprecated)]
418 #[doc(alias = "gtk_cell_area_get_preferred_height")]
419 #[doc(alias = "get_preferred_height")]
420 fn preferred_height(
421 &self,
422 context: &impl IsA<CellAreaContext>,
423 widget: &impl IsA<Widget>,
424 ) -> (i32, i32) {
425 unsafe {
426 let mut minimum_height = std::mem::MaybeUninit::uninit();
427 let mut natural_height = std::mem::MaybeUninit::uninit();
428 ffi::gtk_cell_area_get_preferred_height(
429 self.as_ref().to_glib_none().0,
430 context.as_ref().to_glib_none().0,
431 widget.as_ref().to_glib_none().0,
432 minimum_height.as_mut_ptr(),
433 natural_height.as_mut_ptr(),
434 );
435 (minimum_height.assume_init(), natural_height.assume_init())
436 }
437 }
438
439 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
440 #[allow(deprecated)]
441 #[doc(alias = "gtk_cell_area_get_preferred_height_for_width")]
442 #[doc(alias = "get_preferred_height_for_width")]
443 fn preferred_height_for_width(
444 &self,
445 context: &impl IsA<CellAreaContext>,
446 widget: &impl IsA<Widget>,
447 width: i32,
448 ) -> (i32, i32) {
449 unsafe {
450 let mut minimum_height = std::mem::MaybeUninit::uninit();
451 let mut natural_height = std::mem::MaybeUninit::uninit();
452 ffi::gtk_cell_area_get_preferred_height_for_width(
453 self.as_ref().to_glib_none().0,
454 context.as_ref().to_glib_none().0,
455 widget.as_ref().to_glib_none().0,
456 width,
457 minimum_height.as_mut_ptr(),
458 natural_height.as_mut_ptr(),
459 );
460 (minimum_height.assume_init(), natural_height.assume_init())
461 }
462 }
463
464 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
465 #[allow(deprecated)]
466 #[doc(alias = "gtk_cell_area_get_preferred_width")]
467 #[doc(alias = "get_preferred_width")]
468 fn preferred_width(
469 &self,
470 context: &impl IsA<CellAreaContext>,
471 widget: &impl IsA<Widget>,
472 ) -> (i32, i32) {
473 unsafe {
474 let mut minimum_width = std::mem::MaybeUninit::uninit();
475 let mut natural_width = std::mem::MaybeUninit::uninit();
476 ffi::gtk_cell_area_get_preferred_width(
477 self.as_ref().to_glib_none().0,
478 context.as_ref().to_glib_none().0,
479 widget.as_ref().to_glib_none().0,
480 minimum_width.as_mut_ptr(),
481 natural_width.as_mut_ptr(),
482 );
483 (minimum_width.assume_init(), natural_width.assume_init())
484 }
485 }
486
487 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
488 #[allow(deprecated)]
489 #[doc(alias = "gtk_cell_area_get_preferred_width_for_height")]
490 #[doc(alias = "get_preferred_width_for_height")]
491 fn preferred_width_for_height(
492 &self,
493 context: &impl IsA<CellAreaContext>,
494 widget: &impl IsA<Widget>,
495 height: i32,
496 ) -> (i32, i32) {
497 unsafe {
498 let mut minimum_width = std::mem::MaybeUninit::uninit();
499 let mut natural_width = std::mem::MaybeUninit::uninit();
500 ffi::gtk_cell_area_get_preferred_width_for_height(
501 self.as_ref().to_glib_none().0,
502 context.as_ref().to_glib_none().0,
503 widget.as_ref().to_glib_none().0,
504 height,
505 minimum_width.as_mut_ptr(),
506 natural_width.as_mut_ptr(),
507 );
508 (minimum_width.assume_init(), natural_width.assume_init())
509 }
510 }
511
512 #[doc(alias = "gtk_cell_area_get_request_mode")]
513 #[doc(alias = "get_request_mode")]
514 fn request_mode(&self) -> SizeRequestMode {
515 unsafe {
516 from_glib(ffi::gtk_cell_area_get_request_mode(
517 self.as_ref().to_glib_none().0,
518 ))
519 }
520 }
521
522 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
523 #[allow(deprecated)]
524 #[doc(alias = "gtk_cell_area_has_renderer")]
525 fn has_renderer(&self, renderer: &impl IsA<CellRenderer>) -> bool {
526 unsafe {
527 from_glib(ffi::gtk_cell_area_has_renderer(
528 self.as_ref().to_glib_none().0,
529 renderer.as_ref().to_glib_none().0,
530 ))
531 }
532 }
533
534 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
535 #[allow(deprecated)]
536 #[doc(alias = "gtk_cell_area_inner_cell_area")]
537 fn inner_cell_area(
538 &self,
539 widget: &impl IsA<Widget>,
540 cell_area: &gdk::Rectangle,
541 ) -> gdk::Rectangle {
542 unsafe {
543 let mut inner_area = gdk::Rectangle::uninitialized();
544 ffi::gtk_cell_area_inner_cell_area(
545 self.as_ref().to_glib_none().0,
546 widget.as_ref().to_glib_none().0,
547 cell_area.to_glib_none().0,
548 inner_area.to_glib_none_mut().0,
549 );
550 inner_area
551 }
552 }
553
554 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
555 #[allow(deprecated)]
556 #[doc(alias = "gtk_cell_area_is_activatable")]
557 fn is_activatable(&self) -> bool {
558 unsafe {
559 from_glib(ffi::gtk_cell_area_is_activatable(
560 self.as_ref().to_glib_none().0,
561 ))
562 }
563 }
564
565 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
566 #[allow(deprecated)]
567 #[doc(alias = "gtk_cell_area_is_focus_sibling")]
568 fn is_focus_sibling(
569 &self,
570 renderer: &impl IsA<CellRenderer>,
571 sibling: &impl IsA<CellRenderer>,
572 ) -> bool {
573 unsafe {
574 from_glib(ffi::gtk_cell_area_is_focus_sibling(
575 self.as_ref().to_glib_none().0,
576 renderer.as_ref().to_glib_none().0,
577 sibling.as_ref().to_glib_none().0,
578 ))
579 }
580 }
581
582 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
583 #[allow(deprecated)]
584 #[doc(alias = "gtk_cell_area_remove")]
585 fn remove(&self, renderer: &impl IsA<CellRenderer>) {
586 unsafe {
587 ffi::gtk_cell_area_remove(
588 self.as_ref().to_glib_none().0,
589 renderer.as_ref().to_glib_none().0,
590 );
591 }
592 }
593
594 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
595 #[allow(deprecated)]
596 #[doc(alias = "gtk_cell_area_remove_focus_sibling")]
597 fn remove_focus_sibling(
598 &self,
599 renderer: &impl IsA<CellRenderer>,
600 sibling: &impl IsA<CellRenderer>,
601 ) {
602 unsafe {
603 ffi::gtk_cell_area_remove_focus_sibling(
604 self.as_ref().to_glib_none().0,
605 renderer.as_ref().to_glib_none().0,
606 sibling.as_ref().to_glib_none().0,
607 );
608 }
609 }
610
611 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
612 #[allow(deprecated)]
613 #[doc(alias = "gtk_cell_area_request_renderer")]
614 fn request_renderer(
615 &self,
616 renderer: &impl IsA<CellRenderer>,
617 orientation: Orientation,
618 widget: &impl IsA<Widget>,
619 for_size: i32,
620 ) -> (i32, i32) {
621 unsafe {
622 let mut minimum_size = std::mem::MaybeUninit::uninit();
623 let mut natural_size = std::mem::MaybeUninit::uninit();
624 ffi::gtk_cell_area_request_renderer(
625 self.as_ref().to_glib_none().0,
626 renderer.as_ref().to_glib_none().0,
627 orientation.into_glib(),
628 widget.as_ref().to_glib_none().0,
629 for_size,
630 minimum_size.as_mut_ptr(),
631 natural_size.as_mut_ptr(),
632 );
633 (minimum_size.assume_init(), natural_size.assume_init())
634 }
635 }
636
637 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
638 #[allow(deprecated)]
639 #[doc(alias = "gtk_cell_area_set_focus_cell")]
640 #[doc(alias = "focus-cell")]
641 fn set_focus_cell(&self, renderer: Option<&impl IsA<CellRenderer>>) {
642 unsafe {
643 ffi::gtk_cell_area_set_focus_cell(
644 self.as_ref().to_glib_none().0,
645 renderer.map(|p| p.as_ref()).to_glib_none().0,
646 );
647 }
648 }
649
650 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
651 #[allow(deprecated)]
652 #[doc(alias = "gtk_cell_area_snapshot")]
653 fn snapshot(
654 &self,
655 context: &impl IsA<CellAreaContext>,
656 widget: &impl IsA<Widget>,
657 snapshot: &impl IsA<Snapshot>,
658 background_area: &gdk::Rectangle,
659 cell_area: &gdk::Rectangle,
660 flags: CellRendererState,
661 paint_focus: bool,
662 ) {
663 unsafe {
664 ffi::gtk_cell_area_snapshot(
665 self.as_ref().to_glib_none().0,
666 context.as_ref().to_glib_none().0,
667 widget.as_ref().to_glib_none().0,
668 snapshot.as_ref().to_glib_none().0,
669 background_area.to_glib_none().0,
670 cell_area.to_glib_none().0,
671 flags.into_glib(),
672 paint_focus.into_glib(),
673 );
674 }
675 }
676
677 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
678 #[allow(deprecated)]
679 #[doc(alias = "gtk_cell_area_stop_editing")]
680 fn stop_editing(&self, canceled: bool) {
681 unsafe {
682 ffi::gtk_cell_area_stop_editing(self.as_ref().to_glib_none().0, canceled.into_glib());
683 }
684 }
685
686 #[doc(alias = "add-editable")]
687 fn connect_add_editable<
688 F: Fn(&Self, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
689 >(
690 &self,
691 f: F,
692 ) -> SignalHandlerId {
693 unsafe extern "C" fn add_editable_trampoline<
694 P: IsA<CellArea>,
695 F: Fn(&P, &CellRenderer, &CellEditable, &gdk::Rectangle, TreePath) + 'static,
696 >(
697 this: *mut ffi::GtkCellArea,
698 renderer: *mut ffi::GtkCellRenderer,
699 editable: *mut ffi::GtkCellEditable,
700 cell_area: *mut gdk::ffi::GdkRectangle,
701 path: *mut std::ffi::c_char,
702 f: glib::ffi::gpointer,
703 ) {
704 let f: &F = &*(f as *const F);
705 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
706 f(
707 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
708 &from_glib_borrow(renderer),
709 &from_glib_borrow(editable),
710 &from_glib_borrow(cell_area),
711 path,
712 )
713 }
714 unsafe {
715 let f: Box_<F> = Box_::new(f);
716 connect_raw(
717 self.as_ptr() as *mut _,
718 c"add-editable".as_ptr() as *const _,
719 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
720 add_editable_trampoline::<Self, F> as *const (),
721 )),
722 Box_::into_raw(f),
723 )
724 }
725 }
726
727 #[doc(alias = "apply-attributes")]
728 fn connect_apply_attributes<F: Fn(&Self, &TreeModel, &TreeIter, bool, bool) + 'static>(
729 &self,
730 f: F,
731 ) -> SignalHandlerId {
732 unsafe extern "C" fn apply_attributes_trampoline<
733 P: IsA<CellArea>,
734 F: Fn(&P, &TreeModel, &TreeIter, bool, bool) + 'static,
735 >(
736 this: *mut ffi::GtkCellArea,
737 model: *mut ffi::GtkTreeModel,
738 iter: *mut ffi::GtkTreeIter,
739 is_expander: glib::ffi::gboolean,
740 is_expanded: glib::ffi::gboolean,
741 f: glib::ffi::gpointer,
742 ) {
743 let f: &F = &*(f as *const F);
744 f(
745 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
746 &from_glib_borrow(model),
747 &from_glib_borrow(iter),
748 from_glib(is_expander),
749 from_glib(is_expanded),
750 )
751 }
752 unsafe {
753 let f: Box_<F> = Box_::new(f);
754 connect_raw(
755 self.as_ptr() as *mut _,
756 c"apply-attributes".as_ptr() as *const _,
757 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
758 apply_attributes_trampoline::<Self, F> as *const (),
759 )),
760 Box_::into_raw(f),
761 )
762 }
763 }
764
765 #[doc(alias = "focus-changed")]
766 fn connect_focus_changed<F: Fn(&Self, &CellRenderer, TreePath) + 'static>(
767 &self,
768 f: F,
769 ) -> SignalHandlerId {
770 unsafe extern "C" fn focus_changed_trampoline<
771 P: IsA<CellArea>,
772 F: Fn(&P, &CellRenderer, TreePath) + 'static,
773 >(
774 this: *mut ffi::GtkCellArea,
775 renderer: *mut ffi::GtkCellRenderer,
776 path: *mut std::ffi::c_char,
777 f: glib::ffi::gpointer,
778 ) {
779 let f: &F = &*(f as *const F);
780 let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path));
781 f(
782 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
783 &from_glib_borrow(renderer),
784 path,
785 )
786 }
787 unsafe {
788 let f: Box_<F> = Box_::new(f);
789 connect_raw(
790 self.as_ptr() as *mut _,
791 c"focus-changed".as_ptr() as *const _,
792 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
793 focus_changed_trampoline::<Self, F> as *const (),
794 )),
795 Box_::into_raw(f),
796 )
797 }
798 }
799
800 #[doc(alias = "remove-editable")]
801 fn connect_remove_editable<F: Fn(&Self, &CellRenderer, &CellEditable) + 'static>(
802 &self,
803 f: F,
804 ) -> SignalHandlerId {
805 unsafe extern "C" fn remove_editable_trampoline<
806 P: IsA<CellArea>,
807 F: Fn(&P, &CellRenderer, &CellEditable) + 'static,
808 >(
809 this: *mut ffi::GtkCellArea,
810 renderer: *mut ffi::GtkCellRenderer,
811 editable: *mut ffi::GtkCellEditable,
812 f: glib::ffi::gpointer,
813 ) {
814 let f: &F = &*(f as *const F);
815 f(
816 CellArea::from_glib_borrow(this).unsafe_cast_ref(),
817 &from_glib_borrow(renderer),
818 &from_glib_borrow(editable),
819 )
820 }
821 unsafe {
822 let f: Box_<F> = Box_::new(f);
823 connect_raw(
824 self.as_ptr() as *mut _,
825 c"remove-editable".as_ptr() as *const _,
826 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
827 remove_editable_trampoline::<Self, F> as *const (),
828 )),
829 Box_::into_raw(f),
830 )
831 }
832 }
833
834 #[doc(alias = "edit-widget")]
835 fn connect_edit_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
836 unsafe extern "C" fn notify_edit_widget_trampoline<
837 P: IsA<CellArea>,
838 F: Fn(&P) + 'static,
839 >(
840 this: *mut ffi::GtkCellArea,
841 _param_spec: glib::ffi::gpointer,
842 f: glib::ffi::gpointer,
843 ) {
844 let f: &F = &*(f as *const F);
845 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
846 }
847 unsafe {
848 let f: Box_<F> = Box_::new(f);
849 connect_raw(
850 self.as_ptr() as *mut _,
851 c"notify::edit-widget".as_ptr() as *const _,
852 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
853 notify_edit_widget_trampoline::<Self, F> as *const (),
854 )),
855 Box_::into_raw(f),
856 )
857 }
858 }
859
860 #[doc(alias = "edited-cell")]
861 fn connect_edited_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
862 unsafe extern "C" fn notify_edited_cell_trampoline<
863 P: IsA<CellArea>,
864 F: Fn(&P) + 'static,
865 >(
866 this: *mut ffi::GtkCellArea,
867 _param_spec: glib::ffi::gpointer,
868 f: glib::ffi::gpointer,
869 ) {
870 let f: &F = &*(f as *const F);
871 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
872 }
873 unsafe {
874 let f: Box_<F> = Box_::new(f);
875 connect_raw(
876 self.as_ptr() as *mut _,
877 c"notify::edited-cell".as_ptr() as *const _,
878 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
879 notify_edited_cell_trampoline::<Self, F> as *const (),
880 )),
881 Box_::into_raw(f),
882 )
883 }
884 }
885
886 #[doc(alias = "focus-cell")]
887 fn connect_focus_cell_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
888 unsafe extern "C" fn notify_focus_cell_trampoline<P: IsA<CellArea>, F: Fn(&P) + 'static>(
889 this: *mut ffi::GtkCellArea,
890 _param_spec: glib::ffi::gpointer,
891 f: glib::ffi::gpointer,
892 ) {
893 let f: &F = &*(f as *const F);
894 f(CellArea::from_glib_borrow(this).unsafe_cast_ref())
895 }
896 unsafe {
897 let f: Box_<F> = Box_::new(f);
898 connect_raw(
899 self.as_ptr() as *mut _,
900 c"notify::focus-cell".as_ptr() as *const _,
901 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
902 notify_focus_cell_trampoline::<Self, F> as *const (),
903 )),
904 Box_::into_raw(f),
905 )
906 }
907 }
908}
909
910impl<O: IsA<CellArea>> CellAreaExt for O {}