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