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