Skip to main content

gtk4/auto/
shortcuts_shortcut.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, Overflow, ShortcutType,
10    SizeGroup, TextDirection, 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    /// A [`ShortcutsShortcut`][crate::ShortcutsShortcut] represents a single keyboard shortcut or gesture
24    /// with a short text.
25    ///
26    /// This widget is only meant to be used with [`ShortcutsWindow`][crate::ShortcutsWindow].
27    ///
28    /// ## Properties
29    ///
30    ///
31    /// #### `accel-size-group`
32    ///  The size group for the accelerator portion of this shortcut.
33    ///
34    /// This is used internally by GTK, and must not be modified by applications.
35    ///
36    /// Writable
37    ///
38    ///
39    /// #### `accelerator`
40    ///  amp`; when used
41    /// in .ui files.
42    ///
43    /// Readable | Writable
44    ///
45    ///
46    /// #### `action-name`
47    ///  A detailed action name.
48    ///
49    /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
50    /// then GTK will use the accelerators that are associated with the
51    /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
52    /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
53    ///
54    /// Readable | Writable
55    ///
56    ///
57    /// #### `direction`
58    ///  The text direction for which this shortcut is active.
59    ///
60    /// If the shortcut is used regardless of the text direction,
61    /// set this property to [`TextDirection::None`][crate::TextDirection::None].
62    ///
63    /// Readable | Writable
64    ///
65    ///
66    /// #### `icon`
67    ///  An icon to represent the shortcut or gesture.
68    ///
69    /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
70    /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
71    ///
72    /// For the other predefined gesture types, GTK provides an icon on its own.
73    ///
74    /// Readable | Writable
75    ///
76    ///
77    /// #### `icon-set`
78    ///  [`true`] if an icon has been set.
79    ///
80    /// Readable | Writable
81    ///
82    ///
83    /// #### `shortcut-type`
84    ///  The type of shortcut that is represented.
85    ///
86    /// Readable | Writable
87    ///
88    ///
89    /// #### `subtitle`
90    ///  The subtitle for the shortcut or gesture.
91    ///
92    /// This is typically used for gestures and should be a short, one-line
93    /// text that describes the gesture itself. For the predefined gesture
94    /// types, GTK provides a subtitle on its own.
95    ///
96    /// Readable | Writable
97    ///
98    ///
99    /// #### `subtitle-set`
100    ///  [`true`] if a subtitle has been set.
101    ///
102    /// Readable | Writable
103    ///
104    ///
105    /// #### `title`
106    ///  The textual description for the shortcut or gesture represented by
107    /// this object.
108    ///
109    /// This should be a short string that can fit in a single line.
110    ///
111    /// Readable | Writable
112    ///
113    ///
114    /// #### `title-size-group`
115    ///  The size group for the textual portion of this shortcut.
116    ///
117    /// This is used internally by GTK, and must not be modified by applications.
118    ///
119    /// Writable
120    /// <details><summary><h4>Widget</h4></summary>
121    ///
122    ///
123    /// #### `can-focus`
124    ///  Whether the widget or any of its descendents can accept
125    /// the input focus.
126    ///
127    /// This property is meant to be set by widget implementations,
128    /// typically in their instance init function.
129    ///
130    /// Readable | Writable
131    ///
132    ///
133    /// #### `can-target`
134    ///  Whether the widget can receive pointer events.
135    ///
136    /// Readable | Writable
137    ///
138    ///
139    /// #### `css-classes`
140    ///  A list of css classes applied to this widget.
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `css-name`
146    ///  The name of this widget in the CSS tree.
147    ///
148    /// This property is meant to be set by widget implementations,
149    /// typically in their instance init function.
150    ///
151    /// Readable | Writable | Construct Only
152    ///
153    ///
154    /// #### `cursor`
155    ///  The cursor used by @widget.
156    ///
157    /// Readable | Writable
158    ///
159    ///
160    /// #### `focus-on-click`
161    ///  Whether the widget should grab focus when it is clicked with the mouse.
162    ///
163    /// This property is only relevant for widgets that can take focus.
164    ///
165    /// Readable | Writable
166    ///
167    ///
168    /// #### `focusable`
169    ///  Whether this widget itself will accept the input focus.
170    ///
171    /// Readable | Writable
172    ///
173    ///
174    /// #### `halign`
175    ///  How to distribute horizontal space if widget gets extra space.
176    ///
177    /// Readable | Writable
178    ///
179    ///
180    /// #### `has-default`
181    ///  Whether the widget is the default widget.
182    ///
183    /// Readable
184    ///
185    ///
186    /// #### `has-focus`
187    ///  Whether the widget has the input focus.
188    ///
189    /// Readable
190    ///
191    ///
192    /// #### `has-tooltip`
193    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
194    /// signal on @widget.
195    ///
196    /// A true value indicates that @widget can have a tooltip, in this case
197    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
198    /// determine whether it will provide a tooltip or not.
199    ///
200    /// Readable | Writable
201    ///
202    ///
203    /// #### `height-request`
204    ///  Overrides for height request of the widget.
205    ///
206    /// If this is -1, the natural request will be used.
207    ///
208    /// Readable | Writable
209    ///
210    ///
211    /// #### `hexpand`
212    ///  Whether to expand horizontally.
213    ///
214    /// Readable | Writable
215    ///
216    ///
217    /// #### `hexpand-set`
218    ///  Whether to use the `hexpand` property.
219    ///
220    /// Readable | Writable
221    ///
222    ///
223    /// #### `layout-manager`
224    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
225    /// the preferred size of the widget, and allocate its children.
226    ///
227    /// This property is meant to be set by widget implementations,
228    /// typically in their instance init function.
229    ///
230    /// Readable | Writable
231    ///
232    ///
233    /// #### `limit-events`
234    ///  Makes this widget act like a modal dialog, with respect to
235    /// event delivery.
236    ///
237    /// Global event controllers will not handle events with targets
238    /// inside the widget, unless they are set up to ignore propagation
239    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
240    ///
241    /// Readable | Writable
242    ///
243    ///
244    /// #### `margin-bottom`
245    ///  Margin on bottom side of widget.
246    ///
247    /// This property adds margin outside of the widget's normal size
248    /// request, the margin will be added in addition to the size from
249    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
250    ///
251    /// Readable | Writable
252    ///
253    ///
254    /// #### `margin-end`
255    ///  Margin on end of widget, horizontally.
256    ///
257    /// This property supports left-to-right and right-to-left text
258    /// directions.
259    ///
260    /// This property adds margin outside of the widget's normal size
261    /// request, the margin will be added in addition to the size from
262    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
263    ///
264    /// Readable | Writable
265    ///
266    ///
267    /// #### `margin-start`
268    ///  Margin on start of widget, horizontally.
269    ///
270    /// This property supports left-to-right and right-to-left text
271    /// directions.
272    ///
273    /// This property adds margin outside of the widget's normal size
274    /// request, the margin will be added in addition to the size from
275    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
276    ///
277    /// Readable | Writable
278    ///
279    ///
280    /// #### `margin-top`
281    ///  Margin on top side of widget.
282    ///
283    /// This property adds margin outside of the widget's normal size
284    /// request, the margin will be added in addition to the size from
285    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
286    ///
287    /// Readable | Writable
288    ///
289    ///
290    /// #### `name`
291    ///  The name of the widget.
292    ///
293    /// Readable | Writable
294    ///
295    ///
296    /// #### `opacity`
297    ///  The requested opacity of the widget.
298    ///
299    /// Readable | Writable
300    ///
301    ///
302    /// #### `overflow`
303    ///  How content outside the widget's content area is treated.
304    ///
305    /// This property is meant to be set by widget implementations,
306    /// typically in their instance init function.
307    ///
308    /// Readable | Writable
309    ///
310    ///
311    /// #### `parent`
312    ///  The parent widget of this widget.
313    ///
314    /// Readable
315    ///
316    ///
317    /// #### `receives-default`
318    ///  Whether the widget will receive the default action when it is focused.
319    ///
320    /// Readable | Writable
321    ///
322    ///
323    /// #### `root`
324    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
325    ///
326    /// This will be `NULL` if the widget is not contained in a root widget.
327    ///
328    /// Readable
329    ///
330    ///
331    /// #### `scale-factor`
332    ///  The scale factor of the widget.
333    ///
334    /// Readable
335    ///
336    ///
337    /// #### `sensitive`
338    ///  Whether the widget responds to input.
339    ///
340    /// Readable | Writable
341    ///
342    ///
343    /// #### `tooltip-markup`
344    ///  Sets the text of tooltip to be the given string, which is marked up
345    /// with Pango markup.
346    ///
347    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
348    ///
349    /// This is a convenience property which will take care of getting the
350    /// tooltip shown if the given string is not `NULL`:
351    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
352    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
353    /// the default signal handler.
354    ///
355    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
356    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
357    ///
358    /// Readable | Writable
359    ///
360    ///
361    /// #### `tooltip-text`
362    ///  Sets the text of tooltip to be the given string.
363    ///
364    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
365    ///
366    /// This is a convenience property which will take care of getting the
367    /// tooltip shown if the given string is not `NULL`:
368    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
369    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
370    /// the default signal handler.
371    ///
372    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
373    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
374    ///
375    /// Readable | Writable
376    ///
377    ///
378    /// #### `valign`
379    ///  How to distribute vertical space if widget gets extra space.
380    ///
381    /// Readable | Writable
382    ///
383    ///
384    /// #### `vexpand`
385    ///  Whether to expand vertically.
386    ///
387    /// Readable | Writable
388    ///
389    ///
390    /// #### `vexpand-set`
391    ///  Whether to use the `vexpand` property.
392    ///
393    /// Readable | Writable
394    ///
395    ///
396    /// #### `visible`
397    ///  Whether the widget is visible.
398    ///
399    /// Readable | Writable
400    ///
401    ///
402    /// #### `width-request`
403    ///  Overrides for width request of the widget.
404    ///
405    /// If this is -1, the natural request will be used.
406    ///
407    /// Readable | Writable
408    /// </details>
409    /// <details><summary><h4>Accessible</h4></summary>
410    ///
411    ///
412    /// #### `accessible-role`
413    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
414    ///
415    /// The accessible role cannot be changed once set.
416    ///
417    /// Readable | Writable
418    /// </details>
419    ///
420    /// # Implements
421    ///
422    /// [`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]
423    #[doc(alias = "GtkShortcutsShortcut")]
424    pub struct ShortcutsShortcut(Object<ffi::GtkShortcutsShortcut, ffi::GtkShortcutsShortcutClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
425
426    match fn {
427        type_ => || ffi::gtk_shortcuts_shortcut_get_type(),
428    }
429}
430
431#[cfg(not(feature = "v4_10"))]
432glib::wrapper! {
433    #[doc(alias = "GtkShortcutsShortcut")]
434    pub struct ShortcutsShortcut(Object<ffi::GtkShortcutsShortcut, ffi::GtkShortcutsShortcutClass>) @extends Widget, @implements Buildable, ConstraintTarget;
435
436    match fn {
437        type_ => || ffi::gtk_shortcuts_shortcut_get_type(),
438    }
439}
440
441impl ShortcutsShortcut {
442    // rustdoc-stripper-ignore-next
443    /// Creates a new builder-pattern struct instance to construct [`ShortcutsShortcut`] objects.
444    ///
445    /// This method returns an instance of [`ShortcutsShortcutBuilder`](crate::builders::ShortcutsShortcutBuilder) which can be used to create [`ShortcutsShortcut`] objects.
446    pub fn builder() -> ShortcutsShortcutBuilder {
447        ShortcutsShortcutBuilder::new()
448    }
449
450    /// The size group for the accelerator portion of this shortcut.
451    ///
452    /// This is used internally by GTK, and must not be modified by applications.
453    ///
454    /// # Deprecated since 4.18
455    ///
456    /// This widget will be removed in GTK 5
457    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
458    #[doc(alias = "accel-size-group")]
459    pub fn set_accel_size_group(&self, accel_size_group: Option<&SizeGroup>) {
460        ObjectExt::set_property(self, "accel-size-group", accel_size_group)
461    }
462
463    /// amp`; when used
464    /// in .ui files.
465    ///
466    /// # Deprecated since 4.18
467    ///
468    /// This widget will be removed in GTK 5
469    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
470    pub fn accelerator(&self) -> Option<glib::GString> {
471        ObjectExt::property(self, "accelerator")
472    }
473
474    /// amp`; when used
475    /// in .ui files.
476    ///
477    /// # Deprecated since 4.18
478    ///
479    /// This widget will be removed in GTK 5
480    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
481    pub fn set_accelerator(&self, accelerator: Option<&str>) {
482        ObjectExt::set_property(self, "accelerator", accelerator)
483    }
484
485    /// A detailed action name.
486    ///
487    /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
488    /// then GTK will use the accelerators that are associated with the
489    /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
490    /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
491    ///
492    /// # Deprecated since 4.18
493    ///
494    /// This widget will be removed in GTK 5
495    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
496    #[doc(alias = "action-name")]
497    pub fn action_name(&self) -> Option<glib::GString> {
498        ObjectExt::property(self, "action-name")
499    }
500
501    /// A detailed action name.
502    ///
503    /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
504    /// then GTK will use the accelerators that are associated with the
505    /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
506    /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
507    ///
508    /// # Deprecated since 4.18
509    ///
510    /// This widget will be removed in GTK 5
511    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
512    #[doc(alias = "action-name")]
513    pub fn set_action_name(&self, action_name: Option<&str>) {
514        ObjectExt::set_property(self, "action-name", action_name)
515    }
516
517    /// An icon to represent the shortcut or gesture.
518    ///
519    /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
520    /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
521    ///
522    /// For the other predefined gesture types, GTK provides an icon on its own.
523    ///
524    /// # Deprecated since 4.18
525    ///
526    /// This widget will be removed in GTK 5
527    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
528    pub fn icon(&self) -> Option<gio::Icon> {
529        ObjectExt::property(self, "icon")
530    }
531
532    /// An icon to represent the shortcut or gesture.
533    ///
534    /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
535    /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
536    ///
537    /// For the other predefined gesture types, GTK provides an icon on its own.
538    ///
539    /// # Deprecated since 4.18
540    ///
541    /// This widget will be removed in GTK 5
542    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
543    pub fn set_icon<P: IsA<gio::Icon>>(&self, icon: Option<&P>) {
544        ObjectExt::set_property(self, "icon", icon)
545    }
546
547    /// [`true`] if an icon has been set.
548    ///
549    /// # Deprecated since 4.18
550    ///
551    /// This widget will be removed in GTK 5
552    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
553    #[doc(alias = "icon-set")]
554    pub fn is_icon_set(&self) -> bool {
555        ObjectExt::property(self, "icon-set")
556    }
557
558    /// The type of shortcut that is represented.
559    ///
560    /// # Deprecated since 4.18
561    ///
562    /// This widget will be removed in GTK 5
563    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
564    #[doc(alias = "shortcut-type")]
565    pub fn shortcut_type(&self) -> ShortcutType {
566        ObjectExt::property(self, "shortcut-type")
567    }
568
569    /// The type of shortcut that is represented.
570    ///
571    /// # Deprecated since 4.18
572    ///
573    /// This widget will be removed in GTK 5
574    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
575    #[doc(alias = "shortcut-type")]
576    pub fn set_shortcut_type(&self, shortcut_type: ShortcutType) {
577        ObjectExt::set_property(self, "shortcut-type", shortcut_type)
578    }
579
580    /// The subtitle for the shortcut or gesture.
581    ///
582    /// This is typically used for gestures and should be a short, one-line
583    /// text that describes the gesture itself. For the predefined gesture
584    /// types, GTK provides a subtitle on its own.
585    ///
586    /// # Deprecated since 4.18
587    ///
588    /// This widget will be removed in GTK 5
589    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
590    pub fn subtitle(&self) -> Option<glib::GString> {
591        ObjectExt::property(self, "subtitle")
592    }
593
594    /// The subtitle for the shortcut or gesture.
595    ///
596    /// This is typically used for gestures and should be a short, one-line
597    /// text that describes the gesture itself. For the predefined gesture
598    /// types, GTK provides a subtitle on its own.
599    ///
600    /// # Deprecated since 4.18
601    ///
602    /// This widget will be removed in GTK 5
603    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
604    pub fn set_subtitle(&self, subtitle: Option<&str>) {
605        ObjectExt::set_property(self, "subtitle", subtitle)
606    }
607
608    /// [`true`] if a subtitle has been set.
609    ///
610    /// # Deprecated since 4.18
611    ///
612    /// This widget will be removed in GTK 5
613    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
614    #[doc(alias = "subtitle-set")]
615    pub fn is_subtitle_set(&self) -> bool {
616        ObjectExt::property(self, "subtitle-set")
617    }
618
619    /// The textual description for the shortcut or gesture represented by
620    /// this object.
621    ///
622    /// This should be a short string that can fit in a single line.
623    ///
624    /// # Deprecated since 4.18
625    ///
626    /// This widget will be removed in GTK 5
627    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
628    pub fn title(&self) -> Option<glib::GString> {
629        ObjectExt::property(self, "title")
630    }
631
632    /// The textual description for the shortcut or gesture represented by
633    /// this object.
634    ///
635    /// This should be a short string that can fit in a single line.
636    ///
637    /// # Deprecated since 4.18
638    ///
639    /// This widget will be removed in GTK 5
640    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
641    pub fn set_title(&self, title: Option<&str>) {
642        ObjectExt::set_property(self, "title", title)
643    }
644
645    /// The size group for the textual portion of this shortcut.
646    ///
647    /// This is used internally by GTK, and must not be modified by applications.
648    ///
649    /// # Deprecated since 4.18
650    ///
651    /// This widget will be removed in GTK 5
652    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
653    #[doc(alias = "title-size-group")]
654    pub fn set_title_size_group(&self, title_size_group: Option<&SizeGroup>) {
655        ObjectExt::set_property(self, "title-size-group", title_size_group)
656    }
657
658    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
659    #[doc(alias = "accel-size-group")]
660    pub fn connect_accel_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
661        unsafe extern "C" fn notify_accel_size_group_trampoline<
662            F: Fn(&ShortcutsShortcut) + 'static,
663        >(
664            this: *mut ffi::GtkShortcutsShortcut,
665            _param_spec: glib::ffi::gpointer,
666            f: glib::ffi::gpointer,
667        ) {
668            unsafe {
669                let f: &F = &*(f as *const F);
670                f(&from_glib_borrow(this))
671            }
672        }
673        unsafe {
674            let f: Box_<F> = Box_::new(f);
675            connect_raw(
676                self.as_ptr() as *mut _,
677                c"notify::accel-size-group".as_ptr(),
678                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
679                    notify_accel_size_group_trampoline::<F> as *const (),
680                )),
681                Box_::into_raw(f),
682            )
683        }
684    }
685
686    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
687    #[doc(alias = "accelerator")]
688    pub fn connect_accelerator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
689        unsafe extern "C" fn notify_accelerator_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
690            this: *mut ffi::GtkShortcutsShortcut,
691            _param_spec: glib::ffi::gpointer,
692            f: glib::ffi::gpointer,
693        ) {
694            unsafe {
695                let f: &F = &*(f as *const F);
696                f(&from_glib_borrow(this))
697            }
698        }
699        unsafe {
700            let f: Box_<F> = Box_::new(f);
701            connect_raw(
702                self.as_ptr() as *mut _,
703                c"notify::accelerator".as_ptr(),
704                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
705                    notify_accelerator_trampoline::<F> as *const (),
706                )),
707                Box_::into_raw(f),
708            )
709        }
710    }
711
712    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
713    #[doc(alias = "action-name")]
714    pub fn connect_action_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
715        unsafe extern "C" fn notify_action_name_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
716            this: *mut ffi::GtkShortcutsShortcut,
717            _param_spec: glib::ffi::gpointer,
718            f: glib::ffi::gpointer,
719        ) {
720            unsafe {
721                let f: &F = &*(f as *const F);
722                f(&from_glib_borrow(this))
723            }
724        }
725        unsafe {
726            let f: Box_<F> = Box_::new(f);
727            connect_raw(
728                self.as_ptr() as *mut _,
729                c"notify::action-name".as_ptr(),
730                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
731                    notify_action_name_trampoline::<F> as *const (),
732                )),
733                Box_::into_raw(f),
734            )
735        }
736    }
737
738    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
739    #[doc(alias = "direction")]
740    pub fn connect_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
741        unsafe extern "C" fn notify_direction_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
742            this: *mut ffi::GtkShortcutsShortcut,
743            _param_spec: glib::ffi::gpointer,
744            f: glib::ffi::gpointer,
745        ) {
746            unsafe {
747                let f: &F = &*(f as *const F);
748                f(&from_glib_borrow(this))
749            }
750        }
751        unsafe {
752            let f: Box_<F> = Box_::new(f);
753            connect_raw(
754                self.as_ptr() as *mut _,
755                c"notify::direction".as_ptr(),
756                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
757                    notify_direction_trampoline::<F> as *const (),
758                )),
759                Box_::into_raw(f),
760            )
761        }
762    }
763
764    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
765    #[doc(alias = "icon")]
766    pub fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
767        unsafe extern "C" fn notify_icon_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
768            this: *mut ffi::GtkShortcutsShortcut,
769            _param_spec: glib::ffi::gpointer,
770            f: glib::ffi::gpointer,
771        ) {
772            unsafe {
773                let f: &F = &*(f as *const F);
774                f(&from_glib_borrow(this))
775            }
776        }
777        unsafe {
778            let f: Box_<F> = Box_::new(f);
779            connect_raw(
780                self.as_ptr() as *mut _,
781                c"notify::icon".as_ptr(),
782                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
783                    notify_icon_trampoline::<F> as *const (),
784                )),
785                Box_::into_raw(f),
786            )
787        }
788    }
789
790    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
791    #[doc(alias = "icon-set")]
792    pub fn connect_icon_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
793        unsafe extern "C" fn notify_icon_set_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
794            this: *mut ffi::GtkShortcutsShortcut,
795            _param_spec: glib::ffi::gpointer,
796            f: glib::ffi::gpointer,
797        ) {
798            unsafe {
799                let f: &F = &*(f as *const F);
800                f(&from_glib_borrow(this))
801            }
802        }
803        unsafe {
804            let f: Box_<F> = Box_::new(f);
805            connect_raw(
806                self.as_ptr() as *mut _,
807                c"notify::icon-set".as_ptr(),
808                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
809                    notify_icon_set_trampoline::<F> as *const (),
810                )),
811                Box_::into_raw(f),
812            )
813        }
814    }
815
816    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
817    #[doc(alias = "shortcut-type")]
818    pub fn connect_shortcut_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
819        unsafe extern "C" fn notify_shortcut_type_trampoline<
820            F: Fn(&ShortcutsShortcut) + 'static,
821        >(
822            this: *mut ffi::GtkShortcutsShortcut,
823            _param_spec: glib::ffi::gpointer,
824            f: glib::ffi::gpointer,
825        ) {
826            unsafe {
827                let f: &F = &*(f as *const F);
828                f(&from_glib_borrow(this))
829            }
830        }
831        unsafe {
832            let f: Box_<F> = Box_::new(f);
833            connect_raw(
834                self.as_ptr() as *mut _,
835                c"notify::shortcut-type".as_ptr(),
836                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
837                    notify_shortcut_type_trampoline::<F> as *const (),
838                )),
839                Box_::into_raw(f),
840            )
841        }
842    }
843
844    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
845    #[doc(alias = "subtitle")]
846    pub fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
847        unsafe extern "C" fn notify_subtitle_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
848            this: *mut ffi::GtkShortcutsShortcut,
849            _param_spec: glib::ffi::gpointer,
850            f: glib::ffi::gpointer,
851        ) {
852            unsafe {
853                let f: &F = &*(f as *const F);
854                f(&from_glib_borrow(this))
855            }
856        }
857        unsafe {
858            let f: Box_<F> = Box_::new(f);
859            connect_raw(
860                self.as_ptr() as *mut _,
861                c"notify::subtitle".as_ptr(),
862                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
863                    notify_subtitle_trampoline::<F> as *const (),
864                )),
865                Box_::into_raw(f),
866            )
867        }
868    }
869
870    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
871    #[doc(alias = "subtitle-set")]
872    pub fn connect_subtitle_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
873        unsafe extern "C" fn notify_subtitle_set_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
874            this: *mut ffi::GtkShortcutsShortcut,
875            _param_spec: glib::ffi::gpointer,
876            f: glib::ffi::gpointer,
877        ) {
878            unsafe {
879                let f: &F = &*(f as *const F);
880                f(&from_glib_borrow(this))
881            }
882        }
883        unsafe {
884            let f: Box_<F> = Box_::new(f);
885            connect_raw(
886                self.as_ptr() as *mut _,
887                c"notify::subtitle-set".as_ptr(),
888                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
889                    notify_subtitle_set_trampoline::<F> as *const (),
890                )),
891                Box_::into_raw(f),
892            )
893        }
894    }
895
896    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
897    #[doc(alias = "title")]
898    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
899        unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
900            this: *mut ffi::GtkShortcutsShortcut,
901            _param_spec: glib::ffi::gpointer,
902            f: glib::ffi::gpointer,
903        ) {
904            unsafe {
905                let f: &F = &*(f as *const F);
906                f(&from_glib_borrow(this))
907            }
908        }
909        unsafe {
910            let f: Box_<F> = Box_::new(f);
911            connect_raw(
912                self.as_ptr() as *mut _,
913                c"notify::title".as_ptr(),
914                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
915                    notify_title_trampoline::<F> as *const (),
916                )),
917                Box_::into_raw(f),
918            )
919        }
920    }
921
922    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
923    #[doc(alias = "title-size-group")]
924    pub fn connect_title_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
925        unsafe extern "C" fn notify_title_size_group_trampoline<
926            F: Fn(&ShortcutsShortcut) + 'static,
927        >(
928            this: *mut ffi::GtkShortcutsShortcut,
929            _param_spec: glib::ffi::gpointer,
930            f: glib::ffi::gpointer,
931        ) {
932            unsafe {
933                let f: &F = &*(f as *const F);
934                f(&from_glib_borrow(this))
935            }
936        }
937        unsafe {
938            let f: Box_<F> = Box_::new(f);
939            connect_raw(
940                self.as_ptr() as *mut _,
941                c"notify::title-size-group".as_ptr(),
942                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
943                    notify_title_size_group_trampoline::<F> as *const (),
944                )),
945                Box_::into_raw(f),
946            )
947        }
948    }
949}
950
951// rustdoc-stripper-ignore-next
952/// A [builder-pattern] type to construct [`ShortcutsShortcut`] objects.
953///
954/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
955#[must_use = "The builder must be built to be used"]
956pub struct ShortcutsShortcutBuilder {
957    builder: glib::object::ObjectBuilder<'static, ShortcutsShortcut>,
958}
959
960impl ShortcutsShortcutBuilder {
961    fn new() -> Self {
962        Self {
963            builder: glib::object::Object::builder(),
964        }
965    }
966
967    /// The size group for the accelerator portion of this shortcut.
968    ///
969    /// This is used internally by GTK, and must not be modified by applications.
970    /// This widget will be removed in GTK 5
971    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
972    pub fn accel_size_group(self, accel_size_group: &SizeGroup) -> Self {
973        Self {
974            builder: self
975                .builder
976                .property("accel-size-group", accel_size_group.clone()),
977        }
978    }
979
980    /// amp`; when used
981    /// in .ui files.
982    /// This widget will be removed in GTK 5
983    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
984    pub fn accelerator(self, accelerator: impl Into<glib::GString>) -> Self {
985        Self {
986            builder: self.builder.property("accelerator", accelerator.into()),
987        }
988    }
989
990    /// A detailed action name.
991    ///
992    /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
993    /// then GTK will use the accelerators that are associated with the
994    /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
995    /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
996    /// This widget will be removed in GTK 5
997    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
998    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
999        Self {
1000            builder: self.builder.property("action-name", action_name.into()),
1001        }
1002    }
1003
1004    /// The text direction for which this shortcut is active.
1005    ///
1006    /// If the shortcut is used regardless of the text direction,
1007    /// set this property to [`TextDirection::None`][crate::TextDirection::None].
1008    /// This widget will be removed in GTK 5
1009    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1010    pub fn direction(self, direction: TextDirection) -> Self {
1011        Self {
1012            builder: self.builder.property("direction", direction),
1013        }
1014    }
1015
1016    /// An icon to represent the shortcut or gesture.
1017    ///
1018    /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
1019    /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
1020    ///
1021    /// For the other predefined gesture types, GTK provides an icon on its own.
1022    /// This widget will be removed in GTK 5
1023    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1024    pub fn icon(self, icon: &impl IsA<gio::Icon>) -> Self {
1025        Self {
1026            builder: self.builder.property("icon", icon.clone().upcast()),
1027        }
1028    }
1029
1030    /// [`true`] if an icon has been set.
1031    /// This widget will be removed in GTK 5
1032    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1033    pub fn icon_set(self, icon_set: bool) -> Self {
1034        Self {
1035            builder: self.builder.property("icon-set", icon_set),
1036        }
1037    }
1038
1039    /// The type of shortcut that is represented.
1040    /// This widget will be removed in GTK 5
1041    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1042    pub fn shortcut_type(self, shortcut_type: ShortcutType) -> Self {
1043        Self {
1044            builder: self.builder.property("shortcut-type", shortcut_type),
1045        }
1046    }
1047
1048    /// The subtitle for the shortcut or gesture.
1049    ///
1050    /// This is typically used for gestures and should be a short, one-line
1051    /// text that describes the gesture itself. For the predefined gesture
1052    /// types, GTK provides a subtitle on its own.
1053    /// This widget will be removed in GTK 5
1054    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1055    pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
1056        Self {
1057            builder: self.builder.property("subtitle", subtitle.into()),
1058        }
1059    }
1060
1061    /// [`true`] if a subtitle has been set.
1062    /// This widget will be removed in GTK 5
1063    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1064    pub fn subtitle_set(self, subtitle_set: bool) -> Self {
1065        Self {
1066            builder: self.builder.property("subtitle-set", subtitle_set),
1067        }
1068    }
1069
1070    /// The textual description for the shortcut or gesture represented by
1071    /// this object.
1072    ///
1073    /// This should be a short string that can fit in a single line.
1074    /// This widget will be removed in GTK 5
1075    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1076    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1077        Self {
1078            builder: self.builder.property("title", title.into()),
1079        }
1080    }
1081
1082    /// The size group for the textual portion of this shortcut.
1083    ///
1084    /// This is used internally by GTK, and must not be modified by applications.
1085    /// This widget will be removed in GTK 5
1086    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1087    pub fn title_size_group(self, title_size_group: &SizeGroup) -> Self {
1088        Self {
1089            builder: self
1090                .builder
1091                .property("title-size-group", title_size_group.clone()),
1092        }
1093    }
1094
1095    /// Whether the widget or any of its descendents can accept
1096    /// the input focus.
1097    ///
1098    /// This property is meant to be set by widget implementations,
1099    /// typically in their instance init function.
1100    pub fn can_focus(self, can_focus: bool) -> Self {
1101        Self {
1102            builder: self.builder.property("can-focus", can_focus),
1103        }
1104    }
1105
1106    /// Whether the widget can receive pointer events.
1107    pub fn can_target(self, can_target: bool) -> Self {
1108        Self {
1109            builder: self.builder.property("can-target", can_target),
1110        }
1111    }
1112
1113    /// A list of css classes applied to this widget.
1114    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1115        Self {
1116            builder: self.builder.property("css-classes", css_classes.into()),
1117        }
1118    }
1119
1120    /// The name of this widget in the CSS tree.
1121    ///
1122    /// This property is meant to be set by widget implementations,
1123    /// typically in their instance init function.
1124    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1125        Self {
1126            builder: self.builder.property("css-name", css_name.into()),
1127        }
1128    }
1129
1130    /// The cursor used by @widget.
1131    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1132        Self {
1133            builder: self.builder.property("cursor", cursor.clone()),
1134        }
1135    }
1136
1137    /// Whether the widget should grab focus when it is clicked with the mouse.
1138    ///
1139    /// This property is only relevant for widgets that can take focus.
1140    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1141        Self {
1142            builder: self.builder.property("focus-on-click", focus_on_click),
1143        }
1144    }
1145
1146    /// Whether this widget itself will accept the input focus.
1147    pub fn focusable(self, focusable: bool) -> Self {
1148        Self {
1149            builder: self.builder.property("focusable", focusable),
1150        }
1151    }
1152
1153    /// How to distribute horizontal space if widget gets extra space.
1154    pub fn halign(self, halign: Align) -> Self {
1155        Self {
1156            builder: self.builder.property("halign", halign),
1157        }
1158    }
1159
1160    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1161    /// signal on @widget.
1162    ///
1163    /// A true value indicates that @widget can have a tooltip, in this case
1164    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1165    /// determine whether it will provide a tooltip or not.
1166    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1167        Self {
1168            builder: self.builder.property("has-tooltip", has_tooltip),
1169        }
1170    }
1171
1172    /// Overrides for height request of the widget.
1173    ///
1174    /// If this is -1, the natural request will be used.
1175    pub fn height_request(self, height_request: i32) -> Self {
1176        Self {
1177            builder: self.builder.property("height-request", height_request),
1178        }
1179    }
1180
1181    /// Whether to expand horizontally.
1182    pub fn hexpand(self, hexpand: bool) -> Self {
1183        Self {
1184            builder: self.builder.property("hexpand", hexpand),
1185        }
1186    }
1187
1188    /// Whether to use the `hexpand` property.
1189    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1190        Self {
1191            builder: self.builder.property("hexpand-set", hexpand_set),
1192        }
1193    }
1194
1195    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1196    /// the preferred size of the widget, and allocate its children.
1197    ///
1198    /// This property is meant to be set by widget implementations,
1199    /// typically in their instance init function.
1200    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1201        Self {
1202            builder: self
1203                .builder
1204                .property("layout-manager", layout_manager.clone().upcast()),
1205        }
1206    }
1207
1208    /// Makes this widget act like a modal dialog, with respect to
1209    /// event delivery.
1210    ///
1211    /// Global event controllers will not handle events with targets
1212    /// inside the widget, unless they are set up to ignore propagation
1213    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1214    #[cfg(feature = "v4_18")]
1215    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1216    pub fn limit_events(self, limit_events: bool) -> Self {
1217        Self {
1218            builder: self.builder.property("limit-events", limit_events),
1219        }
1220    }
1221
1222    /// Margin on bottom side of widget.
1223    ///
1224    /// This property adds margin outside of the widget's normal size
1225    /// request, the margin will be added in addition to the size from
1226    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1227    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1228        Self {
1229            builder: self.builder.property("margin-bottom", margin_bottom),
1230        }
1231    }
1232
1233    /// Margin on end of widget, horizontally.
1234    ///
1235    /// This property supports left-to-right and right-to-left text
1236    /// directions.
1237    ///
1238    /// This property adds margin outside of the widget's normal size
1239    /// request, the margin will be added in addition to the size from
1240    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1241    pub fn margin_end(self, margin_end: i32) -> Self {
1242        Self {
1243            builder: self.builder.property("margin-end", margin_end),
1244        }
1245    }
1246
1247    /// Margin on start of widget, horizontally.
1248    ///
1249    /// This property supports left-to-right and right-to-left text
1250    /// directions.
1251    ///
1252    /// This property adds margin outside of the widget's normal size
1253    /// request, the margin will be added in addition to the size from
1254    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1255    pub fn margin_start(self, margin_start: i32) -> Self {
1256        Self {
1257            builder: self.builder.property("margin-start", margin_start),
1258        }
1259    }
1260
1261    /// Margin on top side of widget.
1262    ///
1263    /// This property adds margin outside of the widget's normal size
1264    /// request, the margin will be added in addition to the size from
1265    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1266    pub fn margin_top(self, margin_top: i32) -> Self {
1267        Self {
1268            builder: self.builder.property("margin-top", margin_top),
1269        }
1270    }
1271
1272    /// The name of the widget.
1273    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1274        Self {
1275            builder: self.builder.property("name", name.into()),
1276        }
1277    }
1278
1279    /// The requested opacity of the widget.
1280    pub fn opacity(self, opacity: f64) -> Self {
1281        Self {
1282            builder: self.builder.property("opacity", opacity),
1283        }
1284    }
1285
1286    /// How content outside the widget's content area is treated.
1287    ///
1288    /// This property is meant to be set by widget implementations,
1289    /// typically in their instance init function.
1290    pub fn overflow(self, overflow: Overflow) -> Self {
1291        Self {
1292            builder: self.builder.property("overflow", overflow),
1293        }
1294    }
1295
1296    /// Whether the widget will receive the default action when it is focused.
1297    pub fn receives_default(self, receives_default: bool) -> Self {
1298        Self {
1299            builder: self.builder.property("receives-default", receives_default),
1300        }
1301    }
1302
1303    /// Whether the widget responds to input.
1304    pub fn sensitive(self, sensitive: bool) -> Self {
1305        Self {
1306            builder: self.builder.property("sensitive", sensitive),
1307        }
1308    }
1309
1310    /// Sets the text of tooltip to be the given string, which is marked up
1311    /// with Pango markup.
1312    ///
1313    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1314    ///
1315    /// This is a convenience property which will take care of getting the
1316    /// tooltip shown if the given string is not `NULL`:
1317    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1318    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1319    /// the default signal handler.
1320    ///
1321    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1322    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1323    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1324        Self {
1325            builder: self
1326                .builder
1327                .property("tooltip-markup", tooltip_markup.into()),
1328        }
1329    }
1330
1331    /// Sets the text of tooltip to be the given string.
1332    ///
1333    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1334    ///
1335    /// This is a convenience property which will take care of getting the
1336    /// tooltip shown if the given string is not `NULL`:
1337    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1338    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1339    /// the default signal handler.
1340    ///
1341    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1342    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1343    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1344        Self {
1345            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1346        }
1347    }
1348
1349    /// How to distribute vertical space if widget gets extra space.
1350    pub fn valign(self, valign: Align) -> Self {
1351        Self {
1352            builder: self.builder.property("valign", valign),
1353        }
1354    }
1355
1356    /// Whether to expand vertically.
1357    pub fn vexpand(self, vexpand: bool) -> Self {
1358        Self {
1359            builder: self.builder.property("vexpand", vexpand),
1360        }
1361    }
1362
1363    /// Whether to use the `vexpand` property.
1364    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1365        Self {
1366            builder: self.builder.property("vexpand-set", vexpand_set),
1367        }
1368    }
1369
1370    /// Whether the widget is visible.
1371    pub fn visible(self, visible: bool) -> Self {
1372        Self {
1373            builder: self.builder.property("visible", visible),
1374        }
1375    }
1376
1377    /// Overrides for width request of the widget.
1378    ///
1379    /// If this is -1, the natural request will be used.
1380    pub fn width_request(self, width_request: i32) -> Self {
1381        Self {
1382            builder: self.builder.property("width-request", width_request),
1383        }
1384    }
1385
1386    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1387    ///
1388    /// The accessible role cannot be changed once set.
1389    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1390        Self {
1391            builder: self.builder.property("accessible-role", accessible_role),
1392        }
1393    }
1394
1395    // rustdoc-stripper-ignore-next
1396    /// Build the [`ShortcutsShortcut`].
1397    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1398    pub fn build(self) -> ShortcutsShortcut {
1399        assert_initialized_main_thread!();
1400        self.builder.build()
1401    }
1402}