Skip to main content

gtk/auto/
separator_tool_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 crate::{Align, Bin, Buildable, Container, ResizeMode, ToolItem, Widget, ffi};
6use glib::{
7    prelude::*,
8    signal::{SignalHandlerId, connect_raw},
9    translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14    /// A [`SeparatorToolItem`][crate::SeparatorToolItem] is a [`ToolItem`][crate::ToolItem] that separates groups of other
15    /// `GtkToolItems`. Depending on the theme, a [`SeparatorToolItem`][crate::SeparatorToolItem] will
16    /// often look like a vertical line on horizontally docked toolbars.
17    ///
18    /// If the [`Toolbar`][crate::Toolbar] child property “expand” is [`true`] and the property
19    /// [`draw`][struct@crate::SeparatorToolItem#draw] is [`false`], a [`SeparatorToolItem`][crate::SeparatorToolItem] will act as
20    /// a “spring” that forces other items to the ends of the toolbar.
21    ///
22    /// Use [`new()`][Self::new()] to create a new [`SeparatorToolItem`][crate::SeparatorToolItem].
23    ///
24    /// # CSS nodes
25    ///
26    /// GtkSeparatorToolItem has a single CSS node with name separator.
27    ///
28    /// ## Properties
29    ///
30    ///
31    /// #### `draw`
32    ///  Readable | Writable
33    /// <details><summary><h4>ToolItem</h4></summary>
34    ///
35    ///
36    /// #### `is-important`
37    ///  Readable | Writable
38    ///
39    ///
40    /// #### `visible-horizontal`
41    ///  Readable | Writable
42    ///
43    ///
44    /// #### `visible-vertical`
45    ///  Readable | Writable
46    /// </details>
47    /// <details><summary><h4>Container</h4></summary>
48    ///
49    ///
50    /// #### `border-width`
51    ///  Readable | Writable
52    ///
53    ///
54    /// #### `child`
55    ///  Writable
56    ///
57    ///
58    /// #### `resize-mode`
59    ///  Readable | Writable
60    /// </details>
61    /// <details><summary><h4>Widget</h4></summary>
62    ///
63    ///
64    /// #### `app-paintable`
65    ///  Readable | Writable
66    ///
67    ///
68    /// #### `can-default`
69    ///  Readable | Writable
70    ///
71    ///
72    /// #### `can-focus`
73    ///  Readable | Writable
74    ///
75    ///
76    /// #### `composite-child`
77    ///  Readable
78    ///
79    ///
80    /// #### `double-buffered`
81    ///  Whether the widget is double buffered.
82    ///
83    /// Readable | Writable
84    ///
85    ///
86    /// #### `events`
87    ///  Readable | Writable
88    ///
89    ///
90    /// #### `expand`
91    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
92    ///
93    /// Readable | Writable
94    ///
95    ///
96    /// #### `focus-on-click`
97    ///  Whether the widget should grab focus when it is clicked with the mouse.
98    ///
99    /// This property is only relevant for widgets that can take focus.
100    ///
101    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
102    /// GtkComboBox) implemented this property individually.
103    ///
104    /// Readable | Writable
105    ///
106    ///
107    /// #### `halign`
108    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
109    ///
110    /// Readable | Writable
111    ///
112    ///
113    /// #### `has-default`
114    ///  Readable | Writable
115    ///
116    ///
117    /// #### `has-focus`
118    ///  Readable | Writable
119    ///
120    ///
121    /// #### `has-tooltip`
122    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
123    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
124    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
125    /// whether it will provide a tooltip or not.
126    ///
127    /// Note that setting this property to [`true`] for the first time will change
128    /// the event masks of the GdkWindows of this widget to include leave-notify
129    /// and motion-notify events. This cannot and will not be undone when the
130    /// property is set to [`false`] again.
131    ///
132    /// Readable | Writable
133    ///
134    ///
135    /// #### `height-request`
136    ///  Readable | Writable
137    ///
138    ///
139    /// #### `hexpand`
140    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `hexpand-set`
146    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
147    ///
148    /// Readable | Writable
149    ///
150    ///
151    /// #### `is-focus`
152    ///  Readable | Writable
153    ///
154    ///
155    /// #### `margin`
156    ///  Sets all four sides' margin at once. If read, returns max
157    /// margin on any side.
158    ///
159    /// Readable | Writable
160    ///
161    ///
162    /// #### `margin-bottom`
163    ///  Margin on bottom side of widget.
164    ///
165    /// This property adds margin outside of the widget's normal size
166    /// request, the margin will be added in addition to the size from
167    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
168    ///
169    /// Readable | Writable
170    ///
171    ///
172    /// #### `margin-end`
173    ///  Margin on end of widget, horizontally. This property supports
174    /// left-to-right and right-to-left text directions.
175    ///
176    /// This property adds margin outside of the widget's normal size
177    /// request, the margin will be added in addition to the size from
178    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
179    ///
180    /// Readable | Writable
181    ///
182    ///
183    /// #### `margin-left`
184    ///  Margin on left side of widget.
185    ///
186    /// This property adds margin outside of the widget's normal size
187    /// request, the margin will be added in addition to the size from
188    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
189    ///
190    /// Readable | Writable
191    ///
192    ///
193    /// #### `margin-right`
194    ///  Margin on right side of widget.
195    ///
196    /// This property adds margin outside of the widget's normal size
197    /// request, the margin will be added in addition to the size from
198    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
199    ///
200    /// Readable | Writable
201    ///
202    ///
203    /// #### `margin-start`
204    ///  Margin on start of widget, horizontally. This property supports
205    /// left-to-right and right-to-left text directions.
206    ///
207    /// This property adds margin outside of the widget's normal size
208    /// request, the margin will be added in addition to the size from
209    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
210    ///
211    /// Readable | Writable
212    ///
213    ///
214    /// #### `margin-top`
215    ///  Margin on top side of widget.
216    ///
217    /// This property adds margin outside of the widget's normal size
218    /// request, the margin will be added in addition to the size from
219    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
220    ///
221    /// Readable | Writable
222    ///
223    ///
224    /// #### `name`
225    ///  Readable | Writable
226    ///
227    ///
228    /// #### `no-show-all`
229    ///  Readable | Writable
230    ///
231    ///
232    /// #### `opacity`
233    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
234    /// more details about window opacity.
235    ///
236    /// Before 3.8 this was only available in GtkWindow
237    ///
238    /// Readable | Writable
239    ///
240    ///
241    /// #### `parent`
242    ///  Readable | Writable
243    ///
244    ///
245    /// #### `receives-default`
246    ///  Readable | Writable
247    ///
248    ///
249    /// #### `scale-factor`
250    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
251    /// more details about widget scaling.
252    ///
253    /// Readable
254    ///
255    ///
256    /// #### `sensitive`
257    ///  Readable | Writable
258    ///
259    ///
260    /// #### `style`
261    ///  The style of the widget, which contains information about how it will look (colors, etc).
262    ///
263    /// Readable | Writable
264    ///
265    ///
266    /// #### `tooltip-markup`
267    ///  Sets the text of tooltip to be the given string, which is marked up
268    /// with the [Pango text markup language][PangoMarkupFormat].
269    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
270    ///
271    /// This is a convenience property which will take care of getting the
272    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
273    /// will automatically be set to [`true`] and there will be taken care of
274    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
275    ///
276    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
277    /// are set, the last one wins.
278    ///
279    /// Readable | Writable
280    ///
281    ///
282    /// #### `tooltip-text`
283    ///  Sets the text of tooltip to be the given string.
284    ///
285    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
286    ///
287    /// This is a convenience property which will take care of getting the
288    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
289    /// will automatically be set to [`true`] and there will be taken care of
290    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
291    ///
292    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
293    /// are set, the last one wins.
294    ///
295    /// Readable | Writable
296    ///
297    ///
298    /// #### `valign`
299    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
300    ///
301    /// Readable | Writable
302    ///
303    ///
304    /// #### `vexpand`
305    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
306    ///
307    /// Readable | Writable
308    ///
309    ///
310    /// #### `vexpand-set`
311    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
312    ///
313    /// Readable | Writable
314    ///
315    ///
316    /// #### `visible`
317    ///  Readable | Writable
318    ///
319    ///
320    /// #### `width-request`
321    ///  Readable | Writable
322    ///
323    ///
324    /// #### `window`
325    ///  The widget's window if it is realized, [`None`] otherwise.
326    ///
327    /// Readable
328    /// </details>
329    /// <details><summary><h4>Activatable</h4></summary>
330    ///
331    ///
332    /// #### `related-action`
333    ///   call `gtk_activatable_do_set_related_action()` when it changes.
334    ///
335    /// Readable | Writable
336    ///
337    ///
338    /// #### `use-action-appearance`
339    ///   widget when it changes.
340    ///
341    /// Readable | Writable
342    /// </details>
343    ///
344    /// # Implements
345    ///
346    /// [`SeparatorToolItemExt`][trait@crate::prelude::SeparatorToolItemExt], [`ToolItemExt`][trait@crate::prelude::ToolItemExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
347    #[doc(alias = "GtkSeparatorToolItem")]
348    pub struct SeparatorToolItem(Object<ffi::GtkSeparatorToolItem, ffi::GtkSeparatorToolItemClass>) @extends ToolItem, Bin, Container, Widget, @implements Buildable;
349
350    match fn {
351        type_ => || ffi::gtk_separator_tool_item_get_type(),
352    }
353}
354
355impl SeparatorToolItem {
356    pub const NONE: Option<&'static SeparatorToolItem> = None;
357
358    /// Create a new [`SeparatorToolItem`][crate::SeparatorToolItem]
359    ///
360    /// # Returns
361    ///
362    /// the new [`SeparatorToolItem`][crate::SeparatorToolItem]
363    #[doc(alias = "gtk_separator_tool_item_new")]
364    pub fn new() -> SeparatorToolItem {
365        assert_initialized_main_thread!();
366        unsafe { ToolItem::from_glib_none(ffi::gtk_separator_tool_item_new()).unsafe_cast() }
367    }
368
369    // rustdoc-stripper-ignore-next
370    /// Creates a new builder-pattern struct instance to construct [`SeparatorToolItem`] objects.
371    ///
372    /// This method returns an instance of [`SeparatorToolItemBuilder`](crate::builders::SeparatorToolItemBuilder) which can be used to create [`SeparatorToolItem`] objects.
373    pub fn builder() -> SeparatorToolItemBuilder {
374        SeparatorToolItemBuilder::new()
375    }
376}
377
378impl Default for SeparatorToolItem {
379    fn default() -> Self {
380        Self::new()
381    }
382}
383
384// rustdoc-stripper-ignore-next
385/// A [builder-pattern] type to construct [`SeparatorToolItem`] objects.
386///
387/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
388#[must_use = "The builder must be built to be used"]
389pub struct SeparatorToolItemBuilder {
390    builder: glib::object::ObjectBuilder<'static, SeparatorToolItem>,
391}
392
393impl SeparatorToolItemBuilder {
394    fn new() -> Self {
395        Self {
396            builder: glib::object::Object::builder(),
397        }
398    }
399
400    pub fn draw(self, draw: bool) -> Self {
401        Self {
402            builder: self.builder.property("draw", draw),
403        }
404    }
405
406    pub fn is_important(self, is_important: bool) -> Self {
407        Self {
408            builder: self.builder.property("is-important", is_important),
409        }
410    }
411
412    pub fn visible_horizontal(self, visible_horizontal: bool) -> Self {
413        Self {
414            builder: self
415                .builder
416                .property("visible-horizontal", visible_horizontal),
417        }
418    }
419
420    pub fn visible_vertical(self, visible_vertical: bool) -> Self {
421        Self {
422            builder: self.builder.property("visible-vertical", visible_vertical),
423        }
424    }
425
426    pub fn border_width(self, border_width: u32) -> Self {
427        Self {
428            builder: self.builder.property("border-width", border_width),
429        }
430    }
431
432    pub fn child(self, child: &impl IsA<Widget>) -> Self {
433        Self {
434            builder: self.builder.property("child", child.clone().upcast()),
435        }
436    }
437
438    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
439        Self {
440            builder: self.builder.property("resize-mode", resize_mode),
441        }
442    }
443
444    pub fn app_paintable(self, app_paintable: bool) -> Self {
445        Self {
446            builder: self.builder.property("app-paintable", app_paintable),
447        }
448    }
449
450    pub fn can_default(self, can_default: bool) -> Self {
451        Self {
452            builder: self.builder.property("can-default", can_default),
453        }
454    }
455
456    pub fn can_focus(self, can_focus: bool) -> Self {
457        Self {
458            builder: self.builder.property("can-focus", can_focus),
459        }
460    }
461
462    pub fn events(self, events: gdk::EventMask) -> Self {
463        Self {
464            builder: self.builder.property("events", events),
465        }
466    }
467
468    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
469    pub fn expand(self, expand: bool) -> Self {
470        Self {
471            builder: self.builder.property("expand", expand),
472        }
473    }
474
475    /// Whether the widget should grab focus when it is clicked with the mouse.
476    ///
477    /// This property is only relevant for widgets that can take focus.
478    ///
479    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
480    /// GtkComboBox) implemented this property individually.
481    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
482        Self {
483            builder: self.builder.property("focus-on-click", focus_on_click),
484        }
485    }
486
487    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
488    pub fn halign(self, halign: Align) -> Self {
489        Self {
490            builder: self.builder.property("halign", halign),
491        }
492    }
493
494    pub fn has_default(self, has_default: bool) -> Self {
495        Self {
496            builder: self.builder.property("has-default", has_default),
497        }
498    }
499
500    pub fn has_focus(self, has_focus: bool) -> Self {
501        Self {
502            builder: self.builder.property("has-focus", has_focus),
503        }
504    }
505
506    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
507    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
508    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
509    /// whether it will provide a tooltip or not.
510    ///
511    /// Note that setting this property to [`true`] for the first time will change
512    /// the event masks of the GdkWindows of this widget to include leave-notify
513    /// and motion-notify events. This cannot and will not be undone when the
514    /// property is set to [`false`] again.
515    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
516        Self {
517            builder: self.builder.property("has-tooltip", has_tooltip),
518        }
519    }
520
521    pub fn height_request(self, height_request: i32) -> Self {
522        Self {
523            builder: self.builder.property("height-request", height_request),
524        }
525    }
526
527    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
528    pub fn hexpand(self, hexpand: bool) -> Self {
529        Self {
530            builder: self.builder.property("hexpand", hexpand),
531        }
532    }
533
534    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
535    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
536        Self {
537            builder: self.builder.property("hexpand-set", hexpand_set),
538        }
539    }
540
541    pub fn is_focus(self, is_focus: bool) -> Self {
542        Self {
543            builder: self.builder.property("is-focus", is_focus),
544        }
545    }
546
547    /// Sets all four sides' margin at once. If read, returns max
548    /// margin on any side.
549    pub fn margin(self, margin: i32) -> Self {
550        Self {
551            builder: self.builder.property("margin", margin),
552        }
553    }
554
555    /// Margin on bottom side of widget.
556    ///
557    /// This property adds margin outside of the widget's normal size
558    /// request, the margin will be added in addition to the size from
559    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
560    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
561        Self {
562            builder: self.builder.property("margin-bottom", margin_bottom),
563        }
564    }
565
566    /// Margin on end of widget, horizontally. This property supports
567    /// left-to-right and right-to-left text directions.
568    ///
569    /// This property adds margin outside of the widget's normal size
570    /// request, the margin will be added in addition to the size from
571    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
572    pub fn margin_end(self, margin_end: i32) -> Self {
573        Self {
574            builder: self.builder.property("margin-end", margin_end),
575        }
576    }
577
578    /// Margin on start of widget, horizontally. This property supports
579    /// left-to-right and right-to-left text directions.
580    ///
581    /// This property adds margin outside of the widget's normal size
582    /// request, the margin will be added in addition to the size from
583    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
584    pub fn margin_start(self, margin_start: i32) -> Self {
585        Self {
586            builder: self.builder.property("margin-start", margin_start),
587        }
588    }
589
590    /// Margin on top side of widget.
591    ///
592    /// This property adds margin outside of the widget's normal size
593    /// request, the margin will be added in addition to the size from
594    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
595    pub fn margin_top(self, margin_top: i32) -> Self {
596        Self {
597            builder: self.builder.property("margin-top", margin_top),
598        }
599    }
600
601    pub fn name(self, name: impl Into<glib::GString>) -> Self {
602        Self {
603            builder: self.builder.property("name", name.into()),
604        }
605    }
606
607    pub fn no_show_all(self, no_show_all: bool) -> Self {
608        Self {
609            builder: self.builder.property("no-show-all", no_show_all),
610        }
611    }
612
613    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
614    /// more details about window opacity.
615    ///
616    /// Before 3.8 this was only available in GtkWindow
617    pub fn opacity(self, opacity: f64) -> Self {
618        Self {
619            builder: self.builder.property("opacity", opacity),
620        }
621    }
622
623    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
624        Self {
625            builder: self.builder.property("parent", parent.clone().upcast()),
626        }
627    }
628
629    pub fn receives_default(self, receives_default: bool) -> Self {
630        Self {
631            builder: self.builder.property("receives-default", receives_default),
632        }
633    }
634
635    pub fn sensitive(self, sensitive: bool) -> Self {
636        Self {
637            builder: self.builder.property("sensitive", sensitive),
638        }
639    }
640
641    /// Sets the text of tooltip to be the given string, which is marked up
642    /// with the [Pango text markup language][PangoMarkupFormat].
643    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
644    ///
645    /// This is a convenience property which will take care of getting the
646    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
647    /// will automatically be set to [`true`] and there will be taken care of
648    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
649    ///
650    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
651    /// are set, the last one wins.
652    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
653        Self {
654            builder: self
655                .builder
656                .property("tooltip-markup", tooltip_markup.into()),
657        }
658    }
659
660    /// Sets the text of tooltip to be the given string.
661    ///
662    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
663    ///
664    /// This is a convenience property which will take care of getting the
665    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
666    /// will automatically be set to [`true`] and there will be taken care of
667    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
668    ///
669    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
670    /// are set, the last one wins.
671    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
672        Self {
673            builder: self.builder.property("tooltip-text", tooltip_text.into()),
674        }
675    }
676
677    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
678    pub fn valign(self, valign: Align) -> Self {
679        Self {
680            builder: self.builder.property("valign", valign),
681        }
682    }
683
684    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
685    pub fn vexpand(self, vexpand: bool) -> Self {
686        Self {
687            builder: self.builder.property("vexpand", vexpand),
688        }
689    }
690
691    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
692    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
693        Self {
694            builder: self.builder.property("vexpand-set", vexpand_set),
695        }
696    }
697
698    pub fn visible(self, visible: bool) -> Self {
699        Self {
700            builder: self.builder.property("visible", visible),
701        }
702    }
703
704    pub fn width_request(self, width_request: i32) -> Self {
705        Self {
706            builder: self.builder.property("width-request", width_request),
707        }
708    }
709
710    // rustdoc-stripper-ignore-next
711    /// Build the [`SeparatorToolItem`].
712    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
713    pub fn build(self) -> SeparatorToolItem {
714        assert_initialized_main_thread!();
715        self.builder.build()
716    }
717}
718
719/// Trait containing all [`struct@SeparatorToolItem`] methods.
720///
721/// # Implementors
722///
723/// [`SeparatorToolItem`][struct@crate::SeparatorToolItem]
724pub trait SeparatorToolItemExt: IsA<SeparatorToolItem> + 'static {
725    /// Returns whether `self` is drawn as a line, or just blank.
726    /// See [`set_draw()`][Self::set_draw()].
727    ///
728    /// # Returns
729    ///
730    /// [`true`] if `self` is drawn as a line, or just blank.
731    #[doc(alias = "gtk_separator_tool_item_get_draw")]
732    #[doc(alias = "get_draw")]
733    #[doc(alias = "draw")]
734    fn draws(&self) -> bool {
735        unsafe {
736            from_glib(ffi::gtk_separator_tool_item_get_draw(
737                self.as_ref().to_glib_none().0,
738            ))
739        }
740    }
741
742    /// Whether `self` is drawn as a vertical line, or just blank.
743    /// Setting this to [`false`] along with [`ToolItemExt::set_expand()`][crate::prelude::ToolItemExt::set_expand()] is useful
744    /// to create an item that forces following items to the end of the toolbar.
745    /// ## `draw`
746    /// whether `self` is drawn as a vertical line
747    #[doc(alias = "gtk_separator_tool_item_set_draw")]
748    #[doc(alias = "draw")]
749    fn set_draw(&self, draw: bool) {
750        unsafe {
751            ffi::gtk_separator_tool_item_set_draw(self.as_ref().to_glib_none().0, draw.into_glib());
752        }
753    }
754
755    #[doc(alias = "draw")]
756    fn connect_draw_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
757        unsafe extern "C" fn notify_draw_trampoline<
758            P: IsA<SeparatorToolItem>,
759            F: Fn(&P) + 'static,
760        >(
761            this: *mut ffi::GtkSeparatorToolItem,
762            _param_spec: glib::ffi::gpointer,
763            f: glib::ffi::gpointer,
764        ) {
765            unsafe {
766                let f: &F = &*(f as *const F);
767                f(SeparatorToolItem::from_glib_borrow(this).unsafe_cast_ref())
768            }
769        }
770        unsafe {
771            let f: Box_<F> = Box_::new(f);
772            connect_raw(
773                self.as_ptr() as *mut _,
774                c"notify::draw".as_ptr(),
775                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
776                    notify_draw_trampoline::<Self, F> as *const (),
777                )),
778                Box_::into_raw(f),
779            )
780        }
781    }
782}
783
784impl<O: IsA<SeparatorToolItem>> SeparatorToolItemExt for O {}