Skip to main content

gtk4/auto/
shortcuts_group.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;
9#[cfg(feature = "v4_14")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
11use crate::ShortcutsShortcut;
12use crate::{
13    AccessibleRole, Align, BaselinePosition, Box, Buildable, ConstraintTarget, LayoutManager,
14    Orientable, Orientation, Overflow, SizeGroup, Widget, ffi,
15};
16use glib::{
17    prelude::*,
18    signal::{SignalHandlerId, connect_raw},
19    translate::*,
20};
21use std::boxed::Box as Box_;
22
23#[cfg(feature = "v4_10")]
24#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
25glib::wrapper! {
26    /// This widget will be removed in GTK 5
27    /// A [`ShortcutsGroup`][crate::ShortcutsGroup] represents a group of related keyboard shortcuts
28    /// or gestures.
29    ///
30    /// The group has a title. It may optionally be associated with a view
31    /// of the application, which can be used to show only relevant shortcuts
32    /// depending on the application context.
33    ///
34    /// This widget is only meant to be used with [`ShortcutsWindow`][crate::ShortcutsWindow].
35    ///
36    /// The recommended way to construct a [`ShortcutsGroup`][crate::ShortcutsGroup] is with
37    /// [`Builder`][crate::Builder], by using the `<child>` tag to populate a
38    /// [`ShortcutsGroup`][crate::ShortcutsGroup] with one or more [`ShortcutsShortcut`][crate::ShortcutsShortcut]
39    /// instances.
40    ///
41    /// If you need to add a shortcut programmatically, use
42    /// [`add_shortcut()`][Self::add_shortcut()].
43    ///
44    /// ## Properties
45    ///
46    ///
47    /// #### `accel-size-group`
48    ///  The size group for the accelerator portion of shortcuts in this group.
49    ///
50    /// This is used internally by GTK, and must not be modified by applications.
51    ///
52    /// Writable
53    ///
54    ///
55    /// #### `height`
56    ///  A rough measure for the number of lines in this group.
57    ///
58    /// This is used internally by GTK, and is not useful for applications.
59    ///
60    /// Readable
61    ///
62    ///
63    /// #### `title`
64    ///  The title for this group of shortcuts.
65    ///
66    /// Readable | Writable
67    ///
68    ///
69    /// #### `title-size-group`
70    ///  The size group for the textual portion of shortcuts in this group.
71    ///
72    /// This is used internally by GTK, and must not be modified by applications.
73    ///
74    /// Writable
75    ///
76    ///
77    /// #### `view`
78    ///  An optional view that the shortcuts in this group are relevant for.
79    ///
80    /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name]
81    /// property does not match the view of this group.
82    ///
83    /// Set this to [`None`] to make the group always visible.
84    ///
85    /// Readable | Writable
86    /// <details><summary><h4>Box</h4></summary>
87    ///
88    ///
89    /// #### `baseline-child`
90    ///  The position of the child that determines the baseline.
91    ///
92    /// This is only relevant if the box is in vertical orientation.
93    ///
94    /// Readable | Writable
95    ///
96    ///
97    /// #### `baseline-position`
98    ///  How to position baseline-aligned widgets if extra space is available.
99    ///
100    /// Readable | Writable
101    ///
102    ///
103    /// #### `homogeneous`
104    ///  Whether the children should all be the same size.
105    ///
106    /// Readable | Writable
107    ///
108    ///
109    /// #### `spacing`
110    ///  The amount of space between children.
111    ///
112    /// Readable | Writable
113    /// </details>
114    /// <details><summary><h4>Widget</h4></summary>
115    ///
116    ///
117    /// #### `can-focus`
118    ///  Whether the widget or any of its descendents can accept
119    /// the input focus.
120    ///
121    /// This property is meant to be set by widget implementations,
122    /// typically in their instance init function.
123    ///
124    /// Readable | Writable
125    ///
126    ///
127    /// #### `can-target`
128    ///  Whether the widget can receive pointer events.
129    ///
130    /// Readable | Writable
131    ///
132    ///
133    /// #### `css-classes`
134    ///  A list of css classes applied to this widget.
135    ///
136    /// Readable | Writable
137    ///
138    ///
139    /// #### `css-name`
140    ///  The name of this widget in the CSS tree.
141    ///
142    /// This property is meant to be set by widget implementations,
143    /// typically in their instance init function.
144    ///
145    /// Readable | Writable | Construct Only
146    ///
147    ///
148    /// #### `cursor`
149    ///  The cursor used by @widget.
150    ///
151    /// Readable | Writable
152    ///
153    ///
154    /// #### `focus-on-click`
155    ///  Whether the widget should grab focus when it is clicked with the mouse.
156    ///
157    /// This property is only relevant for widgets that can take focus.
158    ///
159    /// Readable | Writable
160    ///
161    ///
162    /// #### `focusable`
163    ///  Whether this widget itself will accept the input focus.
164    ///
165    /// Readable | Writable
166    ///
167    ///
168    /// #### `halign`
169    ///  How to distribute horizontal space if widget gets extra space.
170    ///
171    /// Readable | Writable
172    ///
173    ///
174    /// #### `has-default`
175    ///  Whether the widget is the default widget.
176    ///
177    /// Readable
178    ///
179    ///
180    /// #### `has-focus`
181    ///  Whether the widget has the input focus.
182    ///
183    /// Readable
184    ///
185    ///
186    /// #### `has-tooltip`
187    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
188    /// signal on @widget.
189    ///
190    /// A true value indicates that @widget can have a tooltip, in this case
191    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
192    /// determine whether it will provide a tooltip or not.
193    ///
194    /// Readable | Writable
195    ///
196    ///
197    /// #### `height-request`
198    ///  Overrides for height request of the widget.
199    ///
200    /// If this is -1, the natural request will be used.
201    ///
202    /// Readable | Writable
203    ///
204    ///
205    /// #### `hexpand`
206    ///  Whether to expand horizontally.
207    ///
208    /// Readable | Writable
209    ///
210    ///
211    /// #### `hexpand-set`
212    ///  Whether to use the `hexpand` property.
213    ///
214    /// Readable | Writable
215    ///
216    ///
217    /// #### `layout-manager`
218    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
219    /// the preferred size of the widget, and allocate its children.
220    ///
221    /// This property is meant to be set by widget implementations,
222    /// typically in their instance init function.
223    ///
224    /// Readable | Writable
225    ///
226    ///
227    /// #### `limit-events`
228    ///  Makes this widget act like a modal dialog, with respect to
229    /// event delivery.
230    ///
231    /// Global event controllers will not handle events with targets
232    /// inside the widget, unless they are set up to ignore propagation
233    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
234    ///
235    /// Readable | Writable
236    ///
237    ///
238    /// #### `margin-bottom`
239    ///  Margin on bottom side of widget.
240    ///
241    /// This property adds margin outside of the widget's normal size
242    /// request, the margin will be added in addition to the size from
243    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
244    ///
245    /// Readable | Writable
246    ///
247    ///
248    /// #### `margin-end`
249    ///  Margin on end of widget, horizontally.
250    ///
251    /// This property supports left-to-right and right-to-left text
252    /// directions.
253    ///
254    /// This property adds margin outside of the widget's normal size
255    /// request, the margin will be added in addition to the size from
256    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
257    ///
258    /// Readable | Writable
259    ///
260    ///
261    /// #### `margin-start`
262    ///  Margin on start of widget, horizontally.
263    ///
264    /// This property supports left-to-right and right-to-left text
265    /// directions.
266    ///
267    /// This property adds margin outside of the widget's normal size
268    /// request, the margin will be added in addition to the size from
269    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
270    ///
271    /// Readable | Writable
272    ///
273    ///
274    /// #### `margin-top`
275    ///  Margin on top side of widget.
276    ///
277    /// This property adds margin outside of the widget's normal size
278    /// request, the margin will be added in addition to the size from
279    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
280    ///
281    /// Readable | Writable
282    ///
283    ///
284    /// #### `name`
285    ///  The name of the widget.
286    ///
287    /// Readable | Writable
288    ///
289    ///
290    /// #### `opacity`
291    ///  The requested opacity of the widget.
292    ///
293    /// Readable | Writable
294    ///
295    ///
296    /// #### `overflow`
297    ///  How content outside the widget's content area is treated.
298    ///
299    /// This property is meant to be set by widget implementations,
300    /// typically in their instance init function.
301    ///
302    /// Readable | Writable
303    ///
304    ///
305    /// #### `parent`
306    ///  The parent widget of this widget.
307    ///
308    /// Readable
309    ///
310    ///
311    /// #### `receives-default`
312    ///  Whether the widget will receive the default action when it is focused.
313    ///
314    /// Readable | Writable
315    ///
316    ///
317    /// #### `root`
318    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
319    ///
320    /// This will be `NULL` if the widget is not contained in a root widget.
321    ///
322    /// Readable
323    ///
324    ///
325    /// #### `scale-factor`
326    ///  The scale factor of the widget.
327    ///
328    /// Readable
329    ///
330    ///
331    /// #### `sensitive`
332    ///  Whether the widget responds to input.
333    ///
334    /// Readable | Writable
335    ///
336    ///
337    /// #### `tooltip-markup`
338    ///  Sets the text of tooltip to be the given string, which is marked up
339    /// with Pango markup.
340    ///
341    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
342    ///
343    /// This is a convenience property which will take care of getting the
344    /// tooltip shown if the given string is not `NULL`:
345    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
346    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
347    /// the default signal handler.
348    ///
349    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
350    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
351    ///
352    /// Readable | Writable
353    ///
354    ///
355    /// #### `tooltip-text`
356    ///  Sets the text of tooltip to be the given string.
357    ///
358    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
359    ///
360    /// This is a convenience property which will take care of getting the
361    /// tooltip shown if the given string is not `NULL`:
362    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
363    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
364    /// the default signal handler.
365    ///
366    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
367    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
368    ///
369    /// Readable | Writable
370    ///
371    ///
372    /// #### `valign`
373    ///  How to distribute vertical space if widget gets extra space.
374    ///
375    /// Readable | Writable
376    ///
377    ///
378    /// #### `vexpand`
379    ///  Whether to expand vertically.
380    ///
381    /// Readable | Writable
382    ///
383    ///
384    /// #### `vexpand-set`
385    ///  Whether to use the `vexpand` property.
386    ///
387    /// Readable | Writable
388    ///
389    ///
390    /// #### `visible`
391    ///  Whether the widget is visible.
392    ///
393    /// Readable | Writable
394    ///
395    ///
396    /// #### `width-request`
397    ///  Overrides for width request of the widget.
398    ///
399    /// If this is -1, the natural request will be used.
400    ///
401    /// Readable | Writable
402    /// </details>
403    /// <details><summary><h4>Accessible</h4></summary>
404    ///
405    ///
406    /// #### `accessible-role`
407    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
408    ///
409    /// The accessible role cannot be changed once set.
410    ///
411    /// Readable | Writable
412    /// </details>
413    /// <details><summary><h4>Orientable</h4></summary>
414    ///
415    ///
416    /// #### `orientation`
417    ///  The orientation of the orientable.
418    ///
419    /// Readable | Writable
420    /// </details>
421    ///
422    /// # Implements
423    ///
424    /// [`BoxExt`][trait@crate::prelude::BoxExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
425    #[doc(alias = "GtkShortcutsGroup")]
426    pub struct ShortcutsGroup(Object<ffi::GtkShortcutsGroup, ffi::GtkShortcutsGroupClass>) @extends Box, Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
427
428    match fn {
429        type_ => || ffi::gtk_shortcuts_group_get_type(),
430    }
431}
432
433#[cfg(not(feature = "v4_10"))]
434glib::wrapper! {
435    #[doc(alias = "GtkShortcutsGroup")]
436    pub struct ShortcutsGroup(Object<ffi::GtkShortcutsGroup, ffi::GtkShortcutsGroupClass>) @extends Box, Widget, @implements Buildable, ConstraintTarget, Orientable;
437
438    match fn {
439        type_ => || ffi::gtk_shortcuts_group_get_type(),
440    }
441}
442
443impl ShortcutsGroup {
444    // rustdoc-stripper-ignore-next
445    /// Creates a new builder-pattern struct instance to construct [`ShortcutsGroup`] objects.
446    ///
447    /// This method returns an instance of [`ShortcutsGroupBuilder`](crate::builders::ShortcutsGroupBuilder) which can be used to create [`ShortcutsGroup`] objects.
448    pub fn builder() -> ShortcutsGroupBuilder {
449        ShortcutsGroupBuilder::new()
450    }
451
452    /// Adds a shortcut to the shortcuts group.
453    ///
454    /// This is the programmatic equivalent to using [`Builder`][crate::Builder] and a
455    /// `<child>` tag to add the child. Adding children with other API is not
456    /// appropriate as [`ShortcutsGroup`][crate::ShortcutsGroup] manages its children internally.
457    ///
458    /// # Deprecated since 4.18
459    ///
460    /// This widget will be removed in GTK 5
461    /// ## `shortcut`
462    /// the [`ShortcutsShortcut`][crate::ShortcutsShortcut] to add
463    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
464    #[cfg(feature = "v4_14")]
465    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
466    #[allow(deprecated)]
467    #[doc(alias = "gtk_shortcuts_group_add_shortcut")]
468    pub fn add_shortcut(&self, shortcut: &ShortcutsShortcut) {
469        unsafe {
470            ffi::gtk_shortcuts_group_add_shortcut(self.to_glib_none().0, shortcut.to_glib_none().0);
471        }
472    }
473
474    /// The size group for the accelerator portion of shortcuts in this group.
475    ///
476    /// This is used internally by GTK, and must not be modified by applications.
477    ///
478    /// # Deprecated since 4.18
479    ///
480    /// This widget will be removed in GTK 5
481    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
482    #[doc(alias = "accel-size-group")]
483    pub fn set_accel_size_group(&self, accel_size_group: Option<&SizeGroup>) {
484        ObjectExt::set_property(self, "accel-size-group", accel_size_group)
485    }
486
487    /// A rough measure for the number of lines in this group.
488    ///
489    /// This is used internally by GTK, and is not useful for applications.
490    ///
491    /// # Deprecated since 4.18
492    ///
493    /// This widget will be removed in GTK 5
494    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
495    pub fn height(&self) -> u32 {
496        ObjectExt::property(self, "height")
497    }
498
499    /// The title for this group of shortcuts.
500    ///
501    /// # Deprecated since 4.18
502    ///
503    /// This widget will be removed in GTK 5
504    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
505    pub fn title(&self) -> Option<glib::GString> {
506        ObjectExt::property(self, "title")
507    }
508
509    /// The title for this group of shortcuts.
510    ///
511    /// # Deprecated since 4.18
512    ///
513    /// This widget will be removed in GTK 5
514    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
515    pub fn set_title(&self, title: Option<&str>) {
516        ObjectExt::set_property(self, "title", title)
517    }
518
519    /// The size group for the textual portion of shortcuts in this group.
520    ///
521    /// This is used internally by GTK, and must not be modified by applications.
522    ///
523    /// # Deprecated since 4.18
524    ///
525    /// This widget will be removed in GTK 5
526    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
527    #[doc(alias = "title-size-group")]
528    pub fn set_title_size_group(&self, title_size_group: Option<&SizeGroup>) {
529        ObjectExt::set_property(self, "title-size-group", title_size_group)
530    }
531
532    /// An optional view that the shortcuts in this group are relevant for.
533    ///
534    /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name]
535    /// property does not match the view of this group.
536    ///
537    /// Set this to [`None`] to make the group always visible.
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 view(&self) -> Option<glib::GString> {
544        ObjectExt::property(self, "view")
545    }
546
547    /// An optional view that the shortcuts in this group are relevant for.
548    ///
549    /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name]
550    /// property does not match the view of this group.
551    ///
552    /// Set this to [`None`] to make the group always visible.
553    ///
554    /// # Deprecated since 4.18
555    ///
556    /// This widget will be removed in GTK 5
557    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
558    pub fn set_view(&self, view: Option<&str>) {
559        ObjectExt::set_property(self, "view", view)
560    }
561
562    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
563    #[doc(alias = "accel-size-group")]
564    pub fn connect_accel_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
565        unsafe extern "C" fn notify_accel_size_group_trampoline<
566            F: Fn(&ShortcutsGroup) + 'static,
567        >(
568            this: *mut ffi::GtkShortcutsGroup,
569            _param_spec: glib::ffi::gpointer,
570            f: glib::ffi::gpointer,
571        ) {
572            unsafe {
573                let f: &F = &*(f as *const F);
574                f(&from_glib_borrow(this))
575            }
576        }
577        unsafe {
578            let f: Box_<F> = Box_::new(f);
579            connect_raw(
580                self.as_ptr() as *mut _,
581                c"notify::accel-size-group".as_ptr(),
582                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
583                    notify_accel_size_group_trampoline::<F> as *const (),
584                )),
585                Box_::into_raw(f),
586            )
587        }
588    }
589
590    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
591    #[doc(alias = "height")]
592    pub fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
593        unsafe extern "C" fn notify_height_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
594            this: *mut ffi::GtkShortcutsGroup,
595            _param_spec: glib::ffi::gpointer,
596            f: glib::ffi::gpointer,
597        ) {
598            unsafe {
599                let f: &F = &*(f as *const F);
600                f(&from_glib_borrow(this))
601            }
602        }
603        unsafe {
604            let f: Box_<F> = Box_::new(f);
605            connect_raw(
606                self.as_ptr() as *mut _,
607                c"notify::height".as_ptr(),
608                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
609                    notify_height_trampoline::<F> as *const (),
610                )),
611                Box_::into_raw(f),
612            )
613        }
614    }
615
616    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
617    #[doc(alias = "title")]
618    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
619        unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
620            this: *mut ffi::GtkShortcutsGroup,
621            _param_spec: glib::ffi::gpointer,
622            f: glib::ffi::gpointer,
623        ) {
624            unsafe {
625                let f: &F = &*(f as *const F);
626                f(&from_glib_borrow(this))
627            }
628        }
629        unsafe {
630            let f: Box_<F> = Box_::new(f);
631            connect_raw(
632                self.as_ptr() as *mut _,
633                c"notify::title".as_ptr(),
634                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
635                    notify_title_trampoline::<F> as *const (),
636                )),
637                Box_::into_raw(f),
638            )
639        }
640    }
641
642    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
643    #[doc(alias = "title-size-group")]
644    pub fn connect_title_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
645        unsafe extern "C" fn notify_title_size_group_trampoline<
646            F: Fn(&ShortcutsGroup) + 'static,
647        >(
648            this: *mut ffi::GtkShortcutsGroup,
649            _param_spec: glib::ffi::gpointer,
650            f: glib::ffi::gpointer,
651        ) {
652            unsafe {
653                let f: &F = &*(f as *const F);
654                f(&from_glib_borrow(this))
655            }
656        }
657        unsafe {
658            let f: Box_<F> = Box_::new(f);
659            connect_raw(
660                self.as_ptr() as *mut _,
661                c"notify::title-size-group".as_ptr(),
662                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
663                    notify_title_size_group_trampoline::<F> as *const (),
664                )),
665                Box_::into_raw(f),
666            )
667        }
668    }
669
670    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
671    #[doc(alias = "view")]
672    pub fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
673        unsafe extern "C" fn notify_view_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
674            this: *mut ffi::GtkShortcutsGroup,
675            _param_spec: glib::ffi::gpointer,
676            f: glib::ffi::gpointer,
677        ) {
678            unsafe {
679                let f: &F = &*(f as *const F);
680                f(&from_glib_borrow(this))
681            }
682        }
683        unsafe {
684            let f: Box_<F> = Box_::new(f);
685            connect_raw(
686                self.as_ptr() as *mut _,
687                c"notify::view".as_ptr(),
688                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
689                    notify_view_trampoline::<F> as *const (),
690                )),
691                Box_::into_raw(f),
692            )
693        }
694    }
695}
696
697// rustdoc-stripper-ignore-next
698/// A [builder-pattern] type to construct [`ShortcutsGroup`] objects.
699///
700/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
701#[must_use = "The builder must be built to be used"]
702pub struct ShortcutsGroupBuilder {
703    builder: glib::object::ObjectBuilder<'static, ShortcutsGroup>,
704}
705
706impl ShortcutsGroupBuilder {
707    fn new() -> Self {
708        Self {
709            builder: glib::object::Object::builder(),
710        }
711    }
712
713    /// The size group for the accelerator portion of shortcuts in this group.
714    ///
715    /// This is used internally by GTK, and must not be modified by applications.
716    /// This widget will be removed in GTK 5
717    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
718    pub fn accel_size_group(self, accel_size_group: &SizeGroup) -> Self {
719        Self {
720            builder: self
721                .builder
722                .property("accel-size-group", accel_size_group.clone()),
723        }
724    }
725
726    /// The title for this group of shortcuts.
727    /// This widget will be removed in GTK 5
728    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
729    pub fn title(self, title: impl Into<glib::GString>) -> Self {
730        Self {
731            builder: self.builder.property("title", title.into()),
732        }
733    }
734
735    /// The size group for the textual portion of shortcuts in this group.
736    ///
737    /// This is used internally by GTK, and must not be modified by applications.
738    /// This widget will be removed in GTK 5
739    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
740    pub fn title_size_group(self, title_size_group: &SizeGroup) -> Self {
741        Self {
742            builder: self
743                .builder
744                .property("title-size-group", title_size_group.clone()),
745        }
746    }
747
748    /// An optional view that the shortcuts in this group are relevant for.
749    ///
750    /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name]
751    /// property does not match the view of this group.
752    ///
753    /// Set this to [`None`] to make the group always visible.
754    /// This widget will be removed in GTK 5
755    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
756    pub fn view(self, view: impl Into<glib::GString>) -> Self {
757        Self {
758            builder: self.builder.property("view", view.into()),
759        }
760    }
761
762    /// The position of the child that determines the baseline.
763    ///
764    /// This is only relevant if the box is in vertical orientation.
765    #[cfg(feature = "v4_12")]
766    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
767    pub fn baseline_child(self, baseline_child: i32) -> Self {
768        Self {
769            builder: self.builder.property("baseline-child", baseline_child),
770        }
771    }
772
773    /// How to position baseline-aligned widgets if extra space is available.
774    pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
775        Self {
776            builder: self
777                .builder
778                .property("baseline-position", baseline_position),
779        }
780    }
781
782    /// Whether the children should all be the same size.
783    pub fn homogeneous(self, homogeneous: bool) -> Self {
784        Self {
785            builder: self.builder.property("homogeneous", homogeneous),
786        }
787    }
788
789    /// The amount of space between children.
790    pub fn spacing(self, spacing: i32) -> Self {
791        Self {
792            builder: self.builder.property("spacing", spacing),
793        }
794    }
795
796    /// Whether the widget or any of its descendents can accept
797    /// the input focus.
798    ///
799    /// This property is meant to be set by widget implementations,
800    /// typically in their instance init function.
801    pub fn can_focus(self, can_focus: bool) -> Self {
802        Self {
803            builder: self.builder.property("can-focus", can_focus),
804        }
805    }
806
807    /// Whether the widget can receive pointer events.
808    pub fn can_target(self, can_target: bool) -> Self {
809        Self {
810            builder: self.builder.property("can-target", can_target),
811        }
812    }
813
814    /// A list of css classes applied to this widget.
815    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
816        Self {
817            builder: self.builder.property("css-classes", css_classes.into()),
818        }
819    }
820
821    /// The name of this widget in the CSS tree.
822    ///
823    /// This property is meant to be set by widget implementations,
824    /// typically in their instance init function.
825    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
826        Self {
827            builder: self.builder.property("css-name", css_name.into()),
828        }
829    }
830
831    /// The cursor used by @widget.
832    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
833        Self {
834            builder: self.builder.property("cursor", cursor.clone()),
835        }
836    }
837
838    /// Whether the widget should grab focus when it is clicked with the mouse.
839    ///
840    /// This property is only relevant for widgets that can take focus.
841    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
842        Self {
843            builder: self.builder.property("focus-on-click", focus_on_click),
844        }
845    }
846
847    /// Whether this widget itself will accept the input focus.
848    pub fn focusable(self, focusable: bool) -> Self {
849        Self {
850            builder: self.builder.property("focusable", focusable),
851        }
852    }
853
854    /// How to distribute horizontal space if widget gets extra space.
855    pub fn halign(self, halign: Align) -> Self {
856        Self {
857            builder: self.builder.property("halign", halign),
858        }
859    }
860
861    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
862    /// signal on @widget.
863    ///
864    /// A true value indicates that @widget can have a tooltip, in this case
865    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
866    /// determine whether it will provide a tooltip or not.
867    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
868        Self {
869            builder: self.builder.property("has-tooltip", has_tooltip),
870        }
871    }
872
873    /// Overrides for height request of the widget.
874    ///
875    /// If this is -1, the natural request will be used.
876    pub fn height_request(self, height_request: i32) -> Self {
877        Self {
878            builder: self.builder.property("height-request", height_request),
879        }
880    }
881
882    /// Whether to expand horizontally.
883    pub fn hexpand(self, hexpand: bool) -> Self {
884        Self {
885            builder: self.builder.property("hexpand", hexpand),
886        }
887    }
888
889    /// Whether to use the `hexpand` property.
890    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
891        Self {
892            builder: self.builder.property("hexpand-set", hexpand_set),
893        }
894    }
895
896    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
897    /// the preferred size of the widget, and allocate its children.
898    ///
899    /// This property is meant to be set by widget implementations,
900    /// typically in their instance init function.
901    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
902        Self {
903            builder: self
904                .builder
905                .property("layout-manager", layout_manager.clone().upcast()),
906        }
907    }
908
909    /// Makes this widget act like a modal dialog, with respect to
910    /// event delivery.
911    ///
912    /// Global event controllers will not handle events with targets
913    /// inside the widget, unless they are set up to ignore propagation
914    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
915    #[cfg(feature = "v4_18")]
916    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
917    pub fn limit_events(self, limit_events: bool) -> Self {
918        Self {
919            builder: self.builder.property("limit-events", limit_events),
920        }
921    }
922
923    /// Margin on bottom side of widget.
924    ///
925    /// This property adds margin outside of the widget's normal size
926    /// request, the margin will be added in addition to the size from
927    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
928    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
929        Self {
930            builder: self.builder.property("margin-bottom", margin_bottom),
931        }
932    }
933
934    /// Margin on end of widget, horizontally.
935    ///
936    /// This property supports left-to-right and right-to-left text
937    /// directions.
938    ///
939    /// This property adds margin outside of the widget's normal size
940    /// request, the margin will be added in addition to the size from
941    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
942    pub fn margin_end(self, margin_end: i32) -> Self {
943        Self {
944            builder: self.builder.property("margin-end", margin_end),
945        }
946    }
947
948    /// Margin on start of widget, horizontally.
949    ///
950    /// This property supports left-to-right and right-to-left text
951    /// directions.
952    ///
953    /// This property adds margin outside of the widget's normal size
954    /// request, the margin will be added in addition to the size from
955    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
956    pub fn margin_start(self, margin_start: i32) -> Self {
957        Self {
958            builder: self.builder.property("margin-start", margin_start),
959        }
960    }
961
962    /// Margin on top side of widget.
963    ///
964    /// This property adds margin outside of the widget's normal size
965    /// request, the margin will be added in addition to the size from
966    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
967    pub fn margin_top(self, margin_top: i32) -> Self {
968        Self {
969            builder: self.builder.property("margin-top", margin_top),
970        }
971    }
972
973    /// The name of the widget.
974    pub fn name(self, name: impl Into<glib::GString>) -> Self {
975        Self {
976            builder: self.builder.property("name", name.into()),
977        }
978    }
979
980    /// The requested opacity of the widget.
981    pub fn opacity(self, opacity: f64) -> Self {
982        Self {
983            builder: self.builder.property("opacity", opacity),
984        }
985    }
986
987    /// How content outside the widget's content area is treated.
988    ///
989    /// This property is meant to be set by widget implementations,
990    /// typically in their instance init function.
991    pub fn overflow(self, overflow: Overflow) -> Self {
992        Self {
993            builder: self.builder.property("overflow", overflow),
994        }
995    }
996
997    /// Whether the widget will receive the default action when it is focused.
998    pub fn receives_default(self, receives_default: bool) -> Self {
999        Self {
1000            builder: self.builder.property("receives-default", receives_default),
1001        }
1002    }
1003
1004    /// Whether the widget responds to input.
1005    pub fn sensitive(self, sensitive: bool) -> Self {
1006        Self {
1007            builder: self.builder.property("sensitive", sensitive),
1008        }
1009    }
1010
1011    /// Sets the text of tooltip to be the given string, which is marked up
1012    /// with Pango markup.
1013    ///
1014    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1015    ///
1016    /// This is a convenience property which will take care of getting the
1017    /// tooltip shown if the given string is not `NULL`:
1018    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1019    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1020    /// the default signal handler.
1021    ///
1022    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1023    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1024    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1025        Self {
1026            builder: self
1027                .builder
1028                .property("tooltip-markup", tooltip_markup.into()),
1029        }
1030    }
1031
1032    /// Sets the text of tooltip to be the given string.
1033    ///
1034    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1035    ///
1036    /// This is a convenience property which will take care of getting the
1037    /// tooltip shown if the given string is not `NULL`:
1038    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1039    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1040    /// the default signal handler.
1041    ///
1042    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1043    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1044    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1045        Self {
1046            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1047        }
1048    }
1049
1050    /// How to distribute vertical space if widget gets extra space.
1051    pub fn valign(self, valign: Align) -> Self {
1052        Self {
1053            builder: self.builder.property("valign", valign),
1054        }
1055    }
1056
1057    /// Whether to expand vertically.
1058    pub fn vexpand(self, vexpand: bool) -> Self {
1059        Self {
1060            builder: self.builder.property("vexpand", vexpand),
1061        }
1062    }
1063
1064    /// Whether to use the `vexpand` property.
1065    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1066        Self {
1067            builder: self.builder.property("vexpand-set", vexpand_set),
1068        }
1069    }
1070
1071    /// Whether the widget is visible.
1072    pub fn visible(self, visible: bool) -> Self {
1073        Self {
1074            builder: self.builder.property("visible", visible),
1075        }
1076    }
1077
1078    /// Overrides for width request of the widget.
1079    ///
1080    /// If this is -1, the natural request will be used.
1081    pub fn width_request(self, width_request: i32) -> Self {
1082        Self {
1083            builder: self.builder.property("width-request", width_request),
1084        }
1085    }
1086
1087    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1088    ///
1089    /// The accessible role cannot be changed once set.
1090    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1091        Self {
1092            builder: self.builder.property("accessible-role", accessible_role),
1093        }
1094    }
1095
1096    /// The orientation of the orientable.
1097    pub fn orientation(self, orientation: Orientation) -> Self {
1098        Self {
1099            builder: self.builder.property("orientation", orientation),
1100        }
1101    }
1102
1103    // rustdoc-stripper-ignore-next
1104    /// Build the [`ShortcutsGroup`].
1105    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1106    pub fn build(self) -> ShortcutsGroup {
1107        assert_initialized_main_thread!();
1108        self.builder.build()
1109    }
1110}