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};
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, fmt, mem::transmute};
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 | Writeable
33 /// <details><summary><h4>ToolItem</h4></summary>
34 ///
35 ///
36 /// #### `is-important`
37 /// Readable | Writeable
38 ///
39 ///
40 /// #### `visible-horizontal`
41 /// Readable | Writeable
42 ///
43 ///
44 /// #### `visible-vertical`
45 /// Readable | Writeable
46 /// </details>
47 /// <details><summary><h4>Container</h4></summary>
48 ///
49 ///
50 /// #### `border-width`
51 /// Readable | Writeable
52 ///
53 ///
54 /// #### `child`
55 /// Writeable
56 ///
57 ///
58 /// #### `resize-mode`
59 /// Readable | Writeable
60 /// </details>
61 /// <details><summary><h4>Widget</h4></summary>
62 ///
63 ///
64 /// #### `app-paintable`
65 /// Readable | Writeable
66 ///
67 ///
68 /// #### `can-default`
69 /// Readable | Writeable
70 ///
71 ///
72 /// #### `can-focus`
73 /// Readable | Writeable
74 ///
75 ///
76 /// #### `composite-child`
77 /// Readable
78 ///
79 ///
80 /// #### `double-buffered`
81 /// Whether the widget is double buffered.
82 ///
83 /// Readable | Writeable
84 ///
85 ///
86 /// #### `events`
87 /// Readable | Writeable
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 | Writeable
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 | Writeable
105 ///
106 ///
107 /// #### `halign`
108 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
109 ///
110 /// Readable | Writeable
111 ///
112 ///
113 /// #### `has-default`
114 /// Readable | Writeable
115 ///
116 ///
117 /// #### `has-focus`
118 /// Readable | Writeable
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 | Writeable
133 ///
134 ///
135 /// #### `height-request`
136 /// Readable | Writeable
137 ///
138 ///
139 /// #### `hexpand`
140 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
141 ///
142 /// Readable | Writeable
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 | Writeable
149 ///
150 ///
151 /// #### `is-focus`
152 /// Readable | Writeable
153 ///
154 ///
155 /// #### `margin`
156 /// Sets all four sides' margin at once. If read, returns max
157 /// margin on any side.
158 ///
159 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
222 ///
223 ///
224 /// #### `name`
225 /// Readable | Writeable
226 ///
227 ///
228 /// #### `no-show-all`
229 /// Readable | Writeable
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 | Writeable
239 ///
240 ///
241 /// #### `parent`
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `receives-default`
246 /// Readable | Writeable
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 | Writeable
258 ///
259 ///
260 /// #### `style`
261 /// The style of the widget, which contains information about how it will look (colors, etc).
262 ///
263 /// Readable | Writeable
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 | Writeable
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 | Writeable
296 ///
297 ///
298 /// #### `valign`
299 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
300 ///
301 /// Readable | Writeable
302 ///
303 ///
304 /// #### `vexpand`
305 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
306 ///
307 /// Readable | Writeable
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 | Writeable
314 ///
315 ///
316 /// #### `visible`
317 /// Readable | Writeable
318 ///
319 ///
320 /// #### `width-request`
321 /// Readable | Writeable
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 /// The action that this activatable will activate and receive
334 /// updates from for various states and possibly appearance.
335 ///
336 /// > `GtkActivatable` implementors need to handle the this property and
337 /// > call `gtk_activatable_do_set_related_action()` when it changes.
338 ///
339 /// Readable | Writeable
340 ///
341 ///
342 /// #### `use-action-appearance`
343 /// Whether this activatable should reset its layout
344 /// and appearance when setting the related action or when
345 /// the action changes appearance.
346 ///
347 /// See the `GtkAction` documentation directly to find which properties
348 /// should be ignored by the `GtkActivatable` when this property is [`false`].
349 ///
350 /// > `GtkActivatable` implementors need to handle this property
351 /// > and call `gtk_activatable_sync_action_properties()` on the activatable
352 /// > widget when it changes.
353 ///
354 /// Readable | Writeable
355 /// </details>
356 ///
357 /// # Implements
358 ///
359 /// [`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]
360 #[doc(alias = "GtkSeparatorToolItem")]
361 pub struct SeparatorToolItem(Object<ffi::GtkSeparatorToolItem, ffi::GtkSeparatorToolItemClass>) @extends ToolItem, Bin, Container, Widget, @implements Buildable;
362
363 match fn {
364 type_ => || ffi::gtk_separator_tool_item_get_type(),
365 }
366}
367
368impl SeparatorToolItem {
369 pub const NONE: Option<&'static SeparatorToolItem> = None;
370
371 /// Create a new [`SeparatorToolItem`][crate::SeparatorToolItem]
372 ///
373 /// # Returns
374 ///
375 /// the new [`SeparatorToolItem`][crate::SeparatorToolItem]
376 #[doc(alias = "gtk_separator_tool_item_new")]
377 pub fn new() -> SeparatorToolItem {
378 assert_initialized_main_thread!();
379 unsafe { ToolItem::from_glib_none(ffi::gtk_separator_tool_item_new()).unsafe_cast() }
380 }
381
382 // rustdoc-stripper-ignore-next
383 /// Creates a new builder-pattern struct instance to construct [`SeparatorToolItem`] objects.
384 ///
385 /// This method returns an instance of [`SeparatorToolItemBuilder`](crate::builders::SeparatorToolItemBuilder) which can be used to create [`SeparatorToolItem`] objects.
386 pub fn builder() -> SeparatorToolItemBuilder {
387 SeparatorToolItemBuilder::new()
388 }
389}
390
391impl Default for SeparatorToolItem {
392 fn default() -> Self {
393 Self::new()
394 }
395}
396
397// rustdoc-stripper-ignore-next
398/// A [builder-pattern] type to construct [`SeparatorToolItem`] objects.
399///
400/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
401#[must_use = "The builder must be built to be used"]
402pub struct SeparatorToolItemBuilder {
403 builder: glib::object::ObjectBuilder<'static, SeparatorToolItem>,
404}
405
406impl SeparatorToolItemBuilder {
407 fn new() -> Self {
408 Self {
409 builder: glib::object::Object::builder(),
410 }
411 }
412
413 pub fn draw(self, draw: bool) -> Self {
414 Self {
415 builder: self.builder.property("draw", draw),
416 }
417 }
418
419 pub fn is_important(self, is_important: bool) -> Self {
420 Self {
421 builder: self.builder.property("is-important", is_important),
422 }
423 }
424
425 pub fn visible_horizontal(self, visible_horizontal: bool) -> Self {
426 Self {
427 builder: self
428 .builder
429 .property("visible-horizontal", visible_horizontal),
430 }
431 }
432
433 pub fn visible_vertical(self, visible_vertical: bool) -> Self {
434 Self {
435 builder: self.builder.property("visible-vertical", visible_vertical),
436 }
437 }
438
439 pub fn border_width(self, border_width: u32) -> Self {
440 Self {
441 builder: self.builder.property("border-width", border_width),
442 }
443 }
444
445 pub fn child(self, child: &impl IsA<Widget>) -> Self {
446 Self {
447 builder: self.builder.property("child", child.clone().upcast()),
448 }
449 }
450
451 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
452 Self {
453 builder: self.builder.property("resize-mode", resize_mode),
454 }
455 }
456
457 pub fn app_paintable(self, app_paintable: bool) -> Self {
458 Self {
459 builder: self.builder.property("app-paintable", app_paintable),
460 }
461 }
462
463 pub fn can_default(self, can_default: bool) -> Self {
464 Self {
465 builder: self.builder.property("can-default", can_default),
466 }
467 }
468
469 pub fn can_focus(self, can_focus: bool) -> Self {
470 Self {
471 builder: self.builder.property("can-focus", can_focus),
472 }
473 }
474
475 pub fn events(self, events: gdk::EventMask) -> Self {
476 Self {
477 builder: self.builder.property("events", events),
478 }
479 }
480
481 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
482 pub fn expand(self, expand: bool) -> Self {
483 Self {
484 builder: self.builder.property("expand", expand),
485 }
486 }
487
488 /// Whether the widget should grab focus when it is clicked with the mouse.
489 ///
490 /// This property is only relevant for widgets that can take focus.
491 ///
492 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
493 /// GtkComboBox) implemented this property individually.
494 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
495 Self {
496 builder: self.builder.property("focus-on-click", focus_on_click),
497 }
498 }
499
500 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
501 pub fn halign(self, halign: Align) -> Self {
502 Self {
503 builder: self.builder.property("halign", halign),
504 }
505 }
506
507 pub fn has_default(self, has_default: bool) -> Self {
508 Self {
509 builder: self.builder.property("has-default", has_default),
510 }
511 }
512
513 pub fn has_focus(self, has_focus: bool) -> Self {
514 Self {
515 builder: self.builder.property("has-focus", has_focus),
516 }
517 }
518
519 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
520 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
521 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
522 /// whether it will provide a tooltip or not.
523 ///
524 /// Note that setting this property to [`true`] for the first time will change
525 /// the event masks of the GdkWindows of this widget to include leave-notify
526 /// and motion-notify events. This cannot and will not be undone when the
527 /// property is set to [`false`] again.
528 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
529 Self {
530 builder: self.builder.property("has-tooltip", has_tooltip),
531 }
532 }
533
534 pub fn height_request(self, height_request: i32) -> Self {
535 Self {
536 builder: self.builder.property("height-request", height_request),
537 }
538 }
539
540 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
541 pub fn hexpand(self, hexpand: bool) -> Self {
542 Self {
543 builder: self.builder.property("hexpand", hexpand),
544 }
545 }
546
547 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
548 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
549 Self {
550 builder: self.builder.property("hexpand-set", hexpand_set),
551 }
552 }
553
554 pub fn is_focus(self, is_focus: bool) -> Self {
555 Self {
556 builder: self.builder.property("is-focus", is_focus),
557 }
558 }
559
560 /// Sets all four sides' margin at once. If read, returns max
561 /// margin on any side.
562 pub fn margin(self, margin: i32) -> Self {
563 Self {
564 builder: self.builder.property("margin", margin),
565 }
566 }
567
568 /// Margin on bottom side of widget.
569 ///
570 /// This property adds margin outside of the widget's normal size
571 /// request, the margin will be added in addition to the size from
572 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
573 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
574 Self {
575 builder: self.builder.property("margin-bottom", margin_bottom),
576 }
577 }
578
579 /// Margin on end of widget, horizontally. This property supports
580 /// left-to-right and right-to-left text directions.
581 ///
582 /// This property adds margin outside of the widget's normal size
583 /// request, the margin will be added in addition to the size from
584 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
585 pub fn margin_end(self, margin_end: i32) -> Self {
586 Self {
587 builder: self.builder.property("margin-end", margin_end),
588 }
589 }
590
591 /// Margin on start of widget, horizontally. This property supports
592 /// left-to-right and right-to-left text directions.
593 ///
594 /// This property adds margin outside of the widget's normal size
595 /// request, the margin will be added in addition to the size from
596 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
597 pub fn margin_start(self, margin_start: i32) -> Self {
598 Self {
599 builder: self.builder.property("margin-start", margin_start),
600 }
601 }
602
603 /// Margin on top side of widget.
604 ///
605 /// This property adds margin outside of the widget's normal size
606 /// request, the margin will be added in addition to the size from
607 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
608 pub fn margin_top(self, margin_top: i32) -> Self {
609 Self {
610 builder: self.builder.property("margin-top", margin_top),
611 }
612 }
613
614 pub fn name(self, name: impl Into<glib::GString>) -> Self {
615 Self {
616 builder: self.builder.property("name", name.into()),
617 }
618 }
619
620 pub fn no_show_all(self, no_show_all: bool) -> Self {
621 Self {
622 builder: self.builder.property("no-show-all", no_show_all),
623 }
624 }
625
626 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
627 /// more details about window opacity.
628 ///
629 /// Before 3.8 this was only available in GtkWindow
630 pub fn opacity(self, opacity: f64) -> Self {
631 Self {
632 builder: self.builder.property("opacity", opacity),
633 }
634 }
635
636 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
637 Self {
638 builder: self.builder.property("parent", parent.clone().upcast()),
639 }
640 }
641
642 pub fn receives_default(self, receives_default: bool) -> Self {
643 Self {
644 builder: self.builder.property("receives-default", receives_default),
645 }
646 }
647
648 pub fn sensitive(self, sensitive: bool) -> Self {
649 Self {
650 builder: self.builder.property("sensitive", sensitive),
651 }
652 }
653
654 /// Sets the text of tooltip to be the given string, which is marked up
655 /// with the [Pango text markup language][PangoMarkupFormat].
656 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
657 ///
658 /// This is a convenience property which will take care of getting the
659 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
660 /// will automatically be set to [`true`] and there will be taken care of
661 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
662 ///
663 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
664 /// are set, the last one wins.
665 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
666 Self {
667 builder: self
668 .builder
669 .property("tooltip-markup", tooltip_markup.into()),
670 }
671 }
672
673 /// Sets the text of tooltip to be the given string.
674 ///
675 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
676 ///
677 /// This is a convenience property which will take care of getting the
678 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
679 /// will automatically be set to [`true`] and there will be taken care of
680 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
681 ///
682 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
683 /// are set, the last one wins.
684 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
685 Self {
686 builder: self.builder.property("tooltip-text", tooltip_text.into()),
687 }
688 }
689
690 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
691 pub fn valign(self, valign: Align) -> Self {
692 Self {
693 builder: self.builder.property("valign", valign),
694 }
695 }
696
697 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
698 pub fn vexpand(self, vexpand: bool) -> Self {
699 Self {
700 builder: self.builder.property("vexpand", vexpand),
701 }
702 }
703
704 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
705 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
706 Self {
707 builder: self.builder.property("vexpand-set", vexpand_set),
708 }
709 }
710
711 pub fn visible(self, visible: bool) -> Self {
712 Self {
713 builder: self.builder.property("visible", visible),
714 }
715 }
716
717 pub fn width_request(self, width_request: i32) -> Self {
718 Self {
719 builder: self.builder.property("width-request", width_request),
720 }
721 }
722
723 // rustdoc-stripper-ignore-next
724 /// Build the [`SeparatorToolItem`].
725 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
726 pub fn build(self) -> SeparatorToolItem {
727 self.builder.build()
728 }
729}
730
731mod sealed {
732 pub trait Sealed {}
733 impl<T: super::IsA<super::SeparatorToolItem>> Sealed for T {}
734}
735
736/// Trait containing all [`struct@SeparatorToolItem`] methods.
737///
738/// # Implementors
739///
740/// [`SeparatorToolItem`][struct@crate::SeparatorToolItem]
741pub trait SeparatorToolItemExt: IsA<SeparatorToolItem> + sealed::Sealed + 'static {
742 /// Returns whether `self` is drawn as a line, or just blank.
743 /// See [`set_draw()`][Self::set_draw()].
744 ///
745 /// # Returns
746 ///
747 /// [`true`] if `self` is drawn as a line, or just blank.
748 #[doc(alias = "gtk_separator_tool_item_get_draw")]
749 #[doc(alias = "get_draw")]
750 fn draws(&self) -> bool {
751 unsafe {
752 from_glib(ffi::gtk_separator_tool_item_get_draw(
753 self.as_ref().to_glib_none().0,
754 ))
755 }
756 }
757
758 /// Whether `self` is drawn as a vertical line, or just blank.
759 /// Setting this to [`false`] along with [`ToolItemExt::set_expand()`][crate::prelude::ToolItemExt::set_expand()] is useful
760 /// to create an item that forces following items to the end of the toolbar.
761 /// ## `draw`
762 /// whether `self` is drawn as a vertical line
763 #[doc(alias = "gtk_separator_tool_item_set_draw")]
764 fn set_draw(&self, draw: bool) {
765 unsafe {
766 ffi::gtk_separator_tool_item_set_draw(self.as_ref().to_glib_none().0, draw.into_glib());
767 }
768 }
769
770 #[doc(alias = "draw")]
771 fn connect_draw_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
772 unsafe extern "C" fn notify_draw_trampoline<
773 P: IsA<SeparatorToolItem>,
774 F: Fn(&P) + 'static,
775 >(
776 this: *mut ffi::GtkSeparatorToolItem,
777 _param_spec: glib::ffi::gpointer,
778 f: glib::ffi::gpointer,
779 ) {
780 let f: &F = &*(f as *const F);
781 f(SeparatorToolItem::from_glib_borrow(this).unsafe_cast_ref())
782 }
783 unsafe {
784 let f: Box_<F> = Box_::new(f);
785 connect_raw(
786 self.as_ptr() as *mut _,
787 b"notify::draw\0".as_ptr() as *const _,
788 Some(transmute::<_, unsafe extern "C" fn()>(
789 notify_draw_trampoline::<Self, F> as *const (),
790 )),
791 Box_::into_raw(f),
792 )
793 }
794 }
795}
796
797impl<O: IsA<SeparatorToolItem>> SeparatorToolItemExt for O {}
798
799impl fmt::Display for SeparatorToolItem {
800 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
801 f.write_str("SeparatorToolItem")
802 }
803}