1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use crate::LayoutChild;
use crate::LayoutManager;
use crate::Widget;
use glib::object::Cast;
use glib::object::IsA;
use glib::StaticType;
use glib::ToValue;
use std::fmt;
glib::wrapper! {
#[doc(alias = "GtkConstraintLayoutChild")]
pub struct ConstraintLayoutChild(Object<ffi::GtkConstraintLayoutChild, ffi::GtkConstraintLayoutChildClass>) @extends LayoutChild;
match fn {
type_ => || ffi::gtk_constraint_layout_child_get_type(),
}
}
impl ConstraintLayoutChild {
pub fn builder() -> ConstraintLayoutChildBuilder {
ConstraintLayoutChildBuilder::default()
}
}
#[derive(Clone, Default)]
pub struct ConstraintLayoutChildBuilder {
child_widget: Option<Widget>,
layout_manager: Option<LayoutManager>,
}
impl ConstraintLayoutChildBuilder {
pub fn new() -> Self {
Self::default()
}
pub fn build(self) -> ConstraintLayoutChild {
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
if let Some(ref child_widget) = self.child_widget {
properties.push(("child-widget", child_widget));
}
if let Some(ref layout_manager) = self.layout_manager {
properties.push(("layout-manager", layout_manager));
}
glib::Object::new::<ConstraintLayoutChild>(&properties)
.expect("Failed to create an instance of ConstraintLayoutChild")
}
pub fn child_widget<P: IsA<Widget>>(mut self, child_widget: &P) -> Self {
self.child_widget = Some(child_widget.clone().upcast());
self
}
pub fn layout_manager<P: IsA<LayoutManager>>(mut self, layout_manager: &P) -> Self {
self.layout_manager = Some(layout_manager.clone().upcast());
self
}
}
impl fmt::Display for ConstraintLayoutChild {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("ConstraintLayoutChild")
}
}