Skip to main content

gtk4/auto/
scrollbar.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
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::{Accessible, AccessibleRange};
8use crate::{
9    AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, LayoutManager, Orientable,
10    Orientation, Overflow, Widget, ffi,
11};
12use glib::{
13    prelude::*,
14    signal::{SignalHandlerId, connect_raw},
15    translate::*,
16};
17use std::boxed::Box as Box_;
18
19#[cfg(feature = "v4_10")]
20#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
21glib::wrapper! {
22    ///  slider
23    /// ```text
24    ///
25    /// [`Scrollbar`][crate::Scrollbar] has a main CSS node with name scrollbar and a subnode for its
26    /// contents. The main node gets the .horizontal or .vertical style classes applied,
27    /// depending on the scrollbar's orientation.
28    ///
29    /// The range node gets the style class .fine-tune added when the scrollbar is
30    /// in 'fine-tuning' mode.
31    ///
32    /// Other style classes that may be added to scrollbars inside
33    /// [`ScrolledWindow`][crate::ScrolledWindow] include the positional classes (.left, .right,
34    /// .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator,
35    /// .dragging, .hovering).
36    ///
37    /// # Accessibility
38    ///
39    /// [`Scrollbar`][crate::Scrollbar] uses the [enum@Gtk.AccessibleRole.scrollbar] role.
40    ///
41    /// ## Properties
42    ///
43    ///
44    /// #### `adjustment`
45    ///  The [`Adjustment`][crate::Adjustment] controlled by this scrollbar.
46    ///
47    /// Readable | Writable | Construct
48    /// <details><summary><h4>Widget</h4></summary>
49    ///
50    ///
51    /// #### `can-focus`
52    ///  Whether the widget or any of its descendents can accept
53    /// the input focus.
54    ///
55    /// This property is meant to be set by widget implementations,
56    /// typically in their instance init function.
57    ///
58    /// Readable | Writable
59    ///
60    ///
61    /// #### `can-target`
62    ///  Whether the widget can receive pointer events.
63    ///
64    /// Readable | Writable
65    ///
66    ///
67    /// #### `css-classes`
68    ///  A list of css classes applied to this widget.
69    ///
70    /// Readable | Writable
71    ///
72    ///
73    /// #### `css-name`
74    ///  The name of this widget in the CSS tree.
75    ///
76    /// This property is meant to be set by widget implementations,
77    /// typically in their instance init function.
78    ///
79    /// Readable | Writable | Construct Only
80    ///
81    ///
82    /// #### `cursor`
83    ///  The cursor used by @widget.
84    ///
85    /// Readable | Writable
86    ///
87    ///
88    /// #### `focus-on-click`
89    ///  Whether the widget should grab focus when it is clicked with the mouse.
90    ///
91    /// This property is only relevant for widgets that can take focus.
92    ///
93    /// Readable | Writable
94    ///
95    ///
96    /// #### `focusable`
97    ///  Whether this widget itself will accept the input focus.
98    ///
99    /// Readable | Writable
100    ///
101    ///
102    /// #### `halign`
103    ///  How to distribute horizontal space if widget gets extra space.
104    ///
105    /// Readable | Writable
106    ///
107    ///
108    /// #### `has-default`
109    ///  Whether the widget is the default widget.
110    ///
111    /// Readable
112    ///
113    ///
114    /// #### `has-focus`
115    ///  Whether the widget has the input focus.
116    ///
117    /// Readable
118    ///
119    ///
120    /// #### `has-tooltip`
121    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
122    /// signal on @widget.
123    ///
124    /// A true value indicates that @widget can have a tooltip, in this case
125    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
126    /// determine whether it will provide a tooltip or not.
127    ///
128    /// Readable | Writable
129    ///
130    ///
131    /// #### `height-request`
132    ///  Overrides for height request of the widget.
133    ///
134    /// If this is -1, the natural request will be used.
135    ///
136    /// Readable | Writable
137    ///
138    ///
139    /// #### `hexpand`
140    ///  Whether to expand horizontally.
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `hexpand-set`
146    ///  Whether to use the `hexpand` property.
147    ///
148    /// Readable | Writable
149    ///
150    ///
151    /// #### `layout-manager`
152    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
153    /// the preferred size of the widget, and allocate its children.
154    ///
155    /// This property is meant to be set by widget implementations,
156    /// typically in their instance init function.
157    ///
158    /// Readable | Writable
159    ///
160    ///
161    /// #### `limit-events`
162    ///  Makes this widget act like a modal dialog, with respect to
163    /// event delivery.
164    ///
165    /// Global event controllers will not handle events with targets
166    /// inside the widget, unless they are set up to ignore propagation
167    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
168    ///
169    /// Readable | Writable
170    ///
171    ///
172    /// #### `margin-bottom`
173    ///  Margin on bottom side of widget.
174    ///
175    /// This property adds margin outside of the widget's normal size
176    /// request, the margin will be added in addition to the size from
177    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
178    ///
179    /// Readable | Writable
180    ///
181    ///
182    /// #### `margin-end`
183    ///  Margin on end of widget, horizontally.
184    ///
185    /// This property supports left-to-right and right-to-left text
186    /// directions.
187    ///
188    /// This property adds margin outside of the widget's normal size
189    /// request, the margin will be added in addition to the size from
190    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
191    ///
192    /// Readable | Writable
193    ///
194    ///
195    /// #### `margin-start`
196    ///  Margin on start of widget, horizontally.
197    ///
198    /// This property supports left-to-right and right-to-left text
199    /// directions.
200    ///
201    /// This property adds margin outside of the widget's normal size
202    /// request, the margin will be added in addition to the size from
203    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
204    ///
205    /// Readable | Writable
206    ///
207    ///
208    /// #### `margin-top`
209    ///  Margin on top side of widget.
210    ///
211    /// This property adds margin outside of the widget's normal size
212    /// request, the margin will be added in addition to the size from
213    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
214    ///
215    /// Readable | Writable
216    ///
217    ///
218    /// #### `name`
219    ///  The name of the widget.
220    ///
221    /// Readable | Writable
222    ///
223    ///
224    /// #### `opacity`
225    ///  The requested opacity of the widget.
226    ///
227    /// Readable | Writable
228    ///
229    ///
230    /// #### `overflow`
231    ///  How content outside the widget's content area is treated.
232    ///
233    /// This property is meant to be set by widget implementations,
234    /// typically in their instance init function.
235    ///
236    /// Readable | Writable
237    ///
238    ///
239    /// #### `parent`
240    ///  The parent widget of this widget.
241    ///
242    /// Readable
243    ///
244    ///
245    /// #### `receives-default`
246    ///  Whether the widget will receive the default action when it is focused.
247    ///
248    /// Readable | Writable
249    ///
250    ///
251    /// #### `root`
252    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
253    ///
254    /// This will be `NULL` if the widget is not contained in a root widget.
255    ///
256    /// Readable
257    ///
258    ///
259    /// #### `scale-factor`
260    ///  The scale factor of the widget.
261    ///
262    /// Readable
263    ///
264    ///
265    /// #### `sensitive`
266    ///  Whether the widget responds to input.
267    ///
268    /// Readable | Writable
269    ///
270    ///
271    /// #### `tooltip-markup`
272    ///  Sets the text of tooltip to be the given string, which is marked up
273    /// with Pango markup.
274    ///
275    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
276    ///
277    /// This is a convenience property which will take care of getting the
278    /// tooltip shown if the given string is not `NULL`:
279    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
280    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
281    /// the default signal handler.
282    ///
283    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
284    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
285    ///
286    /// Readable | Writable
287    ///
288    ///
289    /// #### `tooltip-text`
290    ///  Sets the text of tooltip to be the given string.
291    ///
292    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
293    ///
294    /// This is a convenience property which will take care of getting the
295    /// tooltip shown if the given string is not `NULL`:
296    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
297    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
298    /// the default signal handler.
299    ///
300    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
301    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
302    ///
303    /// Readable | Writable
304    ///
305    ///
306    /// #### `valign`
307    ///  How to distribute vertical space if widget gets extra space.
308    ///
309    /// Readable | Writable
310    ///
311    ///
312    /// #### `vexpand`
313    ///  Whether to expand vertically.
314    ///
315    /// Readable | Writable
316    ///
317    ///
318    /// #### `vexpand-set`
319    ///  Whether to use the `vexpand` property.
320    ///
321    /// Readable | Writable
322    ///
323    ///
324    /// #### `visible`
325    ///  Whether the widget is visible.
326    ///
327    /// Readable | Writable
328    ///
329    ///
330    /// #### `width-request`
331    ///  Overrides for width request of the widget.
332    ///
333    /// If this is -1, the natural request will be used.
334    ///
335    /// Readable | Writable
336    /// </details>
337    /// <details><summary><h4>Accessible</h4></summary>
338    ///
339    ///
340    /// #### `accessible-role`
341    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
342    ///
343    /// The accessible role cannot be changed once set.
344    ///
345    /// Readable | Writable
346    /// </details>
347    /// <details><summary><h4>Orientable</h4></summary>
348    ///
349    ///
350    /// #### `orientation`
351    ///  The orientation of the orientable.
352    ///
353    /// Readable | Writable
354    /// </details>
355    ///
356    /// # Implements
357    ///
358    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AccessibleRangeExt`][trait@crate::prelude::AccessibleRangeExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
359    #[doc(alias = "GtkScrollbar")]
360    pub struct Scrollbar(Object<ffi::GtkScrollbar>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleRange, Orientable;
361
362    match fn {
363        type_ => || ffi::gtk_scrollbar_get_type(),
364    }
365}
366
367#[cfg(not(feature = "v4_10"))]
368glib::wrapper! {
369    #[doc(alias = "GtkScrollbar")]
370    pub struct Scrollbar(Object<ffi::GtkScrollbar>) @extends Widget, @implements Buildable, ConstraintTarget, Orientable;
371
372    match fn {
373        type_ => || ffi::gtk_scrollbar_get_type(),
374    }
375}
376
377impl Scrollbar {
378    /// Creates a new scrollbar with the given orientation.
379    /// ## `orientation`
380    /// s orientation.
381    /// ## `adjustment`
382    /// the [`Adjustment`][crate::Adjustment] to use, or [`None`]
383    ///   to create a new adjustment.
384    ///
385    /// # Returns
386    ///
387    /// the new [`Scrollbar`][crate::Scrollbar].
388    #[doc(alias = "gtk_scrollbar_new")]
389    pub fn new(orientation: Orientation, adjustment: Option<&impl IsA<Adjustment>>) -> Scrollbar {
390        assert_initialized_main_thread!();
391        unsafe {
392            Widget::from_glib_none(ffi::gtk_scrollbar_new(
393                orientation.into_glib(),
394                adjustment.map(|p| p.as_ref()).to_glib_none().0,
395            ))
396            .unsafe_cast()
397        }
398    }
399
400    // rustdoc-stripper-ignore-next
401    /// Creates a new builder-pattern struct instance to construct [`Scrollbar`] objects.
402    ///
403    /// This method returns an instance of [`ScrollbarBuilder`](crate::builders::ScrollbarBuilder) which can be used to create [`Scrollbar`] objects.
404    pub fn builder() -> ScrollbarBuilder {
405        ScrollbarBuilder::new()
406    }
407
408    /// Returns the scrollbar's adjustment.
409    ///
410    /// # Returns
411    ///
412    /// the scrollbar's adjustment
413    #[doc(alias = "gtk_scrollbar_get_adjustment")]
414    #[doc(alias = "get_adjustment")]
415    pub fn adjustment(&self) -> Adjustment {
416        unsafe { from_glib_none(ffi::gtk_scrollbar_get_adjustment(self.to_glib_none().0)) }
417    }
418
419    /// Makes the scrollbar use the given adjustment.
420    /// ## `adjustment`
421    /// the adjustment to set
422    #[doc(alias = "gtk_scrollbar_set_adjustment")]
423    #[doc(alias = "adjustment")]
424    pub fn set_adjustment(&self, adjustment: Option<&impl IsA<Adjustment>>) {
425        unsafe {
426            ffi::gtk_scrollbar_set_adjustment(
427                self.to_glib_none().0,
428                adjustment.map(|p| p.as_ref()).to_glib_none().0,
429            );
430        }
431    }
432
433    #[doc(alias = "adjustment")]
434    pub fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
435        unsafe extern "C" fn notify_adjustment_trampoline<F: Fn(&Scrollbar) + 'static>(
436            this: *mut ffi::GtkScrollbar,
437            _param_spec: glib::ffi::gpointer,
438            f: glib::ffi::gpointer,
439        ) {
440            unsafe {
441                let f: &F = &*(f as *const F);
442                f(&from_glib_borrow(this))
443            }
444        }
445        unsafe {
446            let f: Box_<F> = Box_::new(f);
447            connect_raw(
448                self.as_ptr() as *mut _,
449                c"notify::adjustment".as_ptr(),
450                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
451                    notify_adjustment_trampoline::<F> as *const (),
452                )),
453                Box_::into_raw(f),
454            )
455        }
456    }
457}
458
459impl Default for Scrollbar {
460    fn default() -> Self {
461        glib::object::Object::new::<Self>()
462    }
463}
464
465// rustdoc-stripper-ignore-next
466/// A [builder-pattern] type to construct [`Scrollbar`] objects.
467///
468/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
469#[must_use = "The builder must be built to be used"]
470pub struct ScrollbarBuilder {
471    builder: glib::object::ObjectBuilder<'static, Scrollbar>,
472}
473
474impl ScrollbarBuilder {
475    fn new() -> Self {
476        Self {
477            builder: glib::object::Object::builder(),
478        }
479    }
480
481    /// The [`Adjustment`][crate::Adjustment] controlled by this scrollbar.
482    pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
483        Self {
484            builder: self
485                .builder
486                .property("adjustment", adjustment.clone().upcast()),
487        }
488    }
489
490    /// Whether the widget or any of its descendents can accept
491    /// the input focus.
492    ///
493    /// This property is meant to be set by widget implementations,
494    /// typically in their instance init function.
495    pub fn can_focus(self, can_focus: bool) -> Self {
496        Self {
497            builder: self.builder.property("can-focus", can_focus),
498        }
499    }
500
501    /// Whether the widget can receive pointer events.
502    pub fn can_target(self, can_target: bool) -> Self {
503        Self {
504            builder: self.builder.property("can-target", can_target),
505        }
506    }
507
508    /// A list of css classes applied to this widget.
509    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
510        Self {
511            builder: self.builder.property("css-classes", css_classes.into()),
512        }
513    }
514
515    /// The name of this widget in the CSS tree.
516    ///
517    /// This property is meant to be set by widget implementations,
518    /// typically in their instance init function.
519    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
520        Self {
521            builder: self.builder.property("css-name", css_name.into()),
522        }
523    }
524
525    /// The cursor used by @widget.
526    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
527        Self {
528            builder: self.builder.property("cursor", cursor.clone()),
529        }
530    }
531
532    /// Whether the widget should grab focus when it is clicked with the mouse.
533    ///
534    /// This property is only relevant for widgets that can take focus.
535    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
536        Self {
537            builder: self.builder.property("focus-on-click", focus_on_click),
538        }
539    }
540
541    /// Whether this widget itself will accept the input focus.
542    pub fn focusable(self, focusable: bool) -> Self {
543        Self {
544            builder: self.builder.property("focusable", focusable),
545        }
546    }
547
548    /// How to distribute horizontal space if widget gets extra space.
549    pub fn halign(self, halign: Align) -> Self {
550        Self {
551            builder: self.builder.property("halign", halign),
552        }
553    }
554
555    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
556    /// signal on @widget.
557    ///
558    /// A true value indicates that @widget can have a tooltip, in this case
559    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
560    /// determine whether it will provide a tooltip or not.
561    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
562        Self {
563            builder: self.builder.property("has-tooltip", has_tooltip),
564        }
565    }
566
567    /// Overrides for height request of the widget.
568    ///
569    /// If this is -1, the natural request will be used.
570    pub fn height_request(self, height_request: i32) -> Self {
571        Self {
572            builder: self.builder.property("height-request", height_request),
573        }
574    }
575
576    /// Whether to expand horizontally.
577    pub fn hexpand(self, hexpand: bool) -> Self {
578        Self {
579            builder: self.builder.property("hexpand", hexpand),
580        }
581    }
582
583    /// Whether to use the `hexpand` property.
584    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
585        Self {
586            builder: self.builder.property("hexpand-set", hexpand_set),
587        }
588    }
589
590    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
591    /// the preferred size of the widget, and allocate its children.
592    ///
593    /// This property is meant to be set by widget implementations,
594    /// typically in their instance init function.
595    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
596        Self {
597            builder: self
598                .builder
599                .property("layout-manager", layout_manager.clone().upcast()),
600        }
601    }
602
603    /// Makes this widget act like a modal dialog, with respect to
604    /// event delivery.
605    ///
606    /// Global event controllers will not handle events with targets
607    /// inside the widget, unless they are set up to ignore propagation
608    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
609    #[cfg(feature = "v4_18")]
610    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
611    pub fn limit_events(self, limit_events: bool) -> Self {
612        Self {
613            builder: self.builder.property("limit-events", limit_events),
614        }
615    }
616
617    /// Margin on bottom side of widget.
618    ///
619    /// This property adds margin outside of the widget's normal size
620    /// request, the margin will be added in addition to the size from
621    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
622    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
623        Self {
624            builder: self.builder.property("margin-bottom", margin_bottom),
625        }
626    }
627
628    /// Margin on end of widget, horizontally.
629    ///
630    /// This property supports left-to-right and right-to-left text
631    /// directions.
632    ///
633    /// This property adds margin outside of the widget's normal size
634    /// request, the margin will be added in addition to the size from
635    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
636    pub fn margin_end(self, margin_end: i32) -> Self {
637        Self {
638            builder: self.builder.property("margin-end", margin_end),
639        }
640    }
641
642    /// Margin on start of widget, horizontally.
643    ///
644    /// This property supports left-to-right and right-to-left text
645    /// directions.
646    ///
647    /// This property adds margin outside of the widget's normal size
648    /// request, the margin will be added in addition to the size from
649    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
650    pub fn margin_start(self, margin_start: i32) -> Self {
651        Self {
652            builder: self.builder.property("margin-start", margin_start),
653        }
654    }
655
656    /// Margin on top side of widget.
657    ///
658    /// This property adds margin outside of the widget's normal size
659    /// request, the margin will be added in addition to the size from
660    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
661    pub fn margin_top(self, margin_top: i32) -> Self {
662        Self {
663            builder: self.builder.property("margin-top", margin_top),
664        }
665    }
666
667    /// The name of the widget.
668    pub fn name(self, name: impl Into<glib::GString>) -> Self {
669        Self {
670            builder: self.builder.property("name", name.into()),
671        }
672    }
673
674    /// The requested opacity of the widget.
675    pub fn opacity(self, opacity: f64) -> Self {
676        Self {
677            builder: self.builder.property("opacity", opacity),
678        }
679    }
680
681    /// How content outside the widget's content area is treated.
682    ///
683    /// This property is meant to be set by widget implementations,
684    /// typically in their instance init function.
685    pub fn overflow(self, overflow: Overflow) -> Self {
686        Self {
687            builder: self.builder.property("overflow", overflow),
688        }
689    }
690
691    /// Whether the widget will receive the default action when it is focused.
692    pub fn receives_default(self, receives_default: bool) -> Self {
693        Self {
694            builder: self.builder.property("receives-default", receives_default),
695        }
696    }
697
698    /// Whether the widget responds to input.
699    pub fn sensitive(self, sensitive: bool) -> Self {
700        Self {
701            builder: self.builder.property("sensitive", sensitive),
702        }
703    }
704
705    /// Sets the text of tooltip to be the given string, which is marked up
706    /// with Pango markup.
707    ///
708    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
709    ///
710    /// This is a convenience property which will take care of getting the
711    /// tooltip shown if the given string is not `NULL`:
712    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
713    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
714    /// the default signal handler.
715    ///
716    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
717    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
718    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
719        Self {
720            builder: self
721                .builder
722                .property("tooltip-markup", tooltip_markup.into()),
723        }
724    }
725
726    /// Sets the text of tooltip to be the given string.
727    ///
728    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
729    ///
730    /// This is a convenience property which will take care of getting the
731    /// tooltip shown if the given string is not `NULL`:
732    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
733    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
734    /// the default signal handler.
735    ///
736    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
737    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
738    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
739        Self {
740            builder: self.builder.property("tooltip-text", tooltip_text.into()),
741        }
742    }
743
744    /// How to distribute vertical space if widget gets extra space.
745    pub fn valign(self, valign: Align) -> Self {
746        Self {
747            builder: self.builder.property("valign", valign),
748        }
749    }
750
751    /// Whether to expand vertically.
752    pub fn vexpand(self, vexpand: bool) -> Self {
753        Self {
754            builder: self.builder.property("vexpand", vexpand),
755        }
756    }
757
758    /// Whether to use the `vexpand` property.
759    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
760        Self {
761            builder: self.builder.property("vexpand-set", vexpand_set),
762        }
763    }
764
765    /// Whether the widget is visible.
766    pub fn visible(self, visible: bool) -> Self {
767        Self {
768            builder: self.builder.property("visible", visible),
769        }
770    }
771
772    /// Overrides for width request of the widget.
773    ///
774    /// If this is -1, the natural request will be used.
775    pub fn width_request(self, width_request: i32) -> Self {
776        Self {
777            builder: self.builder.property("width-request", width_request),
778        }
779    }
780
781    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
782    ///
783    /// The accessible role cannot be changed once set.
784    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
785        Self {
786            builder: self.builder.property("accessible-role", accessible_role),
787        }
788    }
789
790    /// The orientation of the orientable.
791    pub fn orientation(self, orientation: Orientation) -> Self {
792        Self {
793            builder: self.builder.property("orientation", orientation),
794        }
795    }
796
797    // rustdoc-stripper-ignore-next
798    /// Build the [`Scrollbar`].
799    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
800    pub fn build(self) -> Scrollbar {
801        assert_initialized_main_thread!();
802        self.builder.build()
803    }
804}