Skip to main content

gtk/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
5use crate::{
6    Actionable, Adjustment, Align, Bin, Buildable, Button, Container, IconSize, Orientable,
7    Orientation, PositionType, ReliefStyle, ResizeMode, ScaleButton, Widget,
8};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::{boxed::Box as Box_, fmt, mem::transmute};
15
16glib::wrapper! {
17    /// [`VolumeButton`][crate::VolumeButton] is a subclass of [`ScaleButton`][crate::ScaleButton] that has
18    /// been tailored for use as a volume control widget with suitable
19    /// icons, tooltips and accessible labels.
20    ///
21    /// ## Properties
22    ///
23    ///
24    /// #### `use-symbolic`
25    ///  Whether to use symbolic icons as the icons. Note that
26    /// if the symbolic icons are not available in your installed
27    /// theme, then the normal (potentially colorful) icons will
28    /// be used.
29    ///
30    /// Readable | Writeable | Construct
31    /// <details><summary><h4>ScaleButton</h4></summary>
32    ///
33    ///
34    /// #### `adjustment`
35    ///  Readable | Writeable
36    ///
37    ///
38    /// #### `icons`
39    ///  The names of the icons to be used by the scale button.
40    /// The first item in the array will be used in the button
41    /// when the current value is the lowest value, the second
42    /// item for the highest value. All the subsequent icons will
43    /// be used for all the other values, spread evenly over the
44    /// range of values.
45    ///
46    /// If there's only one icon name in the `icons` array, it will
47    /// be used for all the values. If only two icon names are in
48    /// the `icons` array, the first one will be used for the bottom
49    /// 50% of the scale, and the second one for the top 50%.
50    ///
51    /// It is recommended to use at least 3 icons so that the
52    /// [`ScaleButton`][crate::ScaleButton] reflects the current value of the scale
53    /// better for the users.
54    ///
55    /// Readable | Writeable
56    ///
57    ///
58    /// #### `size`
59    ///  Readable | Writeable
60    ///
61    ///
62    /// #### `value`
63    ///  Readable | Writeable
64    /// </details>
65    /// <details><summary><h4>Button</h4></summary>
66    ///
67    ///
68    /// #### `always-show-image`
69    ///  If [`true`], the button will ignore the [`gtk-button-images`][struct@crate::Settings#gtk-button-images]
70    /// setting and always show the image, if available.
71    ///
72    /// Use this property if the button would be useless or hard to use
73    /// without the image.
74    ///
75    /// Readable | Writeable | Construct
76    ///
77    ///
78    /// #### `image`
79    ///  The child widget to appear next to the button text.
80    ///
81    /// Readable | Writeable
82    ///
83    ///
84    /// #### `image-position`
85    ///  The position of the image relative to the text inside the button.
86    ///
87    /// Readable | Writeable
88    ///
89    ///
90    /// #### `label`
91    ///  Readable | Writeable | Construct
92    ///
93    ///
94    /// #### `relief`
95    ///  Readable | Writeable
96    ///
97    ///
98    /// #### `use-stock`
99    ///  Readable | Writeable | Construct
100    ///
101    ///
102    /// #### `use-underline`
103    ///  Readable | Writeable | Construct
104    ///
105    ///
106    /// #### `xalign`
107    ///  If the child of the button is a [`Misc`][crate::Misc] or `GtkAlignment`, this property
108    /// can be used to control its horizontal alignment. 0.0 is left aligned,
109    /// 1.0 is right aligned.
110    ///
111    /// Readable | Writeable
112    ///
113    ///
114    /// #### `yalign`
115    ///  If the child of the button is a [`Misc`][crate::Misc] or `GtkAlignment`, this property
116    /// can be used to control its vertical alignment. 0.0 is top aligned,
117    /// 1.0 is bottom aligned.
118    ///
119    /// Readable | Writeable
120    /// </details>
121    /// <details><summary><h4>Container</h4></summary>
122    ///
123    ///
124    /// #### `border-width`
125    ///  Readable | Writeable
126    ///
127    ///
128    /// #### `child`
129    ///  Writeable
130    ///
131    ///
132    /// #### `resize-mode`
133    ///  Readable | Writeable
134    /// </details>
135    /// <details><summary><h4>Widget</h4></summary>
136    ///
137    ///
138    /// #### `app-paintable`
139    ///  Readable | Writeable
140    ///
141    ///
142    /// #### `can-default`
143    ///  Readable | Writeable
144    ///
145    ///
146    /// #### `can-focus`
147    ///  Readable | Writeable
148    ///
149    ///
150    /// #### `composite-child`
151    ///  Readable
152    ///
153    ///
154    /// #### `double-buffered`
155    ///  Whether the widget is double buffered.
156    ///
157    /// Readable | Writeable
158    ///
159    ///
160    /// #### `events`
161    ///  Readable | Writeable
162    ///
163    ///
164    /// #### `expand`
165    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
166    ///
167    /// Readable | Writeable
168    ///
169    ///
170    /// #### `focus-on-click`
171    ///  Whether the widget should grab focus when it is clicked with the mouse.
172    ///
173    /// This property is only relevant for widgets that can take focus.
174    ///
175    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
176    /// GtkComboBox) implemented this property individually.
177    ///
178    /// Readable | Writeable
179    ///
180    ///
181    /// #### `halign`
182    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
183    ///
184    /// Readable | Writeable
185    ///
186    ///
187    /// #### `has-default`
188    ///  Readable | Writeable
189    ///
190    ///
191    /// #### `has-focus`
192    ///  Readable | Writeable
193    ///
194    ///
195    /// #### `has-tooltip`
196    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
197    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
198    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
199    /// whether it will provide a tooltip or not.
200    ///
201    /// Note that setting this property to [`true`] for the first time will change
202    /// the event masks of the GdkWindows of this widget to include leave-notify
203    /// and motion-notify events. This cannot and will not be undone when the
204    /// property is set to [`false`] again.
205    ///
206    /// Readable | Writeable
207    ///
208    ///
209    /// #### `height-request`
210    ///  Readable | Writeable
211    ///
212    ///
213    /// #### `hexpand`
214    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
215    ///
216    /// Readable | Writeable
217    ///
218    ///
219    /// #### `hexpand-set`
220    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
221    ///
222    /// Readable | Writeable
223    ///
224    ///
225    /// #### `is-focus`
226    ///  Readable | Writeable
227    ///
228    ///
229    /// #### `margin`
230    ///  Sets all four sides' margin at once. If read, returns max
231    /// margin on any side.
232    ///
233    /// Readable | Writeable
234    ///
235    ///
236    /// #### `margin-bottom`
237    ///  Margin on bottom side of widget.
238    ///
239    /// This property adds margin outside of the widget's normal size
240    /// request, the margin will be added in addition to the size from
241    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
242    ///
243    /// Readable | Writeable
244    ///
245    ///
246    /// #### `margin-end`
247    ///  Margin on end of widget, horizontally. This property supports
248    /// left-to-right and right-to-left text directions.
249    ///
250    /// This property adds margin outside of the widget's normal size
251    /// request, the margin will be added in addition to the size from
252    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
253    ///
254    /// Readable | Writeable
255    ///
256    ///
257    /// #### `margin-left`
258    ///  Margin on left side of widget.
259    ///
260    /// This property adds margin outside of the widget's normal size
261    /// request, the margin will be added in addition to the size from
262    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
263    ///
264    /// Readable | Writeable
265    ///
266    ///
267    /// #### `margin-right`
268    ///  Margin on right side of widget.
269    ///
270    /// This property adds margin outside of the widget's normal size
271    /// request, the margin will be added in addition to the size from
272    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
273    ///
274    /// Readable | Writeable
275    ///
276    ///
277    /// #### `margin-start`
278    ///  Margin on start of widget, horizontally. This property supports
279    /// left-to-right and right-to-left text directions.
280    ///
281    /// This property adds margin outside of the widget's normal size
282    /// request, the margin will be added in addition to the size from
283    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
284    ///
285    /// Readable | Writeable
286    ///
287    ///
288    /// #### `margin-top`
289    ///  Margin on top side of widget.
290    ///
291    /// This property adds margin outside of the widget's normal size
292    /// request, the margin will be added in addition to the size from
293    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
294    ///
295    /// Readable | Writeable
296    ///
297    ///
298    /// #### `name`
299    ///  Readable | Writeable
300    ///
301    ///
302    /// #### `no-show-all`
303    ///  Readable | Writeable
304    ///
305    ///
306    /// #### `opacity`
307    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
308    /// more details about window opacity.
309    ///
310    /// Before 3.8 this was only available in GtkWindow
311    ///
312    /// Readable | Writeable
313    ///
314    ///
315    /// #### `parent`
316    ///  Readable | Writeable
317    ///
318    ///
319    /// #### `receives-default`
320    ///  Readable | Writeable
321    ///
322    ///
323    /// #### `scale-factor`
324    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
325    /// more details about widget scaling.
326    ///
327    /// Readable
328    ///
329    ///
330    /// #### `sensitive`
331    ///  Readable | Writeable
332    ///
333    ///
334    /// #### `style`
335    ///  The style of the widget, which contains information about how it will look (colors, etc).
336    ///
337    /// Readable | Writeable
338    ///
339    ///
340    /// #### `tooltip-markup`
341    ///  Sets the text of tooltip to be the given string, which is marked up
342    /// with the [Pango text markup language][PangoMarkupFormat].
343    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
344    ///
345    /// This is a convenience property which will take care of getting the
346    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
347    /// will automatically be set to [`true`] and there will be taken care of
348    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
349    ///
350    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
351    /// are set, the last one wins.
352    ///
353    /// Readable | Writeable
354    ///
355    ///
356    /// #### `tooltip-text`
357    ///  Sets the text of tooltip to be the given string.
358    ///
359    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
360    ///
361    /// This is a convenience property which will take care of getting the
362    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
363    /// will automatically be set to [`true`] and there will be taken care of
364    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
365    ///
366    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
367    /// are set, the last one wins.
368    ///
369    /// Readable | Writeable
370    ///
371    ///
372    /// #### `valign`
373    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
374    ///
375    /// Readable | Writeable
376    ///
377    ///
378    /// #### `vexpand`
379    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
380    ///
381    /// Readable | Writeable
382    ///
383    ///
384    /// #### `vexpand-set`
385    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
386    ///
387    /// Readable | Writeable
388    ///
389    ///
390    /// #### `visible`
391    ///  Readable | Writeable
392    ///
393    ///
394    /// #### `width-request`
395    ///  Readable | Writeable
396    ///
397    ///
398    /// #### `window`
399    ///  The widget's window if it is realized, [`None`] otherwise.
400    ///
401    /// Readable
402    /// </details>
403    /// <details><summary><h4>Actionable</h4></summary>
404    ///
405    ///
406    /// #### `action-name`
407    ///  Readable | Writeable
408    ///
409    ///
410    /// #### `action-target`
411    ///  Readable | Writeable
412    /// </details>
413    /// <details><summary><h4>Activatable</h4></summary>
414    ///
415    ///
416    /// #### `related-action`
417    ///  The action that this activatable will activate and receive
418    /// updates from for various states and possibly appearance.
419    ///
420    /// > `GtkActivatable` implementors need to handle the this property and
421    /// > call `gtk_activatable_do_set_related_action()` when it changes.
422    ///
423    /// Readable | Writeable
424    ///
425    ///
426    /// #### `use-action-appearance`
427    ///  Whether this activatable should reset its layout
428    /// and appearance when setting the related action or when
429    /// the action changes appearance.
430    ///
431    /// See the `GtkAction` documentation directly to find which properties
432    /// should be ignored by the `GtkActivatable` when this property is [`false`].
433    ///
434    /// > `GtkActivatable` implementors need to handle this property
435    /// > and call `gtk_activatable_sync_action_properties()` on the activatable
436    /// > widget when it changes.
437    ///
438    /// Readable | Writeable
439    /// </details>
440    /// <details><summary><h4>Orientable</h4></summary>
441    ///
442    ///
443    /// #### `orientation`
444    ///  The orientation of the orientable.
445    ///
446    /// Readable | Writeable
447    /// </details>
448    ///
449    /// # Implements
450    ///
451    /// [`VolumeButtonExt`][trait@crate::prelude::VolumeButtonExt], [`ScaleButtonExt`][trait@crate::prelude::ScaleButtonExt], [`ButtonExt`][trait@crate::prelude::ButtonExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
452    #[doc(alias = "GtkVolumeButton")]
453    pub struct VolumeButton(Object<ffi::GtkVolumeButton, ffi::GtkVolumeButtonClass>) @extends ScaleButton, Button, Bin, Container, Widget, @implements Buildable, Actionable, Orientable;
454
455    match fn {
456        type_ => || ffi::gtk_volume_button_get_type(),
457    }
458}
459
460impl VolumeButton {
461    pub const NONE: Option<&'static VolumeButton> = None;
462
463    /// Creates a [`VolumeButton`][crate::VolumeButton], with a range between 0.0 and 1.0, with
464    /// a stepping of 0.02. Volume values can be obtained and modified using
465    /// the functions from [`ScaleButton`][crate::ScaleButton].
466    ///
467    /// # Returns
468    ///
469    /// a new [`VolumeButton`][crate::VolumeButton]
470    #[doc(alias = "gtk_volume_button_new")]
471    pub fn new() -> VolumeButton {
472        assert_initialized_main_thread!();
473        unsafe { Widget::from_glib_none(ffi::gtk_volume_button_new()).unsafe_cast() }
474    }
475
476    // rustdoc-stripper-ignore-next
477    /// Creates a new builder-pattern struct instance to construct [`VolumeButton`] objects.
478    ///
479    /// This method returns an instance of [`VolumeButtonBuilder`](crate::builders::VolumeButtonBuilder) which can be used to create [`VolumeButton`] objects.
480    pub fn builder() -> VolumeButtonBuilder {
481        VolumeButtonBuilder::new()
482    }
483}
484
485impl Default for VolumeButton {
486    fn default() -> Self {
487        Self::new()
488    }
489}
490
491// rustdoc-stripper-ignore-next
492/// A [builder-pattern] type to construct [`VolumeButton`] objects.
493///
494/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
495#[must_use = "The builder must be built to be used"]
496pub struct VolumeButtonBuilder {
497    builder: glib::object::ObjectBuilder<'static, VolumeButton>,
498}
499
500impl VolumeButtonBuilder {
501    fn new() -> Self {
502        Self {
503            builder: glib::object::Object::builder(),
504        }
505    }
506
507    /// Whether to use symbolic icons as the icons. Note that
508    /// if the symbolic icons are not available in your installed
509    /// theme, then the normal (potentially colorful) icons will
510    /// be used.
511    pub fn use_symbolic(self, use_symbolic: bool) -> Self {
512        Self {
513            builder: self.builder.property("use-symbolic", use_symbolic),
514        }
515    }
516
517    pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
518        Self {
519            builder: self
520                .builder
521                .property("adjustment", adjustment.clone().upcast()),
522        }
523    }
524
525    /// The names of the icons to be used by the scale button.
526    /// The first item in the array will be used in the button
527    /// when the current value is the lowest value, the second
528    /// item for the highest value. All the subsequent icons will
529    /// be used for all the other values, spread evenly over the
530    /// range of values.
531    ///
532    /// If there's only one icon name in the `icons` array, it will
533    /// be used for all the values. If only two icon names are in
534    /// the `icons` array, the first one will be used for the bottom
535    /// 50% of the scale, and the second one for the top 50%.
536    ///
537    /// It is recommended to use at least 3 icons so that the
538    /// [`ScaleButton`][crate::ScaleButton] reflects the current value of the scale
539    /// better for the users.
540    pub fn icons(self, icons: impl Into<glib::StrV>) -> Self {
541        Self {
542            builder: self.builder.property("icons", icons.into()),
543        }
544    }
545
546    pub fn size(self, size: IconSize) -> Self {
547        Self {
548            builder: self.builder.property("size", size),
549        }
550    }
551
552    pub fn value(self, value: f64) -> Self {
553        Self {
554            builder: self.builder.property("value", value),
555        }
556    }
557
558    /// If [`true`], the button will ignore the [`gtk-button-images`][struct@crate::Settings#gtk-button-images]
559    /// setting and always show the image, if available.
560    ///
561    /// Use this property if the button would be useless or hard to use
562    /// without the image.
563    pub fn always_show_image(self, always_show_image: bool) -> Self {
564        Self {
565            builder: self
566                .builder
567                .property("always-show-image", always_show_image),
568        }
569    }
570
571    /// The child widget to appear next to the button text.
572    pub fn image(self, image: &impl IsA<Widget>) -> Self {
573        Self {
574            builder: self.builder.property("image", image.clone().upcast()),
575        }
576    }
577
578    /// The position of the image relative to the text inside the button.
579    pub fn image_position(self, image_position: PositionType) -> Self {
580        Self {
581            builder: self.builder.property("image-position", image_position),
582        }
583    }
584
585    pub fn label(self, label: impl Into<glib::GString>) -> Self {
586        Self {
587            builder: self.builder.property("label", label.into()),
588        }
589    }
590
591    pub fn relief(self, relief: ReliefStyle) -> Self {
592        Self {
593            builder: self.builder.property("relief", relief),
594        }
595    }
596
597    pub fn use_underline(self, use_underline: bool) -> Self {
598        Self {
599            builder: self.builder.property("use-underline", use_underline),
600        }
601    }
602
603    pub fn border_width(self, border_width: u32) -> Self {
604        Self {
605            builder: self.builder.property("border-width", border_width),
606        }
607    }
608
609    pub fn child(self, child: &impl IsA<Widget>) -> Self {
610        Self {
611            builder: self.builder.property("child", child.clone().upcast()),
612        }
613    }
614
615    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
616        Self {
617            builder: self.builder.property("resize-mode", resize_mode),
618        }
619    }
620
621    pub fn app_paintable(self, app_paintable: bool) -> Self {
622        Self {
623            builder: self.builder.property("app-paintable", app_paintable),
624        }
625    }
626
627    pub fn can_default(self, can_default: bool) -> Self {
628        Self {
629            builder: self.builder.property("can-default", can_default),
630        }
631    }
632
633    pub fn can_focus(self, can_focus: bool) -> Self {
634        Self {
635            builder: self.builder.property("can-focus", can_focus),
636        }
637    }
638
639    pub fn events(self, events: gdk::EventMask) -> Self {
640        Self {
641            builder: self.builder.property("events", events),
642        }
643    }
644
645    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
646    pub fn expand(self, expand: bool) -> Self {
647        Self {
648            builder: self.builder.property("expand", expand),
649        }
650    }
651
652    /// Whether the widget should grab focus when it is clicked with the mouse.
653    ///
654    /// This property is only relevant for widgets that can take focus.
655    ///
656    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
657    /// GtkComboBox) implemented this property individually.
658    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
659        Self {
660            builder: self.builder.property("focus-on-click", focus_on_click),
661        }
662    }
663
664    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
665    pub fn halign(self, halign: Align) -> Self {
666        Self {
667            builder: self.builder.property("halign", halign),
668        }
669    }
670
671    pub fn has_default(self, has_default: bool) -> Self {
672        Self {
673            builder: self.builder.property("has-default", has_default),
674        }
675    }
676
677    pub fn has_focus(self, has_focus: bool) -> Self {
678        Self {
679            builder: self.builder.property("has-focus", has_focus),
680        }
681    }
682
683    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
684    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
685    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
686    /// whether it will provide a tooltip or not.
687    ///
688    /// Note that setting this property to [`true`] for the first time will change
689    /// the event masks of the GdkWindows of this widget to include leave-notify
690    /// and motion-notify events. This cannot and will not be undone when the
691    /// property is set to [`false`] again.
692    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
693        Self {
694            builder: self.builder.property("has-tooltip", has_tooltip),
695        }
696    }
697
698    pub fn height_request(self, height_request: i32) -> Self {
699        Self {
700            builder: self.builder.property("height-request", height_request),
701        }
702    }
703
704    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
705    pub fn hexpand(self, hexpand: bool) -> Self {
706        Self {
707            builder: self.builder.property("hexpand", hexpand),
708        }
709    }
710
711    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
712    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
713        Self {
714            builder: self.builder.property("hexpand-set", hexpand_set),
715        }
716    }
717
718    pub fn is_focus(self, is_focus: bool) -> Self {
719        Self {
720            builder: self.builder.property("is-focus", is_focus),
721        }
722    }
723
724    /// Sets all four sides' margin at once. If read, returns max
725    /// margin on any side.
726    pub fn margin(self, margin: i32) -> Self {
727        Self {
728            builder: self.builder.property("margin", margin),
729        }
730    }
731
732    /// Margin on bottom side of widget.
733    ///
734    /// This property adds margin outside of the widget's normal size
735    /// request, the margin will be added in addition to the size from
736    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
737    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
738        Self {
739            builder: self.builder.property("margin-bottom", margin_bottom),
740        }
741    }
742
743    /// Margin on end of widget, horizontally. This property supports
744    /// left-to-right and right-to-left text directions.
745    ///
746    /// This property adds margin outside of the widget's normal size
747    /// request, the margin will be added in addition to the size from
748    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
749    pub fn margin_end(self, margin_end: i32) -> Self {
750        Self {
751            builder: self.builder.property("margin-end", margin_end),
752        }
753    }
754
755    /// Margin on start of widget, horizontally. This property supports
756    /// left-to-right and right-to-left text directions.
757    ///
758    /// This property adds margin outside of the widget's normal size
759    /// request, the margin will be added in addition to the size from
760    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
761    pub fn margin_start(self, margin_start: i32) -> Self {
762        Self {
763            builder: self.builder.property("margin-start", margin_start),
764        }
765    }
766
767    /// Margin on top side of widget.
768    ///
769    /// This property adds margin outside of the widget's normal size
770    /// request, the margin will be added in addition to the size from
771    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
772    pub fn margin_top(self, margin_top: i32) -> Self {
773        Self {
774            builder: self.builder.property("margin-top", margin_top),
775        }
776    }
777
778    pub fn name(self, name: impl Into<glib::GString>) -> Self {
779        Self {
780            builder: self.builder.property("name", name.into()),
781        }
782    }
783
784    pub fn no_show_all(self, no_show_all: bool) -> Self {
785        Self {
786            builder: self.builder.property("no-show-all", no_show_all),
787        }
788    }
789
790    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
791    /// more details about window opacity.
792    ///
793    /// Before 3.8 this was only available in GtkWindow
794    pub fn opacity(self, opacity: f64) -> Self {
795        Self {
796            builder: self.builder.property("opacity", opacity),
797        }
798    }
799
800    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
801        Self {
802            builder: self.builder.property("parent", parent.clone().upcast()),
803        }
804    }
805
806    pub fn receives_default(self, receives_default: bool) -> Self {
807        Self {
808            builder: self.builder.property("receives-default", receives_default),
809        }
810    }
811
812    pub fn sensitive(self, sensitive: bool) -> Self {
813        Self {
814            builder: self.builder.property("sensitive", sensitive),
815        }
816    }
817
818    /// Sets the text of tooltip to be the given string, which is marked up
819    /// with the [Pango text markup language][PangoMarkupFormat].
820    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
821    ///
822    /// This is a convenience property which will take care of getting the
823    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
824    /// will automatically be set to [`true`] and there will be taken care of
825    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
826    ///
827    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
828    /// are set, the last one wins.
829    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
830        Self {
831            builder: self
832                .builder
833                .property("tooltip-markup", tooltip_markup.into()),
834        }
835    }
836
837    /// Sets the text of tooltip to be the given string.
838    ///
839    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
840    ///
841    /// This is a convenience property which will take care of getting the
842    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
843    /// will automatically be set to [`true`] and there will be taken care of
844    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
845    ///
846    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
847    /// are set, the last one wins.
848    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
849        Self {
850            builder: self.builder.property("tooltip-text", tooltip_text.into()),
851        }
852    }
853
854    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
855    pub fn valign(self, valign: Align) -> Self {
856        Self {
857            builder: self.builder.property("valign", valign),
858        }
859    }
860
861    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
862    pub fn vexpand(self, vexpand: bool) -> Self {
863        Self {
864            builder: self.builder.property("vexpand", vexpand),
865        }
866    }
867
868    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
869    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
870        Self {
871            builder: self.builder.property("vexpand-set", vexpand_set),
872        }
873    }
874
875    pub fn visible(self, visible: bool) -> Self {
876        Self {
877            builder: self.builder.property("visible", visible),
878        }
879    }
880
881    pub fn width_request(self, width_request: i32) -> Self {
882        Self {
883            builder: self.builder.property("width-request", width_request),
884        }
885    }
886
887    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
888        Self {
889            builder: self.builder.property("action-name", action_name.into()),
890        }
891    }
892
893    pub fn action_target(self, action_target: &glib::Variant) -> Self {
894        Self {
895            builder: self
896                .builder
897                .property("action-target", action_target.clone()),
898        }
899    }
900
901    /// The orientation of the orientable.
902    pub fn orientation(self, orientation: Orientation) -> Self {
903        Self {
904            builder: self.builder.property("orientation", orientation),
905        }
906    }
907
908    // rustdoc-stripper-ignore-next
909    /// Build the [`VolumeButton`].
910    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
911    pub fn build(self) -> VolumeButton {
912        self.builder.build()
913    }
914}
915
916mod sealed {
917    pub trait Sealed {}
918    impl<T: super::IsA<super::VolumeButton>> Sealed for T {}
919}
920
921/// Trait containing all [`struct@VolumeButton`] methods.
922///
923/// # Implementors
924///
925/// [`VolumeButton`][struct@crate::VolumeButton]
926pub trait VolumeButtonExt: IsA<VolumeButton> + sealed::Sealed + 'static {
927    /// Whether to use symbolic icons as the icons. Note that
928    /// if the symbolic icons are not available in your installed
929    /// theme, then the normal (potentially colorful) icons will
930    /// be used.
931    #[doc(alias = "use-symbolic")]
932    fn uses_symbolic(&self) -> bool {
933        ObjectExt::property(self.as_ref(), "use-symbolic")
934    }
935
936    /// Whether to use symbolic icons as the icons. Note that
937    /// if the symbolic icons are not available in your installed
938    /// theme, then the normal (potentially colorful) icons will
939    /// be used.
940    #[doc(alias = "use-symbolic")]
941    fn set_use_symbolic(&self, use_symbolic: bool) {
942        ObjectExt::set_property(self.as_ref(), "use-symbolic", use_symbolic)
943    }
944
945    #[doc(alias = "use-symbolic")]
946    fn connect_use_symbolic_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
947        unsafe extern "C" fn notify_use_symbolic_trampoline<
948            P: IsA<VolumeButton>,
949            F: Fn(&P) + 'static,
950        >(
951            this: *mut ffi::GtkVolumeButton,
952            _param_spec: glib::ffi::gpointer,
953            f: glib::ffi::gpointer,
954        ) {
955            let f: &F = &*(f as *const F);
956            f(VolumeButton::from_glib_borrow(this).unsafe_cast_ref())
957        }
958        unsafe {
959            let f: Box_<F> = Box_::new(f);
960            connect_raw(
961                self.as_ptr() as *mut _,
962                b"notify::use-symbolic\0".as_ptr() as *const _,
963                Some(transmute::<_, unsafe extern "C" fn()>(
964                    notify_use_symbolic_trampoline::<Self, F> as *const (),
965                )),
966                Box_::into_raw(f),
967            )
968        }
969    }
970}
971
972impl<O: IsA<VolumeButton>> VolumeButtonExt for O {}
973
974impl fmt::Display for VolumeButton {
975    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
976        f.write_str("VolumeButton")
977    }
978}