1use gdk;
6use gdk_pixbuf;
7use glib::object::Cast;
8use glib::object::IsA;
9use glib::signal::connect_raw;
10use glib::signal::SignalHandlerId;
11use glib::translate::*;
12use glib::StaticType;
13use glib::ToValue;
14use glib::Value;
15use glib_sys;
16use gobject_sys;
17use gtk_sys;
18use std::boxed::Box as Box_;
19use std::fmt;
20use std::mem::transmute;
21use Align;
22use Buildable;
23use CellArea;
24use CellAreaContext;
25use CellLayout;
26use Container;
27use Orientable;
28use TreeModel;
29use TreePath;
30use Widget;
31
32glib_wrapper! {
33 pub struct CellView(Object<gtk_sys::GtkCellView, gtk_sys::GtkCellViewClass, CellViewClass>) @extends Widget, @implements Buildable, CellLayout, Orientable;
34
35 match fn {
36 get_type => || gtk_sys::gtk_cell_view_get_type(),
37 }
38}
39
40impl CellView {
41 pub fn new() -> CellView {
42 assert_initialized_main_thread!();
43 unsafe { Widget::from_glib_none(gtk_sys::gtk_cell_view_new()).unsafe_cast() }
44 }
45
46 pub fn new_with_context<P: IsA<CellArea>, Q: IsA<CellAreaContext>>(
47 area: &P,
48 context: &Q,
49 ) -> CellView {
50 skip_assert_initialized!();
51 unsafe {
52 Widget::from_glib_none(gtk_sys::gtk_cell_view_new_with_context(
53 area.as_ref().to_glib_none().0,
54 context.as_ref().to_glib_none().0,
55 ))
56 .unsafe_cast()
57 }
58 }
59
60 pub fn new_with_markup(markup: &str) -> CellView {
61 assert_initialized_main_thread!();
62 unsafe {
63 Widget::from_glib_none(gtk_sys::gtk_cell_view_new_with_markup(
64 markup.to_glib_none().0,
65 ))
66 .unsafe_cast()
67 }
68 }
69
70 pub fn new_with_pixbuf(pixbuf: &gdk_pixbuf::Pixbuf) -> CellView {
71 assert_initialized_main_thread!();
72 unsafe {
73 Widget::from_glib_none(gtk_sys::gtk_cell_view_new_with_pixbuf(
74 pixbuf.to_glib_none().0,
75 ))
76 .unsafe_cast()
77 }
78 }
79
80 pub fn new_with_text(text: &str) -> CellView {
81 assert_initialized_main_thread!();
82 unsafe {
83 Widget::from_glib_none(gtk_sys::gtk_cell_view_new_with_text(text.to_glib_none().0))
84 .unsafe_cast()
85 }
86 }
87}
88
89impl Default for CellView {
90 fn default() -> Self {
91 Self::new()
92 }
93}
94
95pub struct CellViewBuilder {
96 background: Option<String>,
97 background_rgba: Option<gdk::RGBA>,
98 background_set: Option<bool>,
99 cell_area: Option<CellArea>,
100 cell_area_context: Option<CellAreaContext>,
101 draw_sensitive: Option<bool>,
102 fit_model: Option<bool>,
103 model: Option<TreeModel>,
104 app_paintable: Option<bool>,
105 can_default: Option<bool>,
106 can_focus: Option<bool>,
107 events: Option<gdk::EventMask>,
108 expand: Option<bool>,
109 #[cfg(any(feature = "v3_20", feature = "dox"))]
110 focus_on_click: Option<bool>,
111 halign: Option<Align>,
112 has_default: Option<bool>,
113 has_focus: Option<bool>,
114 has_tooltip: Option<bool>,
115 height_request: Option<i32>,
116 hexpand: Option<bool>,
117 hexpand_set: Option<bool>,
118 is_focus: Option<bool>,
119 margin: Option<i32>,
120 margin_bottom: Option<i32>,
121 margin_end: Option<i32>,
122 margin_start: Option<i32>,
123 margin_top: Option<i32>,
124 name: Option<String>,
125 no_show_all: Option<bool>,
126 opacity: Option<f64>,
127 parent: Option<Container>,
128 receives_default: Option<bool>,
129 sensitive: Option<bool>,
130 tooltip_markup: Option<String>,
132 tooltip_text: Option<String>,
133 valign: Option<Align>,
134 vexpand: Option<bool>,
135 vexpand_set: Option<bool>,
136 visible: Option<bool>,
137 width_request: Option<i32>,
138}
139
140impl CellViewBuilder {
141 pub fn new() -> Self {
142 Self {
143 background: None,
144 background_rgba: None,
145 background_set: None,
146 cell_area: None,
147 cell_area_context: None,
148 draw_sensitive: None,
149 fit_model: None,
150 model: None,
151 app_paintable: None,
152 can_default: None,
153 can_focus: None,
154 events: None,
155 expand: None,
156 #[cfg(any(feature = "v3_20", feature = "dox"))]
157 focus_on_click: None,
158 halign: None,
159 has_default: None,
160 has_focus: None,
161 has_tooltip: None,
162 height_request: None,
163 hexpand: None,
164 hexpand_set: None,
165 is_focus: None,
166 margin: None,
167 margin_bottom: None,
168 margin_end: None,
169 margin_start: None,
170 margin_top: None,
171 name: None,
172 no_show_all: None,
173 opacity: None,
174 parent: None,
175 receives_default: None,
176 sensitive: None,
177 tooltip_markup: None,
178 tooltip_text: None,
179 valign: None,
180 vexpand: None,
181 vexpand_set: None,
182 visible: None,
183 width_request: None,
184 }
185 }
186
187 pub fn build(self) -> CellView {
188 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
189 if let Some(ref background) = self.background {
190 properties.push(("background", background));
191 }
192 if let Some(ref background_rgba) = self.background_rgba {
193 properties.push(("background-rgba", background_rgba));
194 }
195 if let Some(ref background_set) = self.background_set {
196 properties.push(("background-set", background_set));
197 }
198 if let Some(ref cell_area) = self.cell_area {
199 properties.push(("cell-area", cell_area));
200 }
201 if let Some(ref cell_area_context) = self.cell_area_context {
202 properties.push(("cell-area-context", cell_area_context));
203 }
204 if let Some(ref draw_sensitive) = self.draw_sensitive {
205 properties.push(("draw-sensitive", draw_sensitive));
206 }
207 if let Some(ref fit_model) = self.fit_model {
208 properties.push(("fit-model", fit_model));
209 }
210 if let Some(ref model) = self.model {
211 properties.push(("model", model));
212 }
213 if let Some(ref app_paintable) = self.app_paintable {
214 properties.push(("app-paintable", app_paintable));
215 }
216 if let Some(ref can_default) = self.can_default {
217 properties.push(("can-default", can_default));
218 }
219 if let Some(ref can_focus) = self.can_focus {
220 properties.push(("can-focus", can_focus));
221 }
222 if let Some(ref events) = self.events {
223 properties.push(("events", events));
224 }
225 if let Some(ref expand) = self.expand {
226 properties.push(("expand", expand));
227 }
228 #[cfg(any(feature = "v3_20", feature = "dox"))]
229 {
230 if let Some(ref focus_on_click) = self.focus_on_click {
231 properties.push(("focus-on-click", focus_on_click));
232 }
233 }
234 if let Some(ref halign) = self.halign {
235 properties.push(("halign", halign));
236 }
237 if let Some(ref has_default) = self.has_default {
238 properties.push(("has-default", has_default));
239 }
240 if let Some(ref has_focus) = self.has_focus {
241 properties.push(("has-focus", has_focus));
242 }
243 if let Some(ref has_tooltip) = self.has_tooltip {
244 properties.push(("has-tooltip", has_tooltip));
245 }
246 if let Some(ref height_request) = self.height_request {
247 properties.push(("height-request", height_request));
248 }
249 if let Some(ref hexpand) = self.hexpand {
250 properties.push(("hexpand", hexpand));
251 }
252 if let Some(ref hexpand_set) = self.hexpand_set {
253 properties.push(("hexpand-set", hexpand_set));
254 }
255 if let Some(ref is_focus) = self.is_focus {
256 properties.push(("is-focus", is_focus));
257 }
258 if let Some(ref margin) = self.margin {
259 properties.push(("margin", margin));
260 }
261 if let Some(ref margin_bottom) = self.margin_bottom {
262 properties.push(("margin-bottom", margin_bottom));
263 }
264 if let Some(ref margin_end) = self.margin_end {
265 properties.push(("margin-end", margin_end));
266 }
267 if let Some(ref margin_start) = self.margin_start {
268 properties.push(("margin-start", margin_start));
269 }
270 if let Some(ref margin_top) = self.margin_top {
271 properties.push(("margin-top", margin_top));
272 }
273 if let Some(ref name) = self.name {
274 properties.push(("name", name));
275 }
276 if let Some(ref no_show_all) = self.no_show_all {
277 properties.push(("no-show-all", no_show_all));
278 }
279 if let Some(ref opacity) = self.opacity {
280 properties.push(("opacity", opacity));
281 }
282 if let Some(ref parent) = self.parent {
283 properties.push(("parent", parent));
284 }
285 if let Some(ref receives_default) = self.receives_default {
286 properties.push(("receives-default", receives_default));
287 }
288 if let Some(ref sensitive) = self.sensitive {
289 properties.push(("sensitive", sensitive));
290 }
291 if let Some(ref tooltip_markup) = self.tooltip_markup {
292 properties.push(("tooltip-markup", tooltip_markup));
293 }
294 if let Some(ref tooltip_text) = self.tooltip_text {
295 properties.push(("tooltip-text", tooltip_text));
296 }
297 if let Some(ref valign) = self.valign {
298 properties.push(("valign", valign));
299 }
300 if let Some(ref vexpand) = self.vexpand {
301 properties.push(("vexpand", vexpand));
302 }
303 if let Some(ref vexpand_set) = self.vexpand_set {
304 properties.push(("vexpand-set", vexpand_set));
305 }
306 if let Some(ref visible) = self.visible {
307 properties.push(("visible", visible));
308 }
309 if let Some(ref width_request) = self.width_request {
310 properties.push(("width-request", width_request));
311 }
312 glib::Object::new(CellView::static_type(), &properties)
313 .expect("object new")
314 .downcast()
315 .expect("downcast")
316 }
317
318 pub fn background(mut self, background: &str) -> Self {
319 self.background = Some(background.to_string());
320 self
321 }
322
323 pub fn background_rgba(mut self, background_rgba: &gdk::RGBA) -> Self {
324 self.background_rgba = Some(background_rgba.clone());
325 self
326 }
327
328 pub fn background_set(mut self, background_set: bool) -> Self {
329 self.background_set = Some(background_set);
330 self
331 }
332
333 pub fn cell_area(mut self, cell_area: &CellArea) -> Self {
334 self.cell_area = Some(cell_area.clone());
335 self
336 }
337
338 pub fn cell_area_context(mut self, cell_area_context: &CellAreaContext) -> Self {
339 self.cell_area_context = Some(cell_area_context.clone());
340 self
341 }
342
343 pub fn draw_sensitive(mut self, draw_sensitive: bool) -> Self {
344 self.draw_sensitive = Some(draw_sensitive);
345 self
346 }
347
348 pub fn fit_model(mut self, fit_model: bool) -> Self {
349 self.fit_model = Some(fit_model);
350 self
351 }
352
353 pub fn model(mut self, model: &TreeModel) -> Self {
354 self.model = Some(model.clone());
355 self
356 }
357
358 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
359 self.app_paintable = Some(app_paintable);
360 self
361 }
362
363 pub fn can_default(mut self, can_default: bool) -> Self {
364 self.can_default = Some(can_default);
365 self
366 }
367
368 pub fn can_focus(mut self, can_focus: bool) -> Self {
369 self.can_focus = Some(can_focus);
370 self
371 }
372
373 pub fn events(mut self, events: gdk::EventMask) -> Self {
374 self.events = Some(events);
375 self
376 }
377
378 pub fn expand(mut self, expand: bool) -> Self {
379 self.expand = Some(expand);
380 self
381 }
382
383 #[cfg(any(feature = "v3_20", feature = "dox"))]
384 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
385 self.focus_on_click = Some(focus_on_click);
386 self
387 }
388
389 pub fn halign(mut self, halign: Align) -> Self {
390 self.halign = Some(halign);
391 self
392 }
393
394 pub fn has_default(mut self, has_default: bool) -> Self {
395 self.has_default = Some(has_default);
396 self
397 }
398
399 pub fn has_focus(mut self, has_focus: bool) -> Self {
400 self.has_focus = Some(has_focus);
401 self
402 }
403
404 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
405 self.has_tooltip = Some(has_tooltip);
406 self
407 }
408
409 pub fn height_request(mut self, height_request: i32) -> Self {
410 self.height_request = Some(height_request);
411 self
412 }
413
414 pub fn hexpand(mut self, hexpand: bool) -> Self {
415 self.hexpand = Some(hexpand);
416 self
417 }
418
419 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
420 self.hexpand_set = Some(hexpand_set);
421 self
422 }
423
424 pub fn is_focus(mut self, is_focus: bool) -> Self {
425 self.is_focus = Some(is_focus);
426 self
427 }
428
429 pub fn margin(mut self, margin: i32) -> Self {
430 self.margin = Some(margin);
431 self
432 }
433
434 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
435 self.margin_bottom = Some(margin_bottom);
436 self
437 }
438
439 pub fn margin_end(mut self, margin_end: i32) -> Self {
440 self.margin_end = Some(margin_end);
441 self
442 }
443
444 pub fn margin_start(mut self, margin_start: i32) -> Self {
445 self.margin_start = Some(margin_start);
446 self
447 }
448
449 pub fn margin_top(mut self, margin_top: i32) -> Self {
450 self.margin_top = Some(margin_top);
451 self
452 }
453
454 pub fn name(mut self, name: &str) -> Self {
455 self.name = Some(name.to_string());
456 self
457 }
458
459 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
460 self.no_show_all = Some(no_show_all);
461 self
462 }
463
464 pub fn opacity(mut self, opacity: f64) -> Self {
465 self.opacity = Some(opacity);
466 self
467 }
468
469 pub fn parent(mut self, parent: &Container) -> Self {
470 self.parent = Some(parent.clone());
471 self
472 }
473
474 pub fn receives_default(mut self, receives_default: bool) -> Self {
475 self.receives_default = Some(receives_default);
476 self
477 }
478
479 pub fn sensitive(mut self, sensitive: bool) -> Self {
480 self.sensitive = Some(sensitive);
481 self
482 }
483
484 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
485 self.tooltip_markup = Some(tooltip_markup.to_string());
486 self
487 }
488
489 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
490 self.tooltip_text = Some(tooltip_text.to_string());
491 self
492 }
493
494 pub fn valign(mut self, valign: Align) -> Self {
495 self.valign = Some(valign);
496 self
497 }
498
499 pub fn vexpand(mut self, vexpand: bool) -> Self {
500 self.vexpand = Some(vexpand);
501 self
502 }
503
504 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
505 self.vexpand_set = Some(vexpand_set);
506 self
507 }
508
509 pub fn visible(mut self, visible: bool) -> Self {
510 self.visible = Some(visible);
511 self
512 }
513
514 pub fn width_request(mut self, width_request: i32) -> Self {
515 self.width_request = Some(width_request);
516 self
517 }
518}
519
520pub const NONE_CELL_VIEW: Option<&CellView> = None;
521
522pub trait CellViewExt: 'static {
523 fn get_displayed_row(&self) -> Option<TreePath>;
524
525 fn get_draw_sensitive(&self) -> bool;
526
527 fn get_fit_model(&self) -> bool;
528
529 fn get_model(&self) -> Option<TreeModel>;
530
531 fn set_background_rgba(&self, rgba: &gdk::RGBA);
532
533 fn set_displayed_row(&self, path: &mut TreePath);
534
535 fn set_draw_sensitive(&self, draw_sensitive: bool);
536
537 fn set_fit_model(&self, fit_model: bool);
538
539 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>);
540
541 fn set_property_background(&self, background: Option<&str>);
542
543 fn get_property_background_rgba(&self) -> Option<gdk::RGBA>;
544
545 fn get_property_background_set(&self) -> bool;
546
547 fn set_property_background_set(&self, background_set: bool);
548
549 fn get_property_cell_area(&self) -> Option<CellArea>;
550
551 fn get_property_cell_area_context(&self) -> Option<CellAreaContext>;
552
553 fn connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
554
555 fn connect_property_background_rgba_notify<F: Fn(&Self) + 'static>(
556 &self,
557 f: F,
558 ) -> SignalHandlerId;
559
560 fn connect_property_background_set_notify<F: Fn(&Self) + 'static>(
561 &self,
562 f: F,
563 ) -> SignalHandlerId;
564
565 fn connect_property_draw_sensitive_notify<F: Fn(&Self) + 'static>(
566 &self,
567 f: F,
568 ) -> SignalHandlerId;
569
570 fn connect_property_fit_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
571
572 fn connect_property_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
573}
574
575impl<O: IsA<CellView>> CellViewExt for O {
576 fn get_displayed_row(&self) -> Option<TreePath> {
577 unsafe {
578 from_glib_full(gtk_sys::gtk_cell_view_get_displayed_row(
579 self.as_ref().to_glib_none().0,
580 ))
581 }
582 }
583
584 fn get_draw_sensitive(&self) -> bool {
585 unsafe {
586 from_glib(gtk_sys::gtk_cell_view_get_draw_sensitive(
587 self.as_ref().to_glib_none().0,
588 ))
589 }
590 }
591
592 fn get_fit_model(&self) -> bool {
593 unsafe {
594 from_glib(gtk_sys::gtk_cell_view_get_fit_model(
595 self.as_ref().to_glib_none().0,
596 ))
597 }
598 }
599
600 fn get_model(&self) -> Option<TreeModel> {
601 unsafe {
602 from_glib_none(gtk_sys::gtk_cell_view_get_model(
603 self.as_ref().to_glib_none().0,
604 ))
605 }
606 }
607
608 fn set_background_rgba(&self, rgba: &gdk::RGBA) {
609 unsafe {
610 gtk_sys::gtk_cell_view_set_background_rgba(
611 self.as_ref().to_glib_none().0,
612 rgba.to_glib_none().0,
613 );
614 }
615 }
616
617 fn set_displayed_row(&self, path: &mut TreePath) {
618 unsafe {
619 gtk_sys::gtk_cell_view_set_displayed_row(
620 self.as_ref().to_glib_none().0,
621 path.to_glib_none_mut().0,
622 );
623 }
624 }
625
626 fn set_draw_sensitive(&self, draw_sensitive: bool) {
627 unsafe {
628 gtk_sys::gtk_cell_view_set_draw_sensitive(
629 self.as_ref().to_glib_none().0,
630 draw_sensitive.to_glib(),
631 );
632 }
633 }
634
635 fn set_fit_model(&self, fit_model: bool) {
636 unsafe {
637 gtk_sys::gtk_cell_view_set_fit_model(
638 self.as_ref().to_glib_none().0,
639 fit_model.to_glib(),
640 );
641 }
642 }
643
644 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>) {
645 unsafe {
646 gtk_sys::gtk_cell_view_set_model(
647 self.as_ref().to_glib_none().0,
648 model.map(|p| p.as_ref()).to_glib_none().0,
649 );
650 }
651 }
652
653 fn set_property_background(&self, background: Option<&str>) {
654 unsafe {
655 gobject_sys::g_object_set_property(
656 self.to_glib_none().0 as *mut gobject_sys::GObject,
657 b"background\0".as_ptr() as *const _,
658 Value::from(background).to_glib_none().0,
659 );
660 }
661 }
662
663 fn get_property_background_rgba(&self) -> Option<gdk::RGBA> {
664 unsafe {
665 let mut value = Value::from_type(<gdk::RGBA as StaticType>::static_type());
666 gobject_sys::g_object_get_property(
667 self.to_glib_none().0 as *mut gobject_sys::GObject,
668 b"background-rgba\0".as_ptr() as *const _,
669 value.to_glib_none_mut().0,
670 );
671 value.get()
672 }
673 }
674
675 fn get_property_background_set(&self) -> bool {
676 unsafe {
677 let mut value = Value::from_type(<bool as StaticType>::static_type());
678 gobject_sys::g_object_get_property(
679 self.to_glib_none().0 as *mut gobject_sys::GObject,
680 b"background-set\0".as_ptr() as *const _,
681 value.to_glib_none_mut().0,
682 );
683 value.get().unwrap()
684 }
685 }
686
687 fn set_property_background_set(&self, background_set: bool) {
688 unsafe {
689 gobject_sys::g_object_set_property(
690 self.to_glib_none().0 as *mut gobject_sys::GObject,
691 b"background-set\0".as_ptr() as *const _,
692 Value::from(&background_set).to_glib_none().0,
693 );
694 }
695 }
696
697 fn get_property_cell_area(&self) -> Option<CellArea> {
698 unsafe {
699 let mut value = Value::from_type(<CellArea as StaticType>::static_type());
700 gobject_sys::g_object_get_property(
701 self.to_glib_none().0 as *mut gobject_sys::GObject,
702 b"cell-area\0".as_ptr() as *const _,
703 value.to_glib_none_mut().0,
704 );
705 value.get()
706 }
707 }
708
709 fn get_property_cell_area_context(&self) -> Option<CellAreaContext> {
710 unsafe {
711 let mut value = Value::from_type(<CellAreaContext as StaticType>::static_type());
712 gobject_sys::g_object_get_property(
713 self.to_glib_none().0 as *mut gobject_sys::GObject,
714 b"cell-area-context\0".as_ptr() as *const _,
715 value.to_glib_none_mut().0,
716 );
717 value.get()
718 }
719 }
720
721 fn connect_property_background_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
722 unsafe extern "C" fn notify_background_trampoline<P, F: Fn(&P) + 'static>(
723 this: *mut gtk_sys::GtkCellView,
724 _param_spec: glib_sys::gpointer,
725 f: glib_sys::gpointer,
726 ) where
727 P: IsA<CellView>,
728 {
729 let f: &F = &*(f as *const F);
730 f(&CellView::from_glib_borrow(this).unsafe_cast())
731 }
732 unsafe {
733 let f: Box_<F> = Box_::new(f);
734 connect_raw(
735 self.as_ptr() as *mut _,
736 b"notify::background\0".as_ptr() as *const _,
737 Some(transmute(notify_background_trampoline::<Self, F> as usize)),
738 Box_::into_raw(f),
739 )
740 }
741 }
742
743 fn connect_property_background_rgba_notify<F: Fn(&Self) + 'static>(
744 &self,
745 f: F,
746 ) -> SignalHandlerId {
747 unsafe extern "C" fn notify_background_rgba_trampoline<P, F: Fn(&P) + 'static>(
748 this: *mut gtk_sys::GtkCellView,
749 _param_spec: glib_sys::gpointer,
750 f: glib_sys::gpointer,
751 ) where
752 P: IsA<CellView>,
753 {
754 let f: &F = &*(f as *const F);
755 f(&CellView::from_glib_borrow(this).unsafe_cast())
756 }
757 unsafe {
758 let f: Box_<F> = Box_::new(f);
759 connect_raw(
760 self.as_ptr() as *mut _,
761 b"notify::background-rgba\0".as_ptr() as *const _,
762 Some(transmute(
763 notify_background_rgba_trampoline::<Self, F> as usize,
764 )),
765 Box_::into_raw(f),
766 )
767 }
768 }
769
770 fn connect_property_background_set_notify<F: Fn(&Self) + 'static>(
771 &self,
772 f: F,
773 ) -> SignalHandlerId {
774 unsafe extern "C" fn notify_background_set_trampoline<P, F: Fn(&P) + 'static>(
775 this: *mut gtk_sys::GtkCellView,
776 _param_spec: glib_sys::gpointer,
777 f: glib_sys::gpointer,
778 ) where
779 P: IsA<CellView>,
780 {
781 let f: &F = &*(f as *const F);
782 f(&CellView::from_glib_borrow(this).unsafe_cast())
783 }
784 unsafe {
785 let f: Box_<F> = Box_::new(f);
786 connect_raw(
787 self.as_ptr() as *mut _,
788 b"notify::background-set\0".as_ptr() as *const _,
789 Some(transmute(
790 notify_background_set_trampoline::<Self, F> as usize,
791 )),
792 Box_::into_raw(f),
793 )
794 }
795 }
796
797 fn connect_property_draw_sensitive_notify<F: Fn(&Self) + 'static>(
798 &self,
799 f: F,
800 ) -> SignalHandlerId {
801 unsafe extern "C" fn notify_draw_sensitive_trampoline<P, F: Fn(&P) + 'static>(
802 this: *mut gtk_sys::GtkCellView,
803 _param_spec: glib_sys::gpointer,
804 f: glib_sys::gpointer,
805 ) where
806 P: IsA<CellView>,
807 {
808 let f: &F = &*(f as *const F);
809 f(&CellView::from_glib_borrow(this).unsafe_cast())
810 }
811 unsafe {
812 let f: Box_<F> = Box_::new(f);
813 connect_raw(
814 self.as_ptr() as *mut _,
815 b"notify::draw-sensitive\0".as_ptr() as *const _,
816 Some(transmute(
817 notify_draw_sensitive_trampoline::<Self, F> as usize,
818 )),
819 Box_::into_raw(f),
820 )
821 }
822 }
823
824 fn connect_property_fit_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
825 unsafe extern "C" fn notify_fit_model_trampoline<P, F: Fn(&P) + 'static>(
826 this: *mut gtk_sys::GtkCellView,
827 _param_spec: glib_sys::gpointer,
828 f: glib_sys::gpointer,
829 ) where
830 P: IsA<CellView>,
831 {
832 let f: &F = &*(f as *const F);
833 f(&CellView::from_glib_borrow(this).unsafe_cast())
834 }
835 unsafe {
836 let f: Box_<F> = Box_::new(f);
837 connect_raw(
838 self.as_ptr() as *mut _,
839 b"notify::fit-model\0".as_ptr() as *const _,
840 Some(transmute(notify_fit_model_trampoline::<Self, F> as usize)),
841 Box_::into_raw(f),
842 )
843 }
844 }
845
846 fn connect_property_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
847 unsafe extern "C" fn notify_model_trampoline<P, F: Fn(&P) + 'static>(
848 this: *mut gtk_sys::GtkCellView,
849 _param_spec: glib_sys::gpointer,
850 f: glib_sys::gpointer,
851 ) where
852 P: IsA<CellView>,
853 {
854 let f: &F = &*(f as *const F);
855 f(&CellView::from_glib_borrow(this).unsafe_cast())
856 }
857 unsafe {
858 let f: Box_<F> = Box_::new(f);
859 connect_raw(
860 self.as_ptr() as *mut _,
861 b"notify::model\0".as_ptr() as *const _,
862 Some(transmute(notify_model_trampoline::<Self, F> as usize)),
863 Box_::into_raw(f),
864 )
865 }
866 }
867}
868
869impl fmt::Display for CellView {
870 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
871 write!(f, "CellView")
872 }
873}