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
5use crate::{
6 Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, MediaStream,
7 Overflow, Widget, ffi,
8};
9use glib::{
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 /// Shows controls for video playback.
18 ///
19 /// <picture>
20 /// <source srcset="media-controls-dark.png" media="(prefers-color-scheme: dark)">
21 /// <img alt="An example GtkMediaControls" src="media-controls.png">
22 /// </picture>
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 | Writeable
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 | Writeable
44 ///
45 ///
46 /// #### `can-target`
47 /// Whether the widget can receive pointer events.
48 ///
49 /// Readable | Writeable
50 ///
51 ///
52 /// #### `css-classes`
53 /// A list of css classes applied to this widget.
54 ///
55 /// Readable | Writeable
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 | Writeable | Construct Only
65 ///
66 ///
67 /// #### `cursor`
68 /// The cursor used by @widget.
69 ///
70 /// Readable | Writeable
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 | Writeable
79 ///
80 ///
81 /// #### `focusable`
82 /// Whether this widget itself will accept the input focus.
83 ///
84 /// Readable | Writeable
85 ///
86 ///
87 /// #### `halign`
88 /// How to distribute horizontal space if widget gets extra space.
89 ///
90 /// Readable | Writeable
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 | Writeable
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 | Writeable
122 ///
123 ///
124 /// #### `hexpand`
125 /// Whether to expand horizontally.
126 ///
127 /// Readable | Writeable
128 ///
129 ///
130 /// #### `hexpand-set`
131 /// Whether to use the `hexpand` property.
132 ///
133 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
201 ///
202 ///
203 /// #### `name`
204 /// The name of the widget.
205 ///
206 /// Readable | Writeable
207 ///
208 ///
209 /// #### `opacity`
210 /// The requested opacity of the widget.
211 ///
212 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
289 ///
290 ///
291 /// #### `valign`
292 /// How to distribute vertical space if widget gets extra space.
293 ///
294 /// Readable | Writeable
295 ///
296 ///
297 /// #### `vexpand`
298 /// Whether to expand vertically.
299 ///
300 /// Readable | Writeable
301 ///
302 ///
303 /// #### `vexpand-set`
304 /// Whether to use the `vexpand` property.
305 ///
306 /// Readable | Writeable
307 ///
308 ///
309 /// #### `visible`
310 /// Whether the widget is visible.
311 ///
312 /// Readable | Writeable
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 | Writeable
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 | Writeable
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
344impl MediaControls {
345 /// Creates a new [`MediaControls`][crate::MediaControls] managing the @stream passed to it.
346 /// ## `stream`
347 /// a [`MediaStream`][crate::MediaStream] to manage
348 ///
349 /// # Returns
350 ///
351 /// a new [`MediaControls`][crate::MediaControls]
352 #[doc(alias = "gtk_media_controls_new")]
353 pub fn new(stream: Option<&impl IsA<MediaStream>>) -> MediaControls {
354 assert_initialized_main_thread!();
355 unsafe {
356 Widget::from_glib_none(ffi::gtk_media_controls_new(
357 stream.map(|p| p.as_ref()).to_glib_none().0,
358 ))
359 .unsafe_cast()
360 }
361 }
362
363 // rustdoc-stripper-ignore-next
364 /// Creates a new builder-pattern struct instance to construct [`MediaControls`] objects.
365 ///
366 /// This method returns an instance of [`MediaControlsBuilder`](crate::builders::MediaControlsBuilder) which can be used to create [`MediaControls`] objects.
367 pub fn builder() -> MediaControlsBuilder {
368 MediaControlsBuilder::new()
369 }
370
371 /// Gets the media stream managed by @self or [`None`] if none.
372 ///
373 /// # Returns
374 ///
375 /// The media stream managed by @self
376 #[doc(alias = "gtk_media_controls_get_media_stream")]
377 #[doc(alias = "get_media_stream")]
378 #[doc(alias = "media-stream")]
379 pub fn media_stream(&self) -> Option<MediaStream> {
380 unsafe {
381 from_glib_none(ffi::gtk_media_controls_get_media_stream(
382 self.to_glib_none().0,
383 ))
384 }
385 }
386
387 /// Sets the stream that is controlled by @self.
388 /// ## `stream`
389 /// a [`MediaStream`][crate::MediaStream]
390 #[doc(alias = "gtk_media_controls_set_media_stream")]
391 #[doc(alias = "media-stream")]
392 pub fn set_media_stream(&self, stream: Option<&impl IsA<MediaStream>>) {
393 unsafe {
394 ffi::gtk_media_controls_set_media_stream(
395 self.to_glib_none().0,
396 stream.map(|p| p.as_ref()).to_glib_none().0,
397 );
398 }
399 }
400
401 #[doc(alias = "media-stream")]
402 pub fn connect_media_stream_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
403 unsafe extern "C" fn notify_media_stream_trampoline<F: Fn(&MediaControls) + 'static>(
404 this: *mut ffi::GtkMediaControls,
405 _param_spec: glib::ffi::gpointer,
406 f: glib::ffi::gpointer,
407 ) {
408 unsafe {
409 let f: &F = &*(f as *const F);
410 f(&from_glib_borrow(this))
411 }
412 }
413 unsafe {
414 let f: Box_<F> = Box_::new(f);
415 connect_raw(
416 self.as_ptr() as *mut _,
417 c"notify::media-stream".as_ptr() as *const _,
418 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
419 notify_media_stream_trampoline::<F> as *const (),
420 )),
421 Box_::into_raw(f),
422 )
423 }
424 }
425}
426
427impl Default for MediaControls {
428 fn default() -> Self {
429 glib::object::Object::new::<Self>()
430 }
431}
432
433// rustdoc-stripper-ignore-next
434/// A [builder-pattern] type to construct [`MediaControls`] objects.
435///
436/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
437#[must_use = "The builder must be built to be used"]
438pub struct MediaControlsBuilder {
439 builder: glib::object::ObjectBuilder<'static, MediaControls>,
440}
441
442impl MediaControlsBuilder {
443 fn new() -> Self {
444 Self {
445 builder: glib::object::Object::builder(),
446 }
447 }
448
449 /// The media-stream managed by this object or [`None`] if none.
450 pub fn media_stream(self, media_stream: &impl IsA<MediaStream>) -> Self {
451 Self {
452 builder: self
453 .builder
454 .property("media-stream", media_stream.clone().upcast()),
455 }
456 }
457
458 /// Whether the widget or any of its descendents can accept
459 /// the input focus.
460 ///
461 /// This property is meant to be set by widget implementations,
462 /// typically in their instance init function.
463 pub fn can_focus(self, can_focus: bool) -> Self {
464 Self {
465 builder: self.builder.property("can-focus", can_focus),
466 }
467 }
468
469 /// Whether the widget can receive pointer events.
470 pub fn can_target(self, can_target: bool) -> Self {
471 Self {
472 builder: self.builder.property("can-target", can_target),
473 }
474 }
475
476 /// A list of css classes applied to this widget.
477 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
478 Self {
479 builder: self.builder.property("css-classes", css_classes.into()),
480 }
481 }
482
483 /// The name of this widget in the CSS tree.
484 ///
485 /// This property is meant to be set by widget implementations,
486 /// typically in their instance init function.
487 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
488 Self {
489 builder: self.builder.property("css-name", css_name.into()),
490 }
491 }
492
493 /// The cursor used by @widget.
494 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
495 Self {
496 builder: self.builder.property("cursor", cursor.clone()),
497 }
498 }
499
500 /// Whether the widget should grab focus when it is clicked with the mouse.
501 ///
502 /// This property is only relevant for widgets that can take focus.
503 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
504 Self {
505 builder: self.builder.property("focus-on-click", focus_on_click),
506 }
507 }
508
509 /// Whether this widget itself will accept the input focus.
510 pub fn focusable(self, focusable: bool) -> Self {
511 Self {
512 builder: self.builder.property("focusable", focusable),
513 }
514 }
515
516 /// How to distribute horizontal space if widget gets extra space.
517 pub fn halign(self, halign: Align) -> Self {
518 Self {
519 builder: self.builder.property("halign", halign),
520 }
521 }
522
523 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
524 /// signal on @widget.
525 ///
526 /// A true value indicates that @widget can have a tooltip, in this case
527 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
528 /// determine whether it will provide a tooltip or not.
529 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
530 Self {
531 builder: self.builder.property("has-tooltip", has_tooltip),
532 }
533 }
534
535 /// Overrides for height request of the widget.
536 ///
537 /// If this is -1, the natural request will be used.
538 pub fn height_request(self, height_request: i32) -> Self {
539 Self {
540 builder: self.builder.property("height-request", height_request),
541 }
542 }
543
544 /// Whether to expand horizontally.
545 pub fn hexpand(self, hexpand: bool) -> Self {
546 Self {
547 builder: self.builder.property("hexpand", hexpand),
548 }
549 }
550
551 /// Whether to use the `hexpand` property.
552 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
553 Self {
554 builder: self.builder.property("hexpand-set", hexpand_set),
555 }
556 }
557
558 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
559 /// the preferred size of the widget, and allocate its children.
560 ///
561 /// This property is meant to be set by widget implementations,
562 /// typically in their instance init function.
563 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
564 Self {
565 builder: self
566 .builder
567 .property("layout-manager", layout_manager.clone().upcast()),
568 }
569 }
570
571 /// Makes this widget act like a modal dialog, with respect to
572 /// event delivery.
573 ///
574 /// Global event controllers will not handle events with targets
575 /// inside the widget, unless they are set up to ignore propagation
576 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
577 #[cfg(feature = "v4_18")]
578 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
579 pub fn limit_events(self, limit_events: bool) -> Self {
580 Self {
581 builder: self.builder.property("limit-events", limit_events),
582 }
583 }
584
585 /// Margin on bottom side of widget.
586 ///
587 /// This property adds margin outside of the widget's normal size
588 /// request, the margin will be added in addition to the size from
589 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
590 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
591 Self {
592 builder: self.builder.property("margin-bottom", margin_bottom),
593 }
594 }
595
596 /// Margin on end of widget, horizontally.
597 ///
598 /// This property supports left-to-right and right-to-left text
599 /// directions.
600 ///
601 /// This property adds margin outside of the widget's normal size
602 /// request, the margin will be added in addition to the size from
603 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
604 pub fn margin_end(self, margin_end: i32) -> Self {
605 Self {
606 builder: self.builder.property("margin-end", margin_end),
607 }
608 }
609
610 /// Margin on start of widget, horizontally.
611 ///
612 /// This property supports left-to-right and right-to-left text
613 /// directions.
614 ///
615 /// This property adds margin outside of the widget's normal size
616 /// request, the margin will be added in addition to the size from
617 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
618 pub fn margin_start(self, margin_start: i32) -> Self {
619 Self {
620 builder: self.builder.property("margin-start", margin_start),
621 }
622 }
623
624 /// Margin on top side of widget.
625 ///
626 /// This property adds margin outside of the widget's normal size
627 /// request, the margin will be added in addition to the size from
628 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
629 pub fn margin_top(self, margin_top: i32) -> Self {
630 Self {
631 builder: self.builder.property("margin-top", margin_top),
632 }
633 }
634
635 /// The name of the widget.
636 pub fn name(self, name: impl Into<glib::GString>) -> Self {
637 Self {
638 builder: self.builder.property("name", name.into()),
639 }
640 }
641
642 /// The requested opacity of the widget.
643 pub fn opacity(self, opacity: f64) -> Self {
644 Self {
645 builder: self.builder.property("opacity", opacity),
646 }
647 }
648
649 /// How content outside the widget's content area is treated.
650 ///
651 /// This property is meant to be set by widget implementations,
652 /// typically in their instance init function.
653 pub fn overflow(self, overflow: Overflow) -> Self {
654 Self {
655 builder: self.builder.property("overflow", overflow),
656 }
657 }
658
659 /// Whether the widget will receive the default action when it is focused.
660 pub fn receives_default(self, receives_default: bool) -> Self {
661 Self {
662 builder: self.builder.property("receives-default", receives_default),
663 }
664 }
665
666 /// Whether the widget responds to input.
667 pub fn sensitive(self, sensitive: bool) -> Self {
668 Self {
669 builder: self.builder.property("sensitive", sensitive),
670 }
671 }
672
673 /// Sets the text of tooltip to be the given string, which is marked up
674 /// with Pango markup.
675 ///
676 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
677 ///
678 /// This is a convenience property which will take care of getting the
679 /// tooltip shown if the given string is not `NULL`:
680 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
681 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
682 /// the default signal handler.
683 ///
684 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
685 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
686 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
687 Self {
688 builder: self
689 .builder
690 .property("tooltip-markup", tooltip_markup.into()),
691 }
692 }
693
694 /// Sets the text of tooltip to be the given string.
695 ///
696 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
697 ///
698 /// This is a convenience property which will take care of getting the
699 /// tooltip shown if the given string is not `NULL`:
700 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
701 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
702 /// the default signal handler.
703 ///
704 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
705 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
706 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
707 Self {
708 builder: self.builder.property("tooltip-text", tooltip_text.into()),
709 }
710 }
711
712 /// How to distribute vertical space if widget gets extra space.
713 pub fn valign(self, valign: Align) -> Self {
714 Self {
715 builder: self.builder.property("valign", valign),
716 }
717 }
718
719 /// Whether to expand vertically.
720 pub fn vexpand(self, vexpand: bool) -> Self {
721 Self {
722 builder: self.builder.property("vexpand", vexpand),
723 }
724 }
725
726 /// Whether to use the `vexpand` property.
727 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
728 Self {
729 builder: self.builder.property("vexpand-set", vexpand_set),
730 }
731 }
732
733 /// Whether the widget is visible.
734 pub fn visible(self, visible: bool) -> Self {
735 Self {
736 builder: self.builder.property("visible", visible),
737 }
738 }
739
740 /// Overrides for width request of the widget.
741 ///
742 /// If this is -1, the natural request will be used.
743 pub fn width_request(self, width_request: i32) -> Self {
744 Self {
745 builder: self.builder.property("width-request", width_request),
746 }
747 }
748
749 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
750 ///
751 /// The accessible role cannot be changed once set.
752 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
753 Self {
754 builder: self.builder.property("accessible-role", accessible_role),
755 }
756 }
757
758 // rustdoc-stripper-ignore-next
759 /// Build the [`MediaControls`].
760 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
761 pub fn build(self) -> MediaControls {
762 assert_initialized_main_thread!();
763 self.builder.build()
764 }
765}