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