Skip to main content

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