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