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::Container;
8 use crate::Orientable;
9 use crate::Orientation;
10 use crate::Widget;
11 use glib::object::Cast;
12 use glib::object::IsA;
13 use glib::translate::*;
14 use glib::StaticType;
15 use glib::ToValue;
16 use std::fmt;
17 
18 glib::wrapper! {
19     #[doc(alias = "GtkSeparator")]
20     pub struct Separator(Object<ffi::GtkSeparator, ffi::GtkSeparatorClass>) @extends Widget, @implements Buildable, Orientable;
21 
22     match fn {
23         type_ => || ffi::gtk_separator_get_type(),
24     }
25 }
26 
27 impl Separator {
28     #[doc(alias = "gtk_separator_new")]
new(orientation: Orientation) -> Separator29     pub fn new(orientation: Orientation) -> Separator {
30         assert_initialized_main_thread!();
31         unsafe {
32             Widget::from_glib_none(ffi::gtk_separator_new(orientation.into_glib())).unsafe_cast()
33         }
34     }
35 
36     // rustdoc-stripper-ignore-next
37     /// Creates a new builder-pattern struct instance to construct [`Separator`] objects.
38     ///
39     /// This method returns an instance of [`SeparatorBuilder`] which can be used to create [`Separator`] objects.
builder() -> SeparatorBuilder40     pub fn builder() -> SeparatorBuilder {
41         SeparatorBuilder::default()
42     }
43 }
44 
45 #[derive(Clone, Default)]
46 // rustdoc-stripper-ignore-next
47 /// A [builder-pattern] type to construct [`Separator`] objects.
48 ///
49 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
50 pub struct SeparatorBuilder {
51     app_paintable: Option<bool>,
52     can_default: Option<bool>,
53     can_focus: Option<bool>,
54     events: Option<gdk::EventMask>,
55     expand: Option<bool>,
56     #[cfg(any(feature = "v3_20", feature = "dox"))]
57     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
58     focus_on_click: Option<bool>,
59     halign: Option<Align>,
60     has_default: Option<bool>,
61     has_focus: Option<bool>,
62     has_tooltip: Option<bool>,
63     height_request: Option<i32>,
64     hexpand: Option<bool>,
65     hexpand_set: Option<bool>,
66     is_focus: Option<bool>,
67     margin: Option<i32>,
68     margin_bottom: Option<i32>,
69     margin_end: Option<i32>,
70     margin_start: Option<i32>,
71     margin_top: Option<i32>,
72     name: Option<String>,
73     no_show_all: Option<bool>,
74     opacity: Option<f64>,
75     parent: Option<Container>,
76     receives_default: Option<bool>,
77     sensitive: Option<bool>,
78     tooltip_markup: Option<String>,
79     tooltip_text: Option<String>,
80     valign: Option<Align>,
81     vexpand: Option<bool>,
82     vexpand_set: Option<bool>,
83     visible: Option<bool>,
84     width_request: Option<i32>,
85     orientation: Option<Orientation>,
86 }
87 
88 impl SeparatorBuilder {
89     // rustdoc-stripper-ignore-next
90     /// Create a new [`SeparatorBuilder`].
new() -> Self91     pub fn new() -> Self {
92         Self::default()
93     }
94 
95     // rustdoc-stripper-ignore-next
96     /// Build the [`Separator`].
build(self) -> Separator97     pub fn build(self) -> Separator {
98         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
99         if let Some(ref app_paintable) = self.app_paintable {
100             properties.push(("app-paintable", app_paintable));
101         }
102         if let Some(ref can_default) = self.can_default {
103             properties.push(("can-default", can_default));
104         }
105         if let Some(ref can_focus) = self.can_focus {
106             properties.push(("can-focus", can_focus));
107         }
108         if let Some(ref events) = self.events {
109             properties.push(("events", events));
110         }
111         if let Some(ref expand) = self.expand {
112             properties.push(("expand", expand));
113         }
114         #[cfg(any(feature = "v3_20", feature = "dox"))]
115         if let Some(ref focus_on_click) = self.focus_on_click {
116             properties.push(("focus-on-click", focus_on_click));
117         }
118         if let Some(ref halign) = self.halign {
119             properties.push(("halign", halign));
120         }
121         if let Some(ref has_default) = self.has_default {
122             properties.push(("has-default", has_default));
123         }
124         if let Some(ref has_focus) = self.has_focus {
125             properties.push(("has-focus", has_focus));
126         }
127         if let Some(ref has_tooltip) = self.has_tooltip {
128             properties.push(("has-tooltip", has_tooltip));
129         }
130         if let Some(ref height_request) = self.height_request {
131             properties.push(("height-request", height_request));
132         }
133         if let Some(ref hexpand) = self.hexpand {
134             properties.push(("hexpand", hexpand));
135         }
136         if let Some(ref hexpand_set) = self.hexpand_set {
137             properties.push(("hexpand-set", hexpand_set));
138         }
139         if let Some(ref is_focus) = self.is_focus {
140             properties.push(("is-focus", is_focus));
141         }
142         if let Some(ref margin) = self.margin {
143             properties.push(("margin", margin));
144         }
145         if let Some(ref margin_bottom) = self.margin_bottom {
146             properties.push(("margin-bottom", margin_bottom));
147         }
148         if let Some(ref margin_end) = self.margin_end {
149             properties.push(("margin-end", margin_end));
150         }
151         if let Some(ref margin_start) = self.margin_start {
152             properties.push(("margin-start", margin_start));
153         }
154         if let Some(ref margin_top) = self.margin_top {
155             properties.push(("margin-top", margin_top));
156         }
157         if let Some(ref name) = self.name {
158             properties.push(("name", name));
159         }
160         if let Some(ref no_show_all) = self.no_show_all {
161             properties.push(("no-show-all", no_show_all));
162         }
163         if let Some(ref opacity) = self.opacity {
164             properties.push(("opacity", opacity));
165         }
166         if let Some(ref parent) = self.parent {
167             properties.push(("parent", parent));
168         }
169         if let Some(ref receives_default) = self.receives_default {
170             properties.push(("receives-default", receives_default));
171         }
172         if let Some(ref sensitive) = self.sensitive {
173             properties.push(("sensitive", sensitive));
174         }
175         if let Some(ref tooltip_markup) = self.tooltip_markup {
176             properties.push(("tooltip-markup", tooltip_markup));
177         }
178         if let Some(ref tooltip_text) = self.tooltip_text {
179             properties.push(("tooltip-text", tooltip_text));
180         }
181         if let Some(ref valign) = self.valign {
182             properties.push(("valign", valign));
183         }
184         if let Some(ref vexpand) = self.vexpand {
185             properties.push(("vexpand", vexpand));
186         }
187         if let Some(ref vexpand_set) = self.vexpand_set {
188             properties.push(("vexpand-set", vexpand_set));
189         }
190         if let Some(ref visible) = self.visible {
191             properties.push(("visible", visible));
192         }
193         if let Some(ref width_request) = self.width_request {
194             properties.push(("width-request", width_request));
195         }
196         if let Some(ref orientation) = self.orientation {
197             properties.push(("orientation", orientation));
198         }
199         glib::Object::new::<Separator>(&properties)
200             .expect("Failed to create an instance of Separator")
201     }
202 
app_paintable(mut self, app_paintable: bool) -> Self203     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
204         self.app_paintable = Some(app_paintable);
205         self
206     }
207 
can_default(mut self, can_default: bool) -> Self208     pub fn can_default(mut self, can_default: bool) -> Self {
209         self.can_default = Some(can_default);
210         self
211     }
212 
can_focus(mut self, can_focus: bool) -> Self213     pub fn can_focus(mut self, can_focus: bool) -> Self {
214         self.can_focus = Some(can_focus);
215         self
216     }
217 
events(mut self, events: gdk::EventMask) -> Self218     pub fn events(mut self, events: gdk::EventMask) -> Self {
219         self.events = Some(events);
220         self
221     }
222 
expand(mut self, expand: bool) -> Self223     pub fn expand(mut self, expand: bool) -> Self {
224         self.expand = Some(expand);
225         self
226     }
227 
228     #[cfg(any(feature = "v3_20", feature = "dox"))]
229     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self230     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
231         self.focus_on_click = Some(focus_on_click);
232         self
233     }
234 
halign(mut self, halign: Align) -> Self235     pub fn halign(mut self, halign: Align) -> Self {
236         self.halign = Some(halign);
237         self
238     }
239 
has_default(mut self, has_default: bool) -> Self240     pub fn has_default(mut self, has_default: bool) -> Self {
241         self.has_default = Some(has_default);
242         self
243     }
244 
has_focus(mut self, has_focus: bool) -> Self245     pub fn has_focus(mut self, has_focus: bool) -> Self {
246         self.has_focus = Some(has_focus);
247         self
248     }
249 
has_tooltip(mut self, has_tooltip: bool) -> Self250     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
251         self.has_tooltip = Some(has_tooltip);
252         self
253     }
254 
height_request(mut self, height_request: i32) -> Self255     pub fn height_request(mut self, height_request: i32) -> Self {
256         self.height_request = Some(height_request);
257         self
258     }
259 
hexpand(mut self, hexpand: bool) -> Self260     pub fn hexpand(mut self, hexpand: bool) -> Self {
261         self.hexpand = Some(hexpand);
262         self
263     }
264 
hexpand_set(mut self, hexpand_set: bool) -> Self265     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
266         self.hexpand_set = Some(hexpand_set);
267         self
268     }
269 
is_focus(mut self, is_focus: bool) -> Self270     pub fn is_focus(mut self, is_focus: bool) -> Self {
271         self.is_focus = Some(is_focus);
272         self
273     }
274 
margin(mut self, margin: i32) -> Self275     pub fn margin(mut self, margin: i32) -> Self {
276         self.margin = Some(margin);
277         self
278     }
279 
margin_bottom(mut self, margin_bottom: i32) -> Self280     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
281         self.margin_bottom = Some(margin_bottom);
282         self
283     }
284 
margin_end(mut self, margin_end: i32) -> Self285     pub fn margin_end(mut self, margin_end: i32) -> Self {
286         self.margin_end = Some(margin_end);
287         self
288     }
289 
margin_start(mut self, margin_start: i32) -> Self290     pub fn margin_start(mut self, margin_start: i32) -> Self {
291         self.margin_start = Some(margin_start);
292         self
293     }
294 
margin_top(mut self, margin_top: i32) -> Self295     pub fn margin_top(mut self, margin_top: i32) -> Self {
296         self.margin_top = Some(margin_top);
297         self
298     }
299 
name(mut self, name: &str) -> Self300     pub fn name(mut self, name: &str) -> Self {
301         self.name = Some(name.to_string());
302         self
303     }
304 
no_show_all(mut self, no_show_all: bool) -> Self305     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
306         self.no_show_all = Some(no_show_all);
307         self
308     }
309 
opacity(mut self, opacity: f64) -> Self310     pub fn opacity(mut self, opacity: f64) -> Self {
311         self.opacity = Some(opacity);
312         self
313     }
314 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self315     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
316         self.parent = Some(parent.clone().upcast());
317         self
318     }
319 
receives_default(mut self, receives_default: bool) -> Self320     pub fn receives_default(mut self, receives_default: bool) -> Self {
321         self.receives_default = Some(receives_default);
322         self
323     }
324 
sensitive(mut self, sensitive: bool) -> Self325     pub fn sensitive(mut self, sensitive: bool) -> Self {
326         self.sensitive = Some(sensitive);
327         self
328     }
329 
tooltip_markup(mut self, tooltip_markup: &str) -> Self330     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
331         self.tooltip_markup = Some(tooltip_markup.to_string());
332         self
333     }
334 
tooltip_text(mut self, tooltip_text: &str) -> Self335     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
336         self.tooltip_text = Some(tooltip_text.to_string());
337         self
338     }
339 
valign(mut self, valign: Align) -> Self340     pub fn valign(mut self, valign: Align) -> Self {
341         self.valign = Some(valign);
342         self
343     }
344 
vexpand(mut self, vexpand: bool) -> Self345     pub fn vexpand(mut self, vexpand: bool) -> Self {
346         self.vexpand = Some(vexpand);
347         self
348     }
349 
vexpand_set(mut self, vexpand_set: bool) -> Self350     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
351         self.vexpand_set = Some(vexpand_set);
352         self
353     }
354 
visible(mut self, visible: bool) -> Self355     pub fn visible(mut self, visible: bool) -> Self {
356         self.visible = Some(visible);
357         self
358     }
359 
width_request(mut self, width_request: i32) -> Self360     pub fn width_request(mut self, width_request: i32) -> Self {
361         self.width_request = Some(width_request);
362         self
363     }
364 
orientation(mut self, orientation: Orientation) -> Self365     pub fn orientation(mut self, orientation: Orientation) -> Self {
366         self.orientation = Some(orientation);
367         self
368     }
369 }
370 
371 pub const NONE_SEPARATOR: Option<&Separator> = None;
372 
373 impl fmt::Display for Separator {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result374     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
375         f.write_str("Separator")
376     }
377 }
378