gtk/auto/
separator_menu_item.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 Actionable;
13use Align;
14use Bin;
15use Buildable;
16use Container;
17use Menu;
18use MenuItem;
19use ResizeMode;
20use Widget;
21
22glib_wrapper! {
23    pub struct SeparatorMenuItem(Object<gtk_sys::GtkSeparatorMenuItem, gtk_sys::GtkSeparatorMenuItemClass, SeparatorMenuItemClass>) @extends MenuItem, Bin, Container, Widget, @implements Buildable, Actionable;
24
25    match fn {
26        get_type => || gtk_sys::gtk_separator_menu_item_get_type(),
27    }
28}
29
30impl SeparatorMenuItem {
31    pub fn new() -> SeparatorMenuItem {
32        assert_initialized_main_thread!();
33        unsafe { Widget::from_glib_none(gtk_sys::gtk_separator_menu_item_new()).unsafe_cast() }
34    }
35}
36
37impl Default for SeparatorMenuItem {
38    fn default() -> Self {
39        Self::new()
40    }
41}
42
43pub struct SeparatorMenuItemBuilder {
44    accel_path: Option<String>,
45    label: Option<String>,
46    right_justified: Option<bool>,
47    submenu: Option<Menu>,
48    use_underline: Option<bool>,
49    border_width: Option<u32>,
50    child: Option<Widget>,
51    resize_mode: Option<ResizeMode>,
52    app_paintable: Option<bool>,
53    can_default: Option<bool>,
54    can_focus: Option<bool>,
55    events: Option<gdk::EventMask>,
56    expand: Option<bool>,
57    #[cfg(any(feature = "v3_20", feature = "dox"))]
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    //style: /*Unknown type*/,
79    tooltip_markup: Option<String>,
80    tooltip_text: Option<String>,
81    valign: Option<Align>,
82    vexpand: Option<bool>,
83    vexpand_set: Option<bool>,
84    visible: Option<bool>,
85    width_request: Option<i32>,
86}
87
88impl SeparatorMenuItemBuilder {
89    pub fn new() -> Self {
90        Self {
91            accel_path: None,
92            label: None,
93            right_justified: None,
94            submenu: None,
95            use_underline: None,
96            border_width: None,
97            child: None,
98            resize_mode: None,
99            app_paintable: None,
100            can_default: None,
101            can_focus: None,
102            events: None,
103            expand: None,
104            #[cfg(any(feature = "v3_20", feature = "dox"))]
105            focus_on_click: None,
106            halign: None,
107            has_default: None,
108            has_focus: None,
109            has_tooltip: None,
110            height_request: None,
111            hexpand: None,
112            hexpand_set: None,
113            is_focus: None,
114            margin: None,
115            margin_bottom: None,
116            margin_end: None,
117            margin_start: None,
118            margin_top: None,
119            name: None,
120            no_show_all: None,
121            opacity: None,
122            parent: None,
123            receives_default: None,
124            sensitive: None,
125            tooltip_markup: None,
126            tooltip_text: None,
127            valign: None,
128            vexpand: None,
129            vexpand_set: None,
130            visible: None,
131            width_request: None,
132        }
133    }
134
135    pub fn build(self) -> SeparatorMenuItem {
136        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
137        if let Some(ref accel_path) = self.accel_path {
138            properties.push(("accel-path", accel_path));
139        }
140        if let Some(ref label) = self.label {
141            properties.push(("label", label));
142        }
143        if let Some(ref right_justified) = self.right_justified {
144            properties.push(("right-justified", right_justified));
145        }
146        if let Some(ref submenu) = self.submenu {
147            properties.push(("submenu", submenu));
148        }
149        if let Some(ref use_underline) = self.use_underline {
150            properties.push(("use-underline", use_underline));
151        }
152        if let Some(ref border_width) = self.border_width {
153            properties.push(("border-width", border_width));
154        }
155        if let Some(ref child) = self.child {
156            properties.push(("child", child));
157        }
158        if let Some(ref resize_mode) = self.resize_mode {
159            properties.push(("resize-mode", resize_mode));
160        }
161        if let Some(ref app_paintable) = self.app_paintable {
162            properties.push(("app-paintable", app_paintable));
163        }
164        if let Some(ref can_default) = self.can_default {
165            properties.push(("can-default", can_default));
166        }
167        if let Some(ref can_focus) = self.can_focus {
168            properties.push(("can-focus", can_focus));
169        }
170        if let Some(ref events) = self.events {
171            properties.push(("events", events));
172        }
173        if let Some(ref expand) = self.expand {
174            properties.push(("expand", expand));
175        }
176        #[cfg(any(feature = "v3_20", feature = "dox"))]
177        {
178            if let Some(ref focus_on_click) = self.focus_on_click {
179                properties.push(("focus-on-click", focus_on_click));
180            }
181        }
182        if let Some(ref halign) = self.halign {
183            properties.push(("halign", halign));
184        }
185        if let Some(ref has_default) = self.has_default {
186            properties.push(("has-default", has_default));
187        }
188        if let Some(ref has_focus) = self.has_focus {
189            properties.push(("has-focus", has_focus));
190        }
191        if let Some(ref has_tooltip) = self.has_tooltip {
192            properties.push(("has-tooltip", has_tooltip));
193        }
194        if let Some(ref height_request) = self.height_request {
195            properties.push(("height-request", height_request));
196        }
197        if let Some(ref hexpand) = self.hexpand {
198            properties.push(("hexpand", hexpand));
199        }
200        if let Some(ref hexpand_set) = self.hexpand_set {
201            properties.push(("hexpand-set", hexpand_set));
202        }
203        if let Some(ref is_focus) = self.is_focus {
204            properties.push(("is-focus", is_focus));
205        }
206        if let Some(ref margin) = self.margin {
207            properties.push(("margin", margin));
208        }
209        if let Some(ref margin_bottom) = self.margin_bottom {
210            properties.push(("margin-bottom", margin_bottom));
211        }
212        if let Some(ref margin_end) = self.margin_end {
213            properties.push(("margin-end", margin_end));
214        }
215        if let Some(ref margin_start) = self.margin_start {
216            properties.push(("margin-start", margin_start));
217        }
218        if let Some(ref margin_top) = self.margin_top {
219            properties.push(("margin-top", margin_top));
220        }
221        if let Some(ref name) = self.name {
222            properties.push(("name", name));
223        }
224        if let Some(ref no_show_all) = self.no_show_all {
225            properties.push(("no-show-all", no_show_all));
226        }
227        if let Some(ref opacity) = self.opacity {
228            properties.push(("opacity", opacity));
229        }
230        if let Some(ref parent) = self.parent {
231            properties.push(("parent", parent));
232        }
233        if let Some(ref receives_default) = self.receives_default {
234            properties.push(("receives-default", receives_default));
235        }
236        if let Some(ref sensitive) = self.sensitive {
237            properties.push(("sensitive", sensitive));
238        }
239        if let Some(ref tooltip_markup) = self.tooltip_markup {
240            properties.push(("tooltip-markup", tooltip_markup));
241        }
242        if let Some(ref tooltip_text) = self.tooltip_text {
243            properties.push(("tooltip-text", tooltip_text));
244        }
245        if let Some(ref valign) = self.valign {
246            properties.push(("valign", valign));
247        }
248        if let Some(ref vexpand) = self.vexpand {
249            properties.push(("vexpand", vexpand));
250        }
251        if let Some(ref vexpand_set) = self.vexpand_set {
252            properties.push(("vexpand-set", vexpand_set));
253        }
254        if let Some(ref visible) = self.visible {
255            properties.push(("visible", visible));
256        }
257        if let Some(ref width_request) = self.width_request {
258            properties.push(("width-request", width_request));
259        }
260        glib::Object::new(SeparatorMenuItem::static_type(), &properties)
261            .expect("object new")
262            .downcast()
263            .expect("downcast")
264    }
265
266    pub fn accel_path(mut self, accel_path: &str) -> Self {
267        self.accel_path = Some(accel_path.to_string());
268        self
269    }
270
271    pub fn label(mut self, label: &str) -> Self {
272        self.label = Some(label.to_string());
273        self
274    }
275
276    pub fn right_justified(mut self, right_justified: bool) -> Self {
277        self.right_justified = Some(right_justified);
278        self
279    }
280
281    pub fn submenu(mut self, submenu: &Menu) -> Self {
282        self.submenu = Some(submenu.clone());
283        self
284    }
285
286    pub fn use_underline(mut self, use_underline: bool) -> Self {
287        self.use_underline = Some(use_underline);
288        self
289    }
290
291    pub fn border_width(mut self, border_width: u32) -> Self {
292        self.border_width = Some(border_width);
293        self
294    }
295
296    pub fn child(mut self, child: &Widget) -> Self {
297        self.child = Some(child.clone());
298        self
299    }
300
301    pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
302        self.resize_mode = Some(resize_mode);
303        self
304    }
305
306    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
307        self.app_paintable = Some(app_paintable);
308        self
309    }
310
311    pub fn can_default(mut self, can_default: bool) -> Self {
312        self.can_default = Some(can_default);
313        self
314    }
315
316    pub fn can_focus(mut self, can_focus: bool) -> Self {
317        self.can_focus = Some(can_focus);
318        self
319    }
320
321    pub fn events(mut self, events: gdk::EventMask) -> Self {
322        self.events = Some(events);
323        self
324    }
325
326    pub fn expand(mut self, expand: bool) -> Self {
327        self.expand = Some(expand);
328        self
329    }
330
331    #[cfg(any(feature = "v3_20", feature = "dox"))]
332    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
333        self.focus_on_click = Some(focus_on_click);
334        self
335    }
336
337    pub fn halign(mut self, halign: Align) -> Self {
338        self.halign = Some(halign);
339        self
340    }
341
342    pub fn has_default(mut self, has_default: bool) -> Self {
343        self.has_default = Some(has_default);
344        self
345    }
346
347    pub fn has_focus(mut self, has_focus: bool) -> Self {
348        self.has_focus = Some(has_focus);
349        self
350    }
351
352    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
353        self.has_tooltip = Some(has_tooltip);
354        self
355    }
356
357    pub fn height_request(mut self, height_request: i32) -> Self {
358        self.height_request = Some(height_request);
359        self
360    }
361
362    pub fn hexpand(mut self, hexpand: bool) -> Self {
363        self.hexpand = Some(hexpand);
364        self
365    }
366
367    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
368        self.hexpand_set = Some(hexpand_set);
369        self
370    }
371
372    pub fn is_focus(mut self, is_focus: bool) -> Self {
373        self.is_focus = Some(is_focus);
374        self
375    }
376
377    pub fn margin(mut self, margin: i32) -> Self {
378        self.margin = Some(margin);
379        self
380    }
381
382    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
383        self.margin_bottom = Some(margin_bottom);
384        self
385    }
386
387    pub fn margin_end(mut self, margin_end: i32) -> Self {
388        self.margin_end = Some(margin_end);
389        self
390    }
391
392    pub fn margin_start(mut self, margin_start: i32) -> Self {
393        self.margin_start = Some(margin_start);
394        self
395    }
396
397    pub fn margin_top(mut self, margin_top: i32) -> Self {
398        self.margin_top = Some(margin_top);
399        self
400    }
401
402    pub fn name(mut self, name: &str) -> Self {
403        self.name = Some(name.to_string());
404        self
405    }
406
407    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
408        self.no_show_all = Some(no_show_all);
409        self
410    }
411
412    pub fn opacity(mut self, opacity: f64) -> Self {
413        self.opacity = Some(opacity);
414        self
415    }
416
417    pub fn parent(mut self, parent: &Container) -> Self {
418        self.parent = Some(parent.clone());
419        self
420    }
421
422    pub fn receives_default(mut self, receives_default: bool) -> Self {
423        self.receives_default = Some(receives_default);
424        self
425    }
426
427    pub fn sensitive(mut self, sensitive: bool) -> Self {
428        self.sensitive = Some(sensitive);
429        self
430    }
431
432    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
433        self.tooltip_markup = Some(tooltip_markup.to_string());
434        self
435    }
436
437    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
438        self.tooltip_text = Some(tooltip_text.to_string());
439        self
440    }
441
442    pub fn valign(mut self, valign: Align) -> Self {
443        self.valign = Some(valign);
444        self
445    }
446
447    pub fn vexpand(mut self, vexpand: bool) -> Self {
448        self.vexpand = Some(vexpand);
449        self
450    }
451
452    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
453        self.vexpand_set = Some(vexpand_set);
454        self
455    }
456
457    pub fn visible(mut self, visible: bool) -> Self {
458        self.visible = Some(visible);
459        self
460    }
461
462    pub fn width_request(mut self, width_request: i32) -> Self {
463        self.width_request = Some(width_request);
464        self
465    }
466}
467
468pub const NONE_SEPARATOR_MENU_ITEM: Option<&SeparatorMenuItem> = None;
469
470impl fmt::Display for SeparatorMenuItem {
471    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
472        write!(f, "SeparatorMenuItem")
473    }
474}