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 /// 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 let f: &F = &*(f as *const F);
409 f(&from_glib_borrow(this))
410 }
411 unsafe {
412 let f: Box_<F> = Box_::new(f);
413 connect_raw(
414 self.as_ptr() as *mut _,
415 c"notify::media-stream".as_ptr() as *const _,
416 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
417 notify_media_stream_trampoline::<F> as *const (),
418 )),
419 Box_::into_raw(f),
420 )
421 }
422 }
423}
424
425impl Default for MediaControls {
426 fn default() -> Self {
427 glib::object::Object::new::<Self>()
428 }
429}
430
431// rustdoc-stripper-ignore-next
432/// A [builder-pattern] type to construct [`MediaControls`] objects.
433///
434/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
435#[must_use = "The builder must be built to be used"]
436pub struct MediaControlsBuilder {
437 builder: glib::object::ObjectBuilder<'static, MediaControls>,
438}
439
440impl MediaControlsBuilder {
441 fn new() -> Self {
442 Self {
443 builder: glib::object::Object::builder(),
444 }
445 }
446
447 /// The media-stream managed by this object or [`None`] if none.
448 pub fn media_stream(self, media_stream: &impl IsA<MediaStream>) -> Self {
449 Self {
450 builder: self
451 .builder
452 .property("media-stream", media_stream.clone().upcast()),
453 }
454 }
455
456 /// Whether the widget or any of its descendents can accept
457 /// the input focus.
458 ///
459 /// This property is meant to be set by widget implementations,
460 /// typically in their instance init function.
461 pub fn can_focus(self, can_focus: bool) -> Self {
462 Self {
463 builder: self.builder.property("can-focus", can_focus),
464 }
465 }
466
467 /// Whether the widget can receive pointer events.
468 pub fn can_target(self, can_target: bool) -> Self {
469 Self {
470 builder: self.builder.property("can-target", can_target),
471 }
472 }
473
474 /// A list of css classes applied to this widget.
475 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
476 Self {
477 builder: self.builder.property("css-classes", css_classes.into()),
478 }
479 }
480
481 /// The name of this widget in the CSS tree.
482 ///
483 /// This property is meant to be set by widget implementations,
484 /// typically in their instance init function.
485 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
486 Self {
487 builder: self.builder.property("css-name", css_name.into()),
488 }
489 }
490
491 /// The cursor used by @widget.
492 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
493 Self {
494 builder: self.builder.property("cursor", cursor.clone()),
495 }
496 }
497
498 /// Whether the widget should grab focus when it is clicked with the mouse.
499 ///
500 /// This property is only relevant for widgets that can take focus.
501 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
502 Self {
503 builder: self.builder.property("focus-on-click", focus_on_click),
504 }
505 }
506
507 /// Whether this widget itself will accept the input focus.
508 pub fn focusable(self, focusable: bool) -> Self {
509 Self {
510 builder: self.builder.property("focusable", focusable),
511 }
512 }
513
514 /// How to distribute horizontal space if widget gets extra space.
515 pub fn halign(self, halign: Align) -> Self {
516 Self {
517 builder: self.builder.property("halign", halign),
518 }
519 }
520
521 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
522 /// signal on @widget.
523 ///
524 /// A true value indicates that @widget can have a tooltip, in this case
525 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
526 /// determine whether it will provide a tooltip or not.
527 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
528 Self {
529 builder: self.builder.property("has-tooltip", has_tooltip),
530 }
531 }
532
533 /// Overrides for height request of the widget.
534 ///
535 /// If this is -1, the natural request will be used.
536 pub fn height_request(self, height_request: i32) -> Self {
537 Self {
538 builder: self.builder.property("height-request", height_request),
539 }
540 }
541
542 /// Whether to expand horizontally.
543 pub fn hexpand(self, hexpand: bool) -> Self {
544 Self {
545 builder: self.builder.property("hexpand", hexpand),
546 }
547 }
548
549 /// Whether to use the `hexpand` property.
550 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
551 Self {
552 builder: self.builder.property("hexpand-set", hexpand_set),
553 }
554 }
555
556 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
557 /// the preferred size of the widget, and allocate its children.
558 ///
559 /// This property is meant to be set by widget implementations,
560 /// typically in their instance init function.
561 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
562 Self {
563 builder: self
564 .builder
565 .property("layout-manager", layout_manager.clone().upcast()),
566 }
567 }
568
569 /// Makes this widget act like a modal dialog, with respect to
570 /// event delivery.
571 ///
572 /// Global event controllers will not handle events with targets
573 /// inside the widget, unless they are set up to ignore propagation
574 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
575 #[cfg(feature = "v4_18")]
576 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
577 pub fn limit_events(self, limit_events: bool) -> Self {
578 Self {
579 builder: self.builder.property("limit-events", limit_events),
580 }
581 }
582
583 /// Margin on bottom side of widget.
584 ///
585 /// This property adds margin outside of the widget's normal size
586 /// request, the margin will be added in addition to the size from
587 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
588 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
589 Self {
590 builder: self.builder.property("margin-bottom", margin_bottom),
591 }
592 }
593
594 /// Margin on end of widget, horizontally.
595 ///
596 /// This property supports left-to-right and right-to-left text
597 /// directions.
598 ///
599 /// This property adds margin outside of the widget's normal size
600 /// request, the margin will be added in addition to the size from
601 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
602 pub fn margin_end(self, margin_end: i32) -> Self {
603 Self {
604 builder: self.builder.property("margin-end", margin_end),
605 }
606 }
607
608 /// Margin on start of widget, horizontally.
609 ///
610 /// This property supports left-to-right and right-to-left text
611 /// directions.
612 ///
613 /// This property adds margin outside of the widget's normal size
614 /// request, the margin will be added in addition to the size from
615 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
616 pub fn margin_start(self, margin_start: i32) -> Self {
617 Self {
618 builder: self.builder.property("margin-start", margin_start),
619 }
620 }
621
622 /// Margin on top side of widget.
623 ///
624 /// This property adds margin outside of the widget's normal size
625 /// request, the margin will be added in addition to the size from
626 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
627 pub fn margin_top(self, margin_top: i32) -> Self {
628 Self {
629 builder: self.builder.property("margin-top", margin_top),
630 }
631 }
632
633 /// The name of the widget.
634 pub fn name(self, name: impl Into<glib::GString>) -> Self {
635 Self {
636 builder: self.builder.property("name", name.into()),
637 }
638 }
639
640 /// The requested opacity of the widget.
641 pub fn opacity(self, opacity: f64) -> Self {
642 Self {
643 builder: self.builder.property("opacity", opacity),
644 }
645 }
646
647 /// How content outside the widget's content area is treated.
648 ///
649 /// This property is meant to be set by widget implementations,
650 /// typically in their instance init function.
651 pub fn overflow(self, overflow: Overflow) -> Self {
652 Self {
653 builder: self.builder.property("overflow", overflow),
654 }
655 }
656
657 /// Whether the widget will receive the default action when it is focused.
658 pub fn receives_default(self, receives_default: bool) -> Self {
659 Self {
660 builder: self.builder.property("receives-default", receives_default),
661 }
662 }
663
664 /// Whether the widget responds to input.
665 pub fn sensitive(self, sensitive: bool) -> Self {
666 Self {
667 builder: self.builder.property("sensitive", sensitive),
668 }
669 }
670
671 /// Sets the text of tooltip to be the given string, which is marked up
672 /// with Pango markup.
673 ///
674 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
675 ///
676 /// This is a convenience property which will take care of getting the
677 /// tooltip shown if the given string is not `NULL`:
678 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
679 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
680 /// the default signal handler.
681 ///
682 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
683 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
684 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
685 Self {
686 builder: self
687 .builder
688 .property("tooltip-markup", tooltip_markup.into()),
689 }
690 }
691
692 /// Sets the text of tooltip to be the given string.
693 ///
694 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
695 ///
696 /// This is a convenience property which will take care of getting the
697 /// tooltip shown if the given string is not `NULL`:
698 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
699 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
700 /// the default signal handler.
701 ///
702 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
703 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
704 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
705 Self {
706 builder: self.builder.property("tooltip-text", tooltip_text.into()),
707 }
708 }
709
710 /// How to distribute vertical space if widget gets extra space.
711 pub fn valign(self, valign: Align) -> Self {
712 Self {
713 builder: self.builder.property("valign", valign),
714 }
715 }
716
717 /// Whether to expand vertically.
718 pub fn vexpand(self, vexpand: bool) -> Self {
719 Self {
720 builder: self.builder.property("vexpand", vexpand),
721 }
722 }
723
724 /// Whether to use the `vexpand` property.
725 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
726 Self {
727 builder: self.builder.property("vexpand-set", vexpand_set),
728 }
729 }
730
731 /// Whether the widget is visible.
732 pub fn visible(self, visible: bool) -> Self {
733 Self {
734 builder: self.builder.property("visible", visible),
735 }
736 }
737
738 /// Overrides for width request of the widget.
739 ///
740 /// If this is -1, the natural request will be used.
741 pub fn width_request(self, width_request: i32) -> Self {
742 Self {
743 builder: self.builder.property("width-request", width_request),
744 }
745 }
746
747 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
748 ///
749 /// The accessible role cannot be changed once set.
750 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
751 Self {
752 builder: self.builder.property("accessible-role", accessible_role),
753 }
754 }
755
756 // rustdoc-stripper-ignore-next
757 /// Build the [`MediaControls`].
758 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
759 pub fn build(self) -> MediaControls {
760 assert_initialized_main_thread!();
761 self.builder.build()
762 }
763}