Skip to main content

gtk4/auto/
media_controls.rs

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