gtk/auto/
separator.rs

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
5use gdk;
6use glib::object::Cast;
7use glib::translate::*;
8use glib::StaticType;
9use glib::ToValue;
10use gtk_sys;
11use std::fmt;
12use Align;
13use Buildable;
14use Container;
15use Orientable;
16use Orientation;
17use Widget;
18
19glib_wrapper! {
20    pub struct Separator(Object<gtk_sys::GtkSeparator, gtk_sys::GtkSeparatorClass, SeparatorClass>) @extends Widget, @implements Buildable, Orientable;
21
22    match fn {
23        get_type => || gtk_sys::gtk_separator_get_type(),
24    }
25}
26
27impl Separator {
28    pub fn new(orientation: Orientation) -> Separator {
29        assert_initialized_main_thread!();
30        unsafe {
31            Widget::from_glib_none(gtk_sys::gtk_separator_new(orientation.to_glib())).unsafe_cast()
32        }
33    }
34}
35
36pub struct SeparatorBuilder {
37    app_paintable: Option<bool>,
38    can_default: Option<bool>,
39    can_focus: Option<bool>,
40    events: Option<gdk::EventMask>,
41    expand: Option<bool>,
42    #[cfg(any(feature = "v3_20", feature = "dox"))]
43    focus_on_click: Option<bool>,
44    halign: Option<Align>,
45    has_default: Option<bool>,
46    has_focus: Option<bool>,
47    has_tooltip: Option<bool>,
48    height_request: Option<i32>,
49    hexpand: Option<bool>,
50    hexpand_set: Option<bool>,
51    is_focus: Option<bool>,
52    margin: Option<i32>,
53    margin_bottom: Option<i32>,
54    margin_end: Option<i32>,
55    margin_start: Option<i32>,
56    margin_top: Option<i32>,
57    name: Option<String>,
58    no_show_all: Option<bool>,
59    opacity: Option<f64>,
60    parent: Option<Container>,
61    receives_default: Option<bool>,
62    sensitive: Option<bool>,
63    //style: /*Unknown type*/,
64    tooltip_markup: Option<String>,
65    tooltip_text: Option<String>,
66    valign: Option<Align>,
67    vexpand: Option<bool>,
68    vexpand_set: Option<bool>,
69    visible: Option<bool>,
70    width_request: Option<i32>,
71}
72
73impl SeparatorBuilder {
74    pub fn new() -> Self {
75        Self {
76            app_paintable: None,
77            can_default: None,
78            can_focus: None,
79            events: None,
80            expand: None,
81            #[cfg(any(feature = "v3_20", feature = "dox"))]
82            focus_on_click: None,
83            halign: None,
84            has_default: None,
85            has_focus: None,
86            has_tooltip: None,
87            height_request: None,
88            hexpand: None,
89            hexpand_set: None,
90            is_focus: None,
91            margin: None,
92            margin_bottom: None,
93            margin_end: None,
94            margin_start: None,
95            margin_top: None,
96            name: None,
97            no_show_all: None,
98            opacity: None,
99            parent: None,
100            receives_default: None,
101            sensitive: None,
102            tooltip_markup: None,
103            tooltip_text: None,
104            valign: None,
105            vexpand: None,
106            vexpand_set: None,
107            visible: None,
108            width_request: None,
109        }
110    }
111
112    pub fn build(self) -> Separator {
113        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
114        if let Some(ref app_paintable) = self.app_paintable {
115            properties.push(("app-paintable", app_paintable));
116        }
117        if let Some(ref can_default) = self.can_default {
118            properties.push(("can-default", can_default));
119        }
120        if let Some(ref can_focus) = self.can_focus {
121            properties.push(("can-focus", can_focus));
122        }
123        if let Some(ref events) = self.events {
124            properties.push(("events", events));
125        }
126        if let Some(ref expand) = self.expand {
127            properties.push(("expand", expand));
128        }
129        #[cfg(any(feature = "v3_20", feature = "dox"))]
130        {
131            if let Some(ref focus_on_click) = self.focus_on_click {
132                properties.push(("focus-on-click", focus_on_click));
133            }
134        }
135        if let Some(ref halign) = self.halign {
136            properties.push(("halign", halign));
137        }
138        if let Some(ref has_default) = self.has_default {
139            properties.push(("has-default", has_default));
140        }
141        if let Some(ref has_focus) = self.has_focus {
142            properties.push(("has-focus", has_focus));
143        }
144        if let Some(ref has_tooltip) = self.has_tooltip {
145            properties.push(("has-tooltip", has_tooltip));
146        }
147        if let Some(ref height_request) = self.height_request {
148            properties.push(("height-request", height_request));
149        }
150        if let Some(ref hexpand) = self.hexpand {
151            properties.push(("hexpand", hexpand));
152        }
153        if let Some(ref hexpand_set) = self.hexpand_set {
154            properties.push(("hexpand-set", hexpand_set));
155        }
156        if let Some(ref is_focus) = self.is_focus {
157            properties.push(("is-focus", is_focus));
158        }
159        if let Some(ref margin) = self.margin {
160            properties.push(("margin", margin));
161        }
162        if let Some(ref margin_bottom) = self.margin_bottom {
163            properties.push(("margin-bottom", margin_bottom));
164        }
165        if let Some(ref margin_end) = self.margin_end {
166            properties.push(("margin-end", margin_end));
167        }
168        if let Some(ref margin_start) = self.margin_start {
169            properties.push(("margin-start", margin_start));
170        }
171        if let Some(ref margin_top) = self.margin_top {
172            properties.push(("margin-top", margin_top));
173        }
174        if let Some(ref name) = self.name {
175            properties.push(("name", name));
176        }
177        if let Some(ref no_show_all) = self.no_show_all {
178            properties.push(("no-show-all", no_show_all));
179        }
180        if let Some(ref opacity) = self.opacity {
181            properties.push(("opacity", opacity));
182        }
183        if let Some(ref parent) = self.parent {
184            properties.push(("parent", parent));
185        }
186        if let Some(ref receives_default) = self.receives_default {
187            properties.push(("receives-default", receives_default));
188        }
189        if let Some(ref sensitive) = self.sensitive {
190            properties.push(("sensitive", sensitive));
191        }
192        if let Some(ref tooltip_markup) = self.tooltip_markup {
193            properties.push(("tooltip-markup", tooltip_markup));
194        }
195        if let Some(ref tooltip_text) = self.tooltip_text {
196            properties.push(("tooltip-text", tooltip_text));
197        }
198        if let Some(ref valign) = self.valign {
199            properties.push(("valign", valign));
200        }
201        if let Some(ref vexpand) = self.vexpand {
202            properties.push(("vexpand", vexpand));
203        }
204        if let Some(ref vexpand_set) = self.vexpand_set {
205            properties.push(("vexpand-set", vexpand_set));
206        }
207        if let Some(ref visible) = self.visible {
208            properties.push(("visible", visible));
209        }
210        if let Some(ref width_request) = self.width_request {
211            properties.push(("width-request", width_request));
212        }
213        glib::Object::new(Separator::static_type(), &properties)
214            .expect("object new")
215            .downcast()
216            .expect("downcast")
217    }
218
219    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
220        self.app_paintable = Some(app_paintable);
221        self
222    }
223
224    pub fn can_default(mut self, can_default: bool) -> Self {
225        self.can_default = Some(can_default);
226        self
227    }
228
229    pub fn can_focus(mut self, can_focus: bool) -> Self {
230        self.can_focus = Some(can_focus);
231        self
232    }
233
234    pub fn events(mut self, events: gdk::EventMask) -> Self {
235        self.events = Some(events);
236        self
237    }
238
239    pub fn expand(mut self, expand: bool) -> Self {
240        self.expand = Some(expand);
241        self
242    }
243
244    #[cfg(any(feature = "v3_20", feature = "dox"))]
245    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
246        self.focus_on_click = Some(focus_on_click);
247        self
248    }
249
250    pub fn halign(mut self, halign: Align) -> Self {
251        self.halign = Some(halign);
252        self
253    }
254
255    pub fn has_default(mut self, has_default: bool) -> Self {
256        self.has_default = Some(has_default);
257        self
258    }
259
260    pub fn has_focus(mut self, has_focus: bool) -> Self {
261        self.has_focus = Some(has_focus);
262        self
263    }
264
265    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
266        self.has_tooltip = Some(has_tooltip);
267        self
268    }
269
270    pub fn height_request(mut self, height_request: i32) -> Self {
271        self.height_request = Some(height_request);
272        self
273    }
274
275    pub fn hexpand(mut self, hexpand: bool) -> Self {
276        self.hexpand = Some(hexpand);
277        self
278    }
279
280    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
281        self.hexpand_set = Some(hexpand_set);
282        self
283    }
284
285    pub fn is_focus(mut self, is_focus: bool) -> Self {
286        self.is_focus = Some(is_focus);
287        self
288    }
289
290    pub fn margin(mut self, margin: i32) -> Self {
291        self.margin = Some(margin);
292        self
293    }
294
295    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
296        self.margin_bottom = Some(margin_bottom);
297        self
298    }
299
300    pub fn margin_end(mut self, margin_end: i32) -> Self {
301        self.margin_end = Some(margin_end);
302        self
303    }
304
305    pub fn margin_start(mut self, margin_start: i32) -> Self {
306        self.margin_start = Some(margin_start);
307        self
308    }
309
310    pub fn margin_top(mut self, margin_top: i32) -> Self {
311        self.margin_top = Some(margin_top);
312        self
313    }
314
315    pub fn name(mut self, name: &str) -> Self {
316        self.name = Some(name.to_string());
317        self
318    }
319
320    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
321        self.no_show_all = Some(no_show_all);
322        self
323    }
324
325    pub fn opacity(mut self, opacity: f64) -> Self {
326        self.opacity = Some(opacity);
327        self
328    }
329
330    pub fn parent(mut self, parent: &Container) -> Self {
331        self.parent = Some(parent.clone());
332        self
333    }
334
335    pub fn receives_default(mut self, receives_default: bool) -> Self {
336        self.receives_default = Some(receives_default);
337        self
338    }
339
340    pub fn sensitive(mut self, sensitive: bool) -> Self {
341        self.sensitive = Some(sensitive);
342        self
343    }
344
345    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
346        self.tooltip_markup = Some(tooltip_markup.to_string());
347        self
348    }
349
350    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
351        self.tooltip_text = Some(tooltip_text.to_string());
352        self
353    }
354
355    pub fn valign(mut self, valign: Align) -> Self {
356        self.valign = Some(valign);
357        self
358    }
359
360    pub fn vexpand(mut self, vexpand: bool) -> Self {
361        self.vexpand = Some(vexpand);
362        self
363    }
364
365    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
366        self.vexpand_set = Some(vexpand_set);
367        self
368    }
369
370    pub fn visible(mut self, visible: bool) -> Self {
371        self.visible = Some(visible);
372        self
373    }
374
375    pub fn width_request(mut self, width_request: i32) -> Self {
376        self.width_request = Some(width_request);
377        self
378    }
379}
380
381pub const NONE_SEPARATOR: Option<&Separator> = None;
382
383impl fmt::Display for Separator {
384    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
385        write!(f, "Separator")
386    }
387}