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::BaselinePosition;
7 use crate::Buildable;
8 use crate::Container;
9 use crate::Orientable;
10 use crate::Orientation;
11 use crate::PositionType;
12 use crate::ResizeMode;
13 use crate::Widget;
14 use glib::object::Cast;
15 use glib::object::IsA;
16 use glib::signal::connect_raw;
17 use glib::signal::SignalHandlerId;
18 use glib::translate::*;
19 use glib::StaticType;
20 use glib::ToValue;
21 use std::boxed::Box as Box_;
22 use std::fmt;
23 use std::mem::transmute;
24 
25 glib::wrapper! {
26     #[doc(alias = "GtkGrid")]
27     pub struct Grid(Object<ffi::GtkGrid, ffi::GtkGridClass>) @extends Container, Widget, @implements Buildable, Orientable;
28 
29     match fn {
30         type_ => || ffi::gtk_grid_get_type(),
31     }
32 }
33 
34 impl Grid {
35     #[doc(alias = "gtk_grid_new")]
new() -> Grid36     pub fn new() -> Grid {
37         assert_initialized_main_thread!();
38         unsafe { Widget::from_glib_none(ffi::gtk_grid_new()).unsafe_cast() }
39     }
40 
41     // rustdoc-stripper-ignore-next
42     /// Creates a new builder-pattern struct instance to construct [`Grid`] objects.
43     ///
44     /// This method returns an instance of [`GridBuilder`] which can be used to create [`Grid`] objects.
builder() -> GridBuilder45     pub fn builder() -> GridBuilder {
46         GridBuilder::default()
47     }
48 }
49 
50 impl Default for Grid {
default() -> Self51     fn default() -> Self {
52         Self::new()
53     }
54 }
55 
56 #[derive(Clone, Default)]
57 // rustdoc-stripper-ignore-next
58 /// A [builder-pattern] type to construct [`Grid`] objects.
59 ///
60 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
61 pub struct GridBuilder {
62     baseline_row: Option<i32>,
63     column_homogeneous: Option<bool>,
64     column_spacing: Option<i32>,
65     row_homogeneous: Option<bool>,
66     row_spacing: Option<i32>,
67     border_width: Option<u32>,
68     child: Option<Widget>,
69     resize_mode: Option<ResizeMode>,
70     app_paintable: Option<bool>,
71     can_default: Option<bool>,
72     can_focus: Option<bool>,
73     events: Option<gdk::EventMask>,
74     expand: Option<bool>,
75     #[cfg(any(feature = "v3_20", feature = "dox"))]
76     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
77     focus_on_click: Option<bool>,
78     halign: Option<Align>,
79     has_default: Option<bool>,
80     has_focus: Option<bool>,
81     has_tooltip: Option<bool>,
82     height_request: Option<i32>,
83     hexpand: Option<bool>,
84     hexpand_set: Option<bool>,
85     is_focus: Option<bool>,
86     margin: Option<i32>,
87     margin_bottom: Option<i32>,
88     margin_end: Option<i32>,
89     margin_start: Option<i32>,
90     margin_top: Option<i32>,
91     name: Option<String>,
92     no_show_all: Option<bool>,
93     opacity: Option<f64>,
94     parent: Option<Container>,
95     receives_default: Option<bool>,
96     sensitive: Option<bool>,
97     tooltip_markup: Option<String>,
98     tooltip_text: Option<String>,
99     valign: Option<Align>,
100     vexpand: Option<bool>,
101     vexpand_set: Option<bool>,
102     visible: Option<bool>,
103     width_request: Option<i32>,
104     orientation: Option<Orientation>,
105 }
106 
107 impl GridBuilder {
108     // rustdoc-stripper-ignore-next
109     /// Create a new [`GridBuilder`].
new() -> Self110     pub fn new() -> Self {
111         Self::default()
112     }
113 
114     // rustdoc-stripper-ignore-next
115     /// Build the [`Grid`].
build(self) -> Grid116     pub fn build(self) -> Grid {
117         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
118         if let Some(ref baseline_row) = self.baseline_row {
119             properties.push(("baseline-row", baseline_row));
120         }
121         if let Some(ref column_homogeneous) = self.column_homogeneous {
122             properties.push(("column-homogeneous", column_homogeneous));
123         }
124         if let Some(ref column_spacing) = self.column_spacing {
125             properties.push(("column-spacing", column_spacing));
126         }
127         if let Some(ref row_homogeneous) = self.row_homogeneous {
128             properties.push(("row-homogeneous", row_homogeneous));
129         }
130         if let Some(ref row_spacing) = self.row_spacing {
131             properties.push(("row-spacing", row_spacing));
132         }
133         if let Some(ref border_width) = self.border_width {
134             properties.push(("border-width", border_width));
135         }
136         if let Some(ref child) = self.child {
137             properties.push(("child", child));
138         }
139         if let Some(ref resize_mode) = self.resize_mode {
140             properties.push(("resize-mode", resize_mode));
141         }
142         if let Some(ref app_paintable) = self.app_paintable {
143             properties.push(("app-paintable", app_paintable));
144         }
145         if let Some(ref can_default) = self.can_default {
146             properties.push(("can-default", can_default));
147         }
148         if let Some(ref can_focus) = self.can_focus {
149             properties.push(("can-focus", can_focus));
150         }
151         if let Some(ref events) = self.events {
152             properties.push(("events", events));
153         }
154         if let Some(ref expand) = self.expand {
155             properties.push(("expand", expand));
156         }
157         #[cfg(any(feature = "v3_20", feature = "dox"))]
158         if let Some(ref focus_on_click) = self.focus_on_click {
159             properties.push(("focus-on-click", focus_on_click));
160         }
161         if let Some(ref halign) = self.halign {
162             properties.push(("halign", halign));
163         }
164         if let Some(ref has_default) = self.has_default {
165             properties.push(("has-default", has_default));
166         }
167         if let Some(ref has_focus) = self.has_focus {
168             properties.push(("has-focus", has_focus));
169         }
170         if let Some(ref has_tooltip) = self.has_tooltip {
171             properties.push(("has-tooltip", has_tooltip));
172         }
173         if let Some(ref height_request) = self.height_request {
174             properties.push(("height-request", height_request));
175         }
176         if let Some(ref hexpand) = self.hexpand {
177             properties.push(("hexpand", hexpand));
178         }
179         if let Some(ref hexpand_set) = self.hexpand_set {
180             properties.push(("hexpand-set", hexpand_set));
181         }
182         if let Some(ref is_focus) = self.is_focus {
183             properties.push(("is-focus", is_focus));
184         }
185         if let Some(ref margin) = self.margin {
186             properties.push(("margin", margin));
187         }
188         if let Some(ref margin_bottom) = self.margin_bottom {
189             properties.push(("margin-bottom", margin_bottom));
190         }
191         if let Some(ref margin_end) = self.margin_end {
192             properties.push(("margin-end", margin_end));
193         }
194         if let Some(ref margin_start) = self.margin_start {
195             properties.push(("margin-start", margin_start));
196         }
197         if let Some(ref margin_top) = self.margin_top {
198             properties.push(("margin-top", margin_top));
199         }
200         if let Some(ref name) = self.name {
201             properties.push(("name", name));
202         }
203         if let Some(ref no_show_all) = self.no_show_all {
204             properties.push(("no-show-all", no_show_all));
205         }
206         if let Some(ref opacity) = self.opacity {
207             properties.push(("opacity", opacity));
208         }
209         if let Some(ref parent) = self.parent {
210             properties.push(("parent", parent));
211         }
212         if let Some(ref receives_default) = self.receives_default {
213             properties.push(("receives-default", receives_default));
214         }
215         if let Some(ref sensitive) = self.sensitive {
216             properties.push(("sensitive", sensitive));
217         }
218         if let Some(ref tooltip_markup) = self.tooltip_markup {
219             properties.push(("tooltip-markup", tooltip_markup));
220         }
221         if let Some(ref tooltip_text) = self.tooltip_text {
222             properties.push(("tooltip-text", tooltip_text));
223         }
224         if let Some(ref valign) = self.valign {
225             properties.push(("valign", valign));
226         }
227         if let Some(ref vexpand) = self.vexpand {
228             properties.push(("vexpand", vexpand));
229         }
230         if let Some(ref vexpand_set) = self.vexpand_set {
231             properties.push(("vexpand-set", vexpand_set));
232         }
233         if let Some(ref visible) = self.visible {
234             properties.push(("visible", visible));
235         }
236         if let Some(ref width_request) = self.width_request {
237             properties.push(("width-request", width_request));
238         }
239         if let Some(ref orientation) = self.orientation {
240             properties.push(("orientation", orientation));
241         }
242         glib::Object::new::<Grid>(&properties).expect("Failed to create an instance of Grid")
243     }
244 
baseline_row(mut self, baseline_row: i32) -> Self245     pub fn baseline_row(mut self, baseline_row: i32) -> Self {
246         self.baseline_row = Some(baseline_row);
247         self
248     }
249 
column_homogeneous(mut self, column_homogeneous: bool) -> Self250     pub fn column_homogeneous(mut self, column_homogeneous: bool) -> Self {
251         self.column_homogeneous = Some(column_homogeneous);
252         self
253     }
254 
column_spacing(mut self, column_spacing: i32) -> Self255     pub fn column_spacing(mut self, column_spacing: i32) -> Self {
256         self.column_spacing = Some(column_spacing);
257         self
258     }
259 
row_homogeneous(mut self, row_homogeneous: bool) -> Self260     pub fn row_homogeneous(mut self, row_homogeneous: bool) -> Self {
261         self.row_homogeneous = Some(row_homogeneous);
262         self
263     }
264 
row_spacing(mut self, row_spacing: i32) -> Self265     pub fn row_spacing(mut self, row_spacing: i32) -> Self {
266         self.row_spacing = Some(row_spacing);
267         self
268     }
269 
border_width(mut self, border_width: u32) -> Self270     pub fn border_width(mut self, border_width: u32) -> Self {
271         self.border_width = Some(border_width);
272         self
273     }
274 
child<P: IsA<Widget>>(mut self, child: &P) -> Self275     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
276         self.child = Some(child.clone().upcast());
277         self
278     }
279 
resize_mode(mut self, resize_mode: ResizeMode) -> Self280     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
281         self.resize_mode = Some(resize_mode);
282         self
283     }
284 
app_paintable(mut self, app_paintable: bool) -> Self285     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
286         self.app_paintable = Some(app_paintable);
287         self
288     }
289 
can_default(mut self, can_default: bool) -> Self290     pub fn can_default(mut self, can_default: bool) -> Self {
291         self.can_default = Some(can_default);
292         self
293     }
294 
can_focus(mut self, can_focus: bool) -> Self295     pub fn can_focus(mut self, can_focus: bool) -> Self {
296         self.can_focus = Some(can_focus);
297         self
298     }
299 
events(mut self, events: gdk::EventMask) -> Self300     pub fn events(mut self, events: gdk::EventMask) -> Self {
301         self.events = Some(events);
302         self
303     }
304 
expand(mut self, expand: bool) -> Self305     pub fn expand(mut self, expand: bool) -> Self {
306         self.expand = Some(expand);
307         self
308     }
309 
310     #[cfg(any(feature = "v3_20", feature = "dox"))]
311     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self312     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
313         self.focus_on_click = Some(focus_on_click);
314         self
315     }
316 
halign(mut self, halign: Align) -> Self317     pub fn halign(mut self, halign: Align) -> Self {
318         self.halign = Some(halign);
319         self
320     }
321 
has_default(mut self, has_default: bool) -> Self322     pub fn has_default(mut self, has_default: bool) -> Self {
323         self.has_default = Some(has_default);
324         self
325     }
326 
has_focus(mut self, has_focus: bool) -> Self327     pub fn has_focus(mut self, has_focus: bool) -> Self {
328         self.has_focus = Some(has_focus);
329         self
330     }
331 
has_tooltip(mut self, has_tooltip: bool) -> Self332     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
333         self.has_tooltip = Some(has_tooltip);
334         self
335     }
336 
height_request(mut self, height_request: i32) -> Self337     pub fn height_request(mut self, height_request: i32) -> Self {
338         self.height_request = Some(height_request);
339         self
340     }
341 
hexpand(mut self, hexpand: bool) -> Self342     pub fn hexpand(mut self, hexpand: bool) -> Self {
343         self.hexpand = Some(hexpand);
344         self
345     }
346 
hexpand_set(mut self, hexpand_set: bool) -> Self347     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
348         self.hexpand_set = Some(hexpand_set);
349         self
350     }
351 
is_focus(mut self, is_focus: bool) -> Self352     pub fn is_focus(mut self, is_focus: bool) -> Self {
353         self.is_focus = Some(is_focus);
354         self
355     }
356 
margin(mut self, margin: i32) -> Self357     pub fn margin(mut self, margin: i32) -> Self {
358         self.margin = Some(margin);
359         self
360     }
361 
margin_bottom(mut self, margin_bottom: i32) -> Self362     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
363         self.margin_bottom = Some(margin_bottom);
364         self
365     }
366 
margin_end(mut self, margin_end: i32) -> Self367     pub fn margin_end(mut self, margin_end: i32) -> Self {
368         self.margin_end = Some(margin_end);
369         self
370     }
371 
margin_start(mut self, margin_start: i32) -> Self372     pub fn margin_start(mut self, margin_start: i32) -> Self {
373         self.margin_start = Some(margin_start);
374         self
375     }
376 
margin_top(mut self, margin_top: i32) -> Self377     pub fn margin_top(mut self, margin_top: i32) -> Self {
378         self.margin_top = Some(margin_top);
379         self
380     }
381 
name(mut self, name: &str) -> Self382     pub fn name(mut self, name: &str) -> Self {
383         self.name = Some(name.to_string());
384         self
385     }
386 
no_show_all(mut self, no_show_all: bool) -> Self387     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
388         self.no_show_all = Some(no_show_all);
389         self
390     }
391 
opacity(mut self, opacity: f64) -> Self392     pub fn opacity(mut self, opacity: f64) -> Self {
393         self.opacity = Some(opacity);
394         self
395     }
396 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self397     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
398         self.parent = Some(parent.clone().upcast());
399         self
400     }
401 
receives_default(mut self, receives_default: bool) -> Self402     pub fn receives_default(mut self, receives_default: bool) -> Self {
403         self.receives_default = Some(receives_default);
404         self
405     }
406 
sensitive(mut self, sensitive: bool) -> Self407     pub fn sensitive(mut self, sensitive: bool) -> Self {
408         self.sensitive = Some(sensitive);
409         self
410     }
411 
tooltip_markup(mut self, tooltip_markup: &str) -> Self412     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
413         self.tooltip_markup = Some(tooltip_markup.to_string());
414         self
415     }
416 
tooltip_text(mut self, tooltip_text: &str) -> Self417     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
418         self.tooltip_text = Some(tooltip_text.to_string());
419         self
420     }
421 
valign(mut self, valign: Align) -> Self422     pub fn valign(mut self, valign: Align) -> Self {
423         self.valign = Some(valign);
424         self
425     }
426 
vexpand(mut self, vexpand: bool) -> Self427     pub fn vexpand(mut self, vexpand: bool) -> Self {
428         self.vexpand = Some(vexpand);
429         self
430     }
431 
vexpand_set(mut self, vexpand_set: bool) -> Self432     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
433         self.vexpand_set = Some(vexpand_set);
434         self
435     }
436 
visible(mut self, visible: bool) -> Self437     pub fn visible(mut self, visible: bool) -> Self {
438         self.visible = Some(visible);
439         self
440     }
441 
width_request(mut self, width_request: i32) -> Self442     pub fn width_request(mut self, width_request: i32) -> Self {
443         self.width_request = Some(width_request);
444         self
445     }
446 
orientation(mut self, orientation: Orientation) -> Self447     pub fn orientation(mut self, orientation: Orientation) -> Self {
448         self.orientation = Some(orientation);
449         self
450     }
451 }
452 
453 pub const NONE_GRID: Option<&Grid> = None;
454 
455 pub trait GridExt: 'static {
456     #[doc(alias = "gtk_grid_attach")]
attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32)457     fn attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32);
458 
459     #[doc(alias = "gtk_grid_attach_next_to")]
attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>( &self, child: &P, sibling: Option<&Q>, side: PositionType, width: i32, height: i32, )460     fn attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>(
461         &self,
462         child: &P,
463         sibling: Option<&Q>,
464         side: PositionType,
465         width: i32,
466         height: i32,
467     );
468 
469     #[doc(alias = "gtk_grid_get_baseline_row")]
470     #[doc(alias = "get_baseline_row")]
baseline_row(&self) -> i32471     fn baseline_row(&self) -> i32;
472 
473     #[doc(alias = "gtk_grid_get_child_at")]
474     #[doc(alias = "get_child_at")]
child_at(&self, left: i32, top: i32) -> Option<Widget>475     fn child_at(&self, left: i32, top: i32) -> Option<Widget>;
476 
477     #[doc(alias = "gtk_grid_get_column_homogeneous")]
478     #[doc(alias = "get_column_homogeneous")]
is_column_homogeneous(&self) -> bool479     fn is_column_homogeneous(&self) -> bool;
480 
481     #[doc(alias = "gtk_grid_get_column_spacing")]
482     #[doc(alias = "get_column_spacing")]
column_spacing(&self) -> u32483     fn column_spacing(&self) -> u32;
484 
485     #[doc(alias = "gtk_grid_get_row_baseline_position")]
486     #[doc(alias = "get_row_baseline_position")]
row_baseline_position(&self, row: i32) -> BaselinePosition487     fn row_baseline_position(&self, row: i32) -> BaselinePosition;
488 
489     #[doc(alias = "gtk_grid_get_row_homogeneous")]
490     #[doc(alias = "get_row_homogeneous")]
is_row_homogeneous(&self) -> bool491     fn is_row_homogeneous(&self) -> bool;
492 
493     #[doc(alias = "gtk_grid_get_row_spacing")]
494     #[doc(alias = "get_row_spacing")]
row_spacing(&self) -> u32495     fn row_spacing(&self) -> u32;
496 
497     #[doc(alias = "gtk_grid_insert_column")]
insert_column(&self, position: i32)498     fn insert_column(&self, position: i32);
499 
500     #[doc(alias = "gtk_grid_insert_next_to")]
insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType)501     fn insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType);
502 
503     #[doc(alias = "gtk_grid_insert_row")]
insert_row(&self, position: i32)504     fn insert_row(&self, position: i32);
505 
506     #[doc(alias = "gtk_grid_remove_column")]
remove_column(&self, position: i32)507     fn remove_column(&self, position: i32);
508 
509     #[doc(alias = "gtk_grid_remove_row")]
remove_row(&self, position: i32)510     fn remove_row(&self, position: i32);
511 
512     #[doc(alias = "gtk_grid_set_baseline_row")]
set_baseline_row(&self, row: i32)513     fn set_baseline_row(&self, row: i32);
514 
515     #[doc(alias = "gtk_grid_set_column_homogeneous")]
set_column_homogeneous(&self, homogeneous: bool)516     fn set_column_homogeneous(&self, homogeneous: bool);
517 
518     #[doc(alias = "gtk_grid_set_column_spacing")]
set_column_spacing(&self, spacing: u32)519     fn set_column_spacing(&self, spacing: u32);
520 
521     #[doc(alias = "gtk_grid_set_row_baseline_position")]
set_row_baseline_position(&self, row: i32, pos: BaselinePosition)522     fn set_row_baseline_position(&self, row: i32, pos: BaselinePosition);
523 
524     #[doc(alias = "gtk_grid_set_row_homogeneous")]
set_row_homogeneous(&self, homogeneous: bool)525     fn set_row_homogeneous(&self, homogeneous: bool);
526 
527     #[doc(alias = "gtk_grid_set_row_spacing")]
set_row_spacing(&self, spacing: u32)528     fn set_row_spacing(&self, spacing: u32);
529 
cell_height<T: IsA<Widget>>(&self, item: &T) -> i32530     fn cell_height<T: IsA<Widget>>(&self, item: &T) -> i32;
531 
set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32)532     fn set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32);
533 
cell_width<T: IsA<Widget>>(&self, item: &T) -> i32534     fn cell_width<T: IsA<Widget>>(&self, item: &T) -> i32;
535 
set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32)536     fn set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32);
537 
538     #[doc(alias = "cell.left-attach")]
cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32539     fn cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32;
540 
541     #[doc(alias = "cell.left-attach")]
set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32)542     fn set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32);
543 
544     #[doc(alias = "cell.top-attach")]
cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32545     fn cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32;
546 
547     #[doc(alias = "cell.top-attach")]
set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32)548     fn set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32);
549 
550     #[doc(alias = "baseline-row")]
connect_baseline_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId551     fn connect_baseline_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
552 
553     #[doc(alias = "column-homogeneous")]
connect_column_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId554     fn connect_column_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
555 
556     #[doc(alias = "column-spacing")]
connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId557     fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
558 
559     #[doc(alias = "row-homogeneous")]
connect_row_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId560     fn connect_row_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
561 
562     #[doc(alias = "row-spacing")]
connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId563     fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
564 }
565 
566 impl<O: IsA<Grid>> GridExt for O {
attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32)567     fn attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32) {
568         unsafe {
569             ffi::gtk_grid_attach(
570                 self.as_ref().to_glib_none().0,
571                 child.as_ref().to_glib_none().0,
572                 left,
573                 top,
574                 width,
575                 height,
576             );
577         }
578     }
579 
attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>( &self, child: &P, sibling: Option<&Q>, side: PositionType, width: i32, height: i32, )580     fn attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>(
581         &self,
582         child: &P,
583         sibling: Option<&Q>,
584         side: PositionType,
585         width: i32,
586         height: i32,
587     ) {
588         unsafe {
589             ffi::gtk_grid_attach_next_to(
590                 self.as_ref().to_glib_none().0,
591                 child.as_ref().to_glib_none().0,
592                 sibling.map(|p| p.as_ref()).to_glib_none().0,
593                 side.into_glib(),
594                 width,
595                 height,
596             );
597         }
598     }
599 
baseline_row(&self) -> i32600     fn baseline_row(&self) -> i32 {
601         unsafe { ffi::gtk_grid_get_baseline_row(self.as_ref().to_glib_none().0) }
602     }
603 
child_at(&self, left: i32, top: i32) -> Option<Widget>604     fn child_at(&self, left: i32, top: i32) -> Option<Widget> {
605         unsafe {
606             from_glib_none(ffi::gtk_grid_get_child_at(
607                 self.as_ref().to_glib_none().0,
608                 left,
609                 top,
610             ))
611         }
612     }
613 
is_column_homogeneous(&self) -> bool614     fn is_column_homogeneous(&self) -> bool {
615         unsafe {
616             from_glib(ffi::gtk_grid_get_column_homogeneous(
617                 self.as_ref().to_glib_none().0,
618             ))
619         }
620     }
621 
column_spacing(&self) -> u32622     fn column_spacing(&self) -> u32 {
623         unsafe { ffi::gtk_grid_get_column_spacing(self.as_ref().to_glib_none().0) }
624     }
625 
row_baseline_position(&self, row: i32) -> BaselinePosition626     fn row_baseline_position(&self, row: i32) -> BaselinePosition {
627         unsafe {
628             from_glib(ffi::gtk_grid_get_row_baseline_position(
629                 self.as_ref().to_glib_none().0,
630                 row,
631             ))
632         }
633     }
634 
is_row_homogeneous(&self) -> bool635     fn is_row_homogeneous(&self) -> bool {
636         unsafe {
637             from_glib(ffi::gtk_grid_get_row_homogeneous(
638                 self.as_ref().to_glib_none().0,
639             ))
640         }
641     }
642 
row_spacing(&self) -> u32643     fn row_spacing(&self) -> u32 {
644         unsafe { ffi::gtk_grid_get_row_spacing(self.as_ref().to_glib_none().0) }
645     }
646 
insert_column(&self, position: i32)647     fn insert_column(&self, position: i32) {
648         unsafe {
649             ffi::gtk_grid_insert_column(self.as_ref().to_glib_none().0, position);
650         }
651     }
652 
insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType)653     fn insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType) {
654         unsafe {
655             ffi::gtk_grid_insert_next_to(
656                 self.as_ref().to_glib_none().0,
657                 sibling.as_ref().to_glib_none().0,
658                 side.into_glib(),
659             );
660         }
661     }
662 
insert_row(&self, position: i32)663     fn insert_row(&self, position: i32) {
664         unsafe {
665             ffi::gtk_grid_insert_row(self.as_ref().to_glib_none().0, position);
666         }
667     }
668 
remove_column(&self, position: i32)669     fn remove_column(&self, position: i32) {
670         unsafe {
671             ffi::gtk_grid_remove_column(self.as_ref().to_glib_none().0, position);
672         }
673     }
674 
remove_row(&self, position: i32)675     fn remove_row(&self, position: i32) {
676         unsafe {
677             ffi::gtk_grid_remove_row(self.as_ref().to_glib_none().0, position);
678         }
679     }
680 
set_baseline_row(&self, row: i32)681     fn set_baseline_row(&self, row: i32) {
682         unsafe {
683             ffi::gtk_grid_set_baseline_row(self.as_ref().to_glib_none().0, row);
684         }
685     }
686 
set_column_homogeneous(&self, homogeneous: bool)687     fn set_column_homogeneous(&self, homogeneous: bool) {
688         unsafe {
689             ffi::gtk_grid_set_column_homogeneous(
690                 self.as_ref().to_glib_none().0,
691                 homogeneous.into_glib(),
692             );
693         }
694     }
695 
set_column_spacing(&self, spacing: u32)696     fn set_column_spacing(&self, spacing: u32) {
697         unsafe {
698             ffi::gtk_grid_set_column_spacing(self.as_ref().to_glib_none().0, spacing);
699         }
700     }
701 
set_row_baseline_position(&self, row: i32, pos: BaselinePosition)702     fn set_row_baseline_position(&self, row: i32, pos: BaselinePosition) {
703         unsafe {
704             ffi::gtk_grid_set_row_baseline_position(
705                 self.as_ref().to_glib_none().0,
706                 row,
707                 pos.into_glib(),
708             );
709         }
710     }
711 
set_row_homogeneous(&self, homogeneous: bool)712     fn set_row_homogeneous(&self, homogeneous: bool) {
713         unsafe {
714             ffi::gtk_grid_set_row_homogeneous(
715                 self.as_ref().to_glib_none().0,
716                 homogeneous.into_glib(),
717             );
718         }
719     }
720 
set_row_spacing(&self, spacing: u32)721     fn set_row_spacing(&self, spacing: u32) {
722         unsafe {
723             ffi::gtk_grid_set_row_spacing(self.as_ref().to_glib_none().0, spacing);
724         }
725     }
726 
cell_height<T: IsA<Widget>>(&self, item: &T) -> i32727     fn cell_height<T: IsA<Widget>>(&self, item: &T) -> i32 {
728         unsafe {
729             let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
730             crate::ffi::gtk_container_child_get_property(
731                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
732                 item.to_glib_none().0 as *mut _,
733                 b"height\0".as_ptr() as *const _,
734                 value.to_glib_none_mut().0,
735             );
736             value
737                 .get()
738                 .expect("Return Value for property `height` getter")
739         }
740     }
741 
set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32)742     fn set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32) {
743         unsafe {
744             crate::ffi::gtk_container_child_set_property(
745                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
746                 item.to_glib_none().0 as *mut _,
747                 b"height\0".as_ptr() as *const _,
748                 height.to_value().to_glib_none().0,
749             );
750         }
751     }
752 
cell_width<T: IsA<Widget>>(&self, item: &T) -> i32753     fn cell_width<T: IsA<Widget>>(&self, item: &T) -> i32 {
754         unsafe {
755             let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
756             crate::ffi::gtk_container_child_get_property(
757                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
758                 item.to_glib_none().0 as *mut _,
759                 b"width\0".as_ptr() as *const _,
760                 value.to_glib_none_mut().0,
761             );
762             value
763                 .get()
764                 .expect("Return Value for property `width` getter")
765         }
766     }
767 
set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32)768     fn set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32) {
769         unsafe {
770             crate::ffi::gtk_container_child_set_property(
771                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
772                 item.to_glib_none().0 as *mut _,
773                 b"width\0".as_ptr() as *const _,
774                 width.to_value().to_glib_none().0,
775             );
776         }
777     }
778 
cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32779     fn cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32 {
780         unsafe {
781             let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
782             crate::ffi::gtk_container_child_get_property(
783                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
784                 item.to_glib_none().0 as *mut _,
785                 b"left-attach\0".as_ptr() as *const _,
786                 value.to_glib_none_mut().0,
787             );
788             value
789                 .get()
790                 .expect("Return Value for property `left-attach` getter")
791         }
792     }
793 
set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32)794     fn set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32) {
795         unsafe {
796             crate::ffi::gtk_container_child_set_property(
797                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
798                 item.to_glib_none().0 as *mut _,
799                 b"left-attach\0".as_ptr() as *const _,
800                 left_attach.to_value().to_glib_none().0,
801             );
802         }
803     }
804 
cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32805     fn cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32 {
806         unsafe {
807             let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
808             crate::ffi::gtk_container_child_get_property(
809                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
810                 item.to_glib_none().0 as *mut _,
811                 b"top-attach\0".as_ptr() as *const _,
812                 value.to_glib_none_mut().0,
813             );
814             value
815                 .get()
816                 .expect("Return Value for property `top-attach` getter")
817         }
818     }
819 
set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32)820     fn set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32) {
821         unsafe {
822             crate::ffi::gtk_container_child_set_property(
823                 self.to_glib_none().0 as *mut crate::ffi::GtkContainer,
824                 item.to_glib_none().0 as *mut _,
825                 b"top-attach\0".as_ptr() as *const _,
826                 top_attach.to_value().to_glib_none().0,
827             );
828         }
829     }
830 
connect_baseline_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId831     fn connect_baseline_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
832         unsafe extern "C" fn notify_baseline_row_trampoline<P: IsA<Grid>, F: Fn(&P) + 'static>(
833             this: *mut ffi::GtkGrid,
834             _param_spec: glib::ffi::gpointer,
835             f: glib::ffi::gpointer,
836         ) {
837             let f: &F = &*(f as *const F);
838             f(Grid::from_glib_borrow(this).unsafe_cast_ref())
839         }
840         unsafe {
841             let f: Box_<F> = Box_::new(f);
842             connect_raw(
843                 self.as_ptr() as *mut _,
844                 b"notify::baseline-row\0".as_ptr() as *const _,
845                 Some(transmute::<_, unsafe extern "C" fn()>(
846                     notify_baseline_row_trampoline::<Self, F> as *const (),
847                 )),
848                 Box_::into_raw(f),
849             )
850         }
851     }
852 
connect_column_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId853     fn connect_column_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
854         unsafe extern "C" fn notify_column_homogeneous_trampoline<
855             P: IsA<Grid>,
856             F: Fn(&P) + 'static,
857         >(
858             this: *mut ffi::GtkGrid,
859             _param_spec: glib::ffi::gpointer,
860             f: glib::ffi::gpointer,
861         ) {
862             let f: &F = &*(f as *const F);
863             f(Grid::from_glib_borrow(this).unsafe_cast_ref())
864         }
865         unsafe {
866             let f: Box_<F> = Box_::new(f);
867             connect_raw(
868                 self.as_ptr() as *mut _,
869                 b"notify::column-homogeneous\0".as_ptr() as *const _,
870                 Some(transmute::<_, unsafe extern "C" fn()>(
871                     notify_column_homogeneous_trampoline::<Self, F> as *const (),
872                 )),
873                 Box_::into_raw(f),
874             )
875         }
876     }
877 
connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId878     fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
879         unsafe extern "C" fn notify_column_spacing_trampoline<P: IsA<Grid>, F: Fn(&P) + 'static>(
880             this: *mut ffi::GtkGrid,
881             _param_spec: glib::ffi::gpointer,
882             f: glib::ffi::gpointer,
883         ) {
884             let f: &F = &*(f as *const F);
885             f(Grid::from_glib_borrow(this).unsafe_cast_ref())
886         }
887         unsafe {
888             let f: Box_<F> = Box_::new(f);
889             connect_raw(
890                 self.as_ptr() as *mut _,
891                 b"notify::column-spacing\0".as_ptr() as *const _,
892                 Some(transmute::<_, unsafe extern "C" fn()>(
893                     notify_column_spacing_trampoline::<Self, F> as *const (),
894                 )),
895                 Box_::into_raw(f),
896             )
897         }
898     }
899 
connect_row_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId900     fn connect_row_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
901         unsafe extern "C" fn notify_row_homogeneous_trampoline<
902             P: IsA<Grid>,
903             F: Fn(&P) + 'static,
904         >(
905             this: *mut ffi::GtkGrid,
906             _param_spec: glib::ffi::gpointer,
907             f: glib::ffi::gpointer,
908         ) {
909             let f: &F = &*(f as *const F);
910             f(Grid::from_glib_borrow(this).unsafe_cast_ref())
911         }
912         unsafe {
913             let f: Box_<F> = Box_::new(f);
914             connect_raw(
915                 self.as_ptr() as *mut _,
916                 b"notify::row-homogeneous\0".as_ptr() as *const _,
917                 Some(transmute::<_, unsafe extern "C" fn()>(
918                     notify_row_homogeneous_trampoline::<Self, F> as *const (),
919                 )),
920                 Box_::into_raw(f),
921             )
922         }
923     }
924 
connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId925     fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
926         unsafe extern "C" fn notify_row_spacing_trampoline<P: IsA<Grid>, F: Fn(&P) + 'static>(
927             this: *mut ffi::GtkGrid,
928             _param_spec: glib::ffi::gpointer,
929             f: glib::ffi::gpointer,
930         ) {
931             let f: &F = &*(f as *const F);
932             f(Grid::from_glib_borrow(this).unsafe_cast_ref())
933         }
934         unsafe {
935             let f: Box_<F> = Box_::new(f);
936             connect_raw(
937                 self.as_ptr() as *mut _,
938                 b"notify::row-spacing\0".as_ptr() as *const _,
939                 Some(transmute::<_, unsafe extern "C" fn()>(
940                     notify_row_spacing_trampoline::<Self, F> as *const (),
941                 )),
942                 Box_::into_raw(f),
943             )
944         }
945     }
946 }
947 
948 impl fmt::Display for Grid {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result949     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
950         f.write_str("Grid")
951     }
952 }
953