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 ffi, Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, LayoutManager,
11 Orientable, Orientation, Overflow, ScaleButton, Widget,
12};
13use glib::{
14 prelude::*,
15 signal::{connect_raw, SignalHandlerId},
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 let f: &F = &*(f as *const F);
485 f(&from_glib_borrow(this))
486 }
487 unsafe {
488 let f: Box_<F> = Box_::new(f);
489 connect_raw(
490 self.as_ptr() as *mut _,
491 c"notify::use-symbolic".as_ptr() as *const _,
492 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
493 notify_use_symbolic_trampoline::<F> as *const (),
494 )),
495 Box_::into_raw(f),
496 )
497 }
498 }
499}
500
501impl Default for VolumeButton {
502 fn default() -> Self {
503 Self::new()
504 }
505}
506
507// rustdoc-stripper-ignore-next
508/// A [builder-pattern] type to construct [`VolumeButton`] objects.
509///
510/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
511#[must_use = "The builder must be built to be used"]
512pub struct VolumeButtonBuilder {
513 builder: glib::object::ObjectBuilder<'static, VolumeButton>,
514}
515
516impl VolumeButtonBuilder {
517 fn new() -> Self {
518 Self {
519 builder: glib::object::Object::builder(),
520 }
521 }
522
523 /// Whether to use symbolic icons as the icons.
524 ///
525 /// Note that if the symbolic icons are not available in your installed
526 /// theme, then the normal (potentially colorful) icons will be used.
527 /// This widget will be removed in GTK 5
528 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
529 pub fn use_symbolic(self, use_symbolic: bool) -> Self {
530 Self {
531 builder: self.builder.property("use-symbolic", use_symbolic),
532 }
533 }
534
535 /// The [`Adjustment`][crate::Adjustment] that is used as the model.
536 pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
537 Self {
538 builder: self
539 .builder
540 .property("adjustment", adjustment.clone().upcast()),
541 }
542 }
543
544 /// If the scale button has a frame.
545 #[cfg(feature = "v4_14")]
546 #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
547 pub fn has_frame(self, has_frame: bool) -> Self {
548 Self {
549 builder: self.builder.property("has-frame", has_frame),
550 }
551 }
552
553 /// The names of the icons to be used by the scale button.
554 ///
555 /// The first item in the array will be used in the button
556 /// when the current value is the lowest value, the second
557 /// item for the highest value. All the subsequent icons will
558 /// be used for all the other values, spread evenly over the
559 /// range of values.
560 ///
561 /// If there's only one icon name in the @icons array, it will
562 /// be used for all the values. If only two icon names are in
563 /// the @icons array, the first one will be used for the bottom
564 /// 50% of the scale, and the second one for the top 50%.
565 ///
566 /// It is recommended to use at least 3 icons so that the
567 /// [`ScaleButton`][crate::ScaleButton] reflects the current value of the scale
568 /// better for the users.
569 pub fn icons(self, icons: impl Into<glib::StrV>) -> Self {
570 Self {
571 builder: self.builder.property("icons", icons.into()),
572 }
573 }
574
575 /// The value of the scale.
576 pub fn value(self, value: f64) -> Self {
577 Self {
578 builder: self.builder.property("value", value),
579 }
580 }
581
582 /// Whether the widget or any of its descendents can accept
583 /// the input focus.
584 ///
585 /// This property is meant to be set by widget implementations,
586 /// typically in their instance init function.
587 pub fn can_focus(self, can_focus: bool) -> Self {
588 Self {
589 builder: self.builder.property("can-focus", can_focus),
590 }
591 }
592
593 /// Whether the widget can receive pointer events.
594 pub fn can_target(self, can_target: bool) -> Self {
595 Self {
596 builder: self.builder.property("can-target", can_target),
597 }
598 }
599
600 /// A list of css classes applied to this widget.
601 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
602 Self {
603 builder: self.builder.property("css-classes", css_classes.into()),
604 }
605 }
606
607 /// The name of this widget in the CSS tree.
608 ///
609 /// This property is meant to be set by widget implementations,
610 /// typically in their instance init function.
611 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
612 Self {
613 builder: self.builder.property("css-name", css_name.into()),
614 }
615 }
616
617 /// The cursor used by @widget.
618 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
619 Self {
620 builder: self.builder.property("cursor", cursor.clone()),
621 }
622 }
623
624 /// Whether the widget should grab focus when it is clicked with the mouse.
625 ///
626 /// This property is only relevant for widgets that can take focus.
627 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
628 Self {
629 builder: self.builder.property("focus-on-click", focus_on_click),
630 }
631 }
632
633 /// Whether this widget itself will accept the input focus.
634 pub fn focusable(self, focusable: bool) -> Self {
635 Self {
636 builder: self.builder.property("focusable", focusable),
637 }
638 }
639
640 /// How to distribute horizontal space if widget gets extra space.
641 pub fn halign(self, halign: Align) -> Self {
642 Self {
643 builder: self.builder.property("halign", halign),
644 }
645 }
646
647 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
648 /// signal on @widget.
649 ///
650 /// A true value indicates that @widget can have a tooltip, in this case
651 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
652 /// determine whether it will provide a tooltip or not.
653 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
654 Self {
655 builder: self.builder.property("has-tooltip", has_tooltip),
656 }
657 }
658
659 /// Overrides for height request of the widget.
660 ///
661 /// If this is -1, the natural request will be used.
662 pub fn height_request(self, height_request: i32) -> Self {
663 Self {
664 builder: self.builder.property("height-request", height_request),
665 }
666 }
667
668 /// Whether to expand horizontally.
669 pub fn hexpand(self, hexpand: bool) -> Self {
670 Self {
671 builder: self.builder.property("hexpand", hexpand),
672 }
673 }
674
675 /// Whether to use the `hexpand` property.
676 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
677 Self {
678 builder: self.builder.property("hexpand-set", hexpand_set),
679 }
680 }
681
682 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
683 /// the preferred size of the widget, and allocate its children.
684 ///
685 /// This property is meant to be set by widget implementations,
686 /// typically in their instance init function.
687 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
688 Self {
689 builder: self
690 .builder
691 .property("layout-manager", layout_manager.clone().upcast()),
692 }
693 }
694
695 /// Makes this widget act like a modal dialog, with respect to
696 /// event delivery.
697 ///
698 /// Global event controllers will not handle events with targets
699 /// inside the widget, unless they are set up to ignore propagation
700 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
701 #[cfg(feature = "v4_18")]
702 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
703 pub fn limit_events(self, limit_events: bool) -> Self {
704 Self {
705 builder: self.builder.property("limit-events", limit_events),
706 }
707 }
708
709 /// Margin on bottom side of widget.
710 ///
711 /// This property adds margin outside of the widget's normal size
712 /// request, the margin will be added in addition to the size from
713 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
714 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
715 Self {
716 builder: self.builder.property("margin-bottom", margin_bottom),
717 }
718 }
719
720 /// Margin on end of widget, horizontally.
721 ///
722 /// This property supports left-to-right and right-to-left text
723 /// directions.
724 ///
725 /// This property adds margin outside of the widget's normal size
726 /// request, the margin will be added in addition to the size from
727 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
728 pub fn margin_end(self, margin_end: i32) -> Self {
729 Self {
730 builder: self.builder.property("margin-end", margin_end),
731 }
732 }
733
734 /// Margin on start of widget, horizontally.
735 ///
736 /// This property supports left-to-right and right-to-left text
737 /// directions.
738 ///
739 /// This property adds margin outside of the widget's normal size
740 /// request, the margin will be added in addition to the size from
741 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
742 pub fn margin_start(self, margin_start: i32) -> Self {
743 Self {
744 builder: self.builder.property("margin-start", margin_start),
745 }
746 }
747
748 /// Margin on top side of widget.
749 ///
750 /// This property adds margin outside of the widget's normal size
751 /// request, the margin will be added in addition to the size from
752 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
753 pub fn margin_top(self, margin_top: i32) -> Self {
754 Self {
755 builder: self.builder.property("margin-top", margin_top),
756 }
757 }
758
759 /// The name of the widget.
760 pub fn name(self, name: impl Into<glib::GString>) -> Self {
761 Self {
762 builder: self.builder.property("name", name.into()),
763 }
764 }
765
766 /// The requested opacity of the widget.
767 pub fn opacity(self, opacity: f64) -> Self {
768 Self {
769 builder: self.builder.property("opacity", opacity),
770 }
771 }
772
773 /// How content outside the widget's content area is treated.
774 ///
775 /// This property is meant to be set by widget implementations,
776 /// typically in their instance init function.
777 pub fn overflow(self, overflow: Overflow) -> Self {
778 Self {
779 builder: self.builder.property("overflow", overflow),
780 }
781 }
782
783 /// Whether the widget will receive the default action when it is focused.
784 pub fn receives_default(self, receives_default: bool) -> Self {
785 Self {
786 builder: self.builder.property("receives-default", receives_default),
787 }
788 }
789
790 /// Whether the widget responds to input.
791 pub fn sensitive(self, sensitive: bool) -> Self {
792 Self {
793 builder: self.builder.property("sensitive", sensitive),
794 }
795 }
796
797 /// Sets the text of tooltip to be the given string, which is marked up
798 /// with Pango markup.
799 ///
800 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
801 ///
802 /// This is a convenience property which will take care of getting the
803 /// tooltip shown if the given string is not `NULL`:
804 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
805 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
806 /// the default signal handler.
807 ///
808 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
809 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
810 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
811 Self {
812 builder: self
813 .builder
814 .property("tooltip-markup", tooltip_markup.into()),
815 }
816 }
817
818 /// Sets the text of tooltip to be the given string.
819 ///
820 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
821 ///
822 /// This is a convenience property which will take care of getting the
823 /// tooltip shown if the given string is not `NULL`:
824 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
825 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
826 /// the default signal handler.
827 ///
828 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
829 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
830 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
831 Self {
832 builder: self.builder.property("tooltip-text", tooltip_text.into()),
833 }
834 }
835
836 /// How to distribute vertical space if widget gets extra space.
837 pub fn valign(self, valign: Align) -> Self {
838 Self {
839 builder: self.builder.property("valign", valign),
840 }
841 }
842
843 /// Whether to expand vertically.
844 pub fn vexpand(self, vexpand: bool) -> Self {
845 Self {
846 builder: self.builder.property("vexpand", vexpand),
847 }
848 }
849
850 /// Whether to use the `vexpand` property.
851 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
852 Self {
853 builder: self.builder.property("vexpand-set", vexpand_set),
854 }
855 }
856
857 /// Whether the widget is visible.
858 pub fn visible(self, visible: bool) -> Self {
859 Self {
860 builder: self.builder.property("visible", visible),
861 }
862 }
863
864 /// Overrides for width request of the widget.
865 ///
866 /// If this is -1, the natural request will be used.
867 pub fn width_request(self, width_request: i32) -> Self {
868 Self {
869 builder: self.builder.property("width-request", width_request),
870 }
871 }
872
873 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
874 ///
875 /// The accessible role cannot be changed once set.
876 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
877 Self {
878 builder: self.builder.property("accessible-role", accessible_role),
879 }
880 }
881
882 /// The orientation of the orientable.
883 pub fn orientation(self, orientation: Orientation) -> Self {
884 Self {
885 builder: self.builder.property("orientation", orientation),
886 }
887 }
888
889 // rustdoc-stripper-ignore-next
890 /// Build the [`VolumeButton`].
891 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
892 pub fn build(self) -> VolumeButton {
893 assert_initialized_main_thread!();
894 self.builder.build()
895 }
896}