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