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