Skip to main content

gtk4/auto/
shortcuts_section.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_14")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
8use crate::ShortcutsGroup;
9use crate::{
10    Accessible, AccessibleRole, Align, BaselinePosition, Box, Buildable, ConstraintTarget,
11    LayoutManager, Orientable, Orientation, Overflow, Widget, ffi,
12};
13use glib::{
14    prelude::*,
15    signal::{SignalHandlerId, connect_raw},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21    /// This widget will be removed in GTK 5
22    /// A [`ShortcutsSection`][crate::ShortcutsSection] collects all the keyboard shortcuts and gestures
23    /// for a major application mode.
24    ///
25    /// If your application needs multiple sections, you should give each
26    /// section a unique [`section-name`][struct@crate::ShortcutsSection#section-name] and
27    /// a [`title`][struct@crate::ShortcutsSection#title] that can be shown in the
28    /// section selector of the [`ShortcutsWindow`][crate::ShortcutsWindow].
29    ///
30    /// The [`max-height`][struct@crate::ShortcutsSection#max-height] property can be used
31    /// to influence how the groups in the section are distributed over pages
32    /// and columns.
33    ///
34    /// This widget is only meant to be used with [`ShortcutsWindow`][crate::ShortcutsWindow].
35    ///
36    /// The recommended way to construct a [`ShortcutsSection`][crate::ShortcutsSection] is with
37    /// [`Builder`][crate::Builder], by using the `<child>` tag to populate a
38    /// [`ShortcutsSection`][crate::ShortcutsSection] with one or more [`ShortcutsGroup`][crate::ShortcutsGroup]
39    /// instances, which in turn contain one or more [`ShortcutsShortcut`][crate::ShortcutsShortcut]
40    /// objects.
41    ///
42    /// If you need to add a group programmatically, use
43    /// [`add_group()`][Self::add_group()].
44    ///
45    /// # Shortcuts and Gestures
46    ///
47    /// Pan gestures allow to navigate between sections.
48    ///
49    /// The following signals have default keybindings:
50    ///
51    /// - [`change-current-page`][struct@crate::ShortcutsSection#change-current-page]
52    ///
53    /// ## Properties
54    ///
55    ///
56    /// #### `max-height`
57    ///  The maximum number of lines to allow per column.
58    ///
59    /// This property can be used to influence how the groups in this
60    /// section are distributed across pages and columns. The default
61    /// value of 15 should work in most cases.
62    ///
63    /// Readable | Writeable
64    ///
65    ///
66    /// #### `section-name`
67    ///  A unique name to identify this section among the sections
68    /// added to the [`ShortcutsWindow`][crate::ShortcutsWindow].
69    ///
70    /// Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name] property
71    /// to this string will make this section shown in the [`ShortcutsWindow`][crate::ShortcutsWindow].
72    ///
73    /// Readable | Writeable
74    ///
75    ///
76    /// #### `title`
77    ///  The string to show in the section selector of the [`ShortcutsWindow`][crate::ShortcutsWindow]
78    /// for this section.
79    ///
80    /// If there is only one section, you don't need to set a title,
81    /// since the section selector will not be shown in this case.
82    ///
83    /// Readable | Writeable
84    ///
85    ///
86    /// #### `view-name`
87    ///  A view name to filter the groups in this section by.
88    ///
89    /// See [`view`][struct@crate::ShortcutsGroup#view].
90    ///
91    /// Applications are expected to use the
92    /// [`view-name`][struct@crate::ShortcutsWindow#view-name] property
93    /// for this purpose.
94    ///
95    /// Readable | Writeable
96    /// <details><summary><h4>Box</h4></summary>
97    ///
98    ///
99    /// #### `baseline-child`
100    ///  The position of the child that determines the baseline.
101    ///
102    /// This is only relevant if the box is in vertical orientation.
103    ///
104    /// Readable | Writeable
105    ///
106    ///
107    /// #### `baseline-position`
108    ///  How to position baseline-aligned widgets if extra space is available.
109    ///
110    /// Readable | Writeable
111    ///
112    ///
113    /// #### `homogeneous`
114    ///  Whether the children should all be the same size.
115    ///
116    /// Readable | Writeable
117    ///
118    ///
119    /// #### `spacing`
120    ///  The amount of space between children.
121    ///
122    /// Readable | Writeable
123    /// </details>
124    /// <details><summary><h4>Widget</h4></summary>
125    ///
126    ///
127    /// #### `can-focus`
128    ///  Whether the widget or any of its descendents can accept
129    /// the input focus.
130    ///
131    /// This property is meant to be set by widget implementations,
132    /// typically in their instance init function.
133    ///
134    /// Readable | Writeable
135    ///
136    ///
137    /// #### `can-target`
138    ///  Whether the widget can receive pointer events.
139    ///
140    /// Readable | Writeable
141    ///
142    ///
143    /// #### `css-classes`
144    ///  A list of css classes applied to this widget.
145    ///
146    /// Readable | Writeable
147    ///
148    ///
149    /// #### `css-name`
150    ///  The name of this widget in the CSS tree.
151    ///
152    /// This property is meant to be set by widget implementations,
153    /// typically in their instance init function.
154    ///
155    /// Readable | Writeable | Construct Only
156    ///
157    ///
158    /// #### `cursor`
159    ///  The cursor used by @widget.
160    ///
161    /// Readable | Writeable
162    ///
163    ///
164    /// #### `focus-on-click`
165    ///  Whether the widget should grab focus when it is clicked with the mouse.
166    ///
167    /// This property is only relevant for widgets that can take focus.
168    ///
169    /// Readable | Writeable
170    ///
171    ///
172    /// #### `focusable`
173    ///  Whether this widget itself will accept the input focus.
174    ///
175    /// Readable | Writeable
176    ///
177    ///
178    /// #### `halign`
179    ///  How to distribute horizontal space if widget gets extra space.
180    ///
181    /// Readable | Writeable
182    ///
183    ///
184    /// #### `has-default`
185    ///  Whether the widget is the default widget.
186    ///
187    /// Readable
188    ///
189    ///
190    /// #### `has-focus`
191    ///  Whether the widget has the input focus.
192    ///
193    /// Readable
194    ///
195    ///
196    /// #### `has-tooltip`
197    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
198    /// signal on @widget.
199    ///
200    /// A true value indicates that @widget can have a tooltip, in this case
201    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
202    /// determine whether it will provide a tooltip or not.
203    ///
204    /// Readable | Writeable
205    ///
206    ///
207    /// #### `height-request`
208    ///  Overrides for height request of the widget.
209    ///
210    /// If this is -1, the natural request will be used.
211    ///
212    /// Readable | Writeable
213    ///
214    ///
215    /// #### `hexpand`
216    ///  Whether to expand horizontally.
217    ///
218    /// Readable | Writeable
219    ///
220    ///
221    /// #### `hexpand-set`
222    ///  Whether to use the `hexpand` property.
223    ///
224    /// Readable | Writeable
225    ///
226    ///
227    /// #### `layout-manager`
228    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
229    /// the preferred size of the widget, and allocate its children.
230    ///
231    /// This property is meant to be set by widget implementations,
232    /// typically in their instance init function.
233    ///
234    /// Readable | Writeable
235    ///
236    ///
237    /// #### `limit-events`
238    ///  Makes this widget act like a modal dialog, with respect to
239    /// event delivery.
240    ///
241    /// Global event controllers will not handle events with targets
242    /// inside the widget, unless they are set up to ignore propagation
243    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
244    ///
245    /// Readable | Writeable
246    ///
247    ///
248    /// #### `margin-bottom`
249    ///  Margin on bottom side of widget.
250    ///
251    /// This property adds margin outside of the widget's normal size
252    /// request, the margin will be added in addition to the size from
253    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
254    ///
255    /// Readable | Writeable
256    ///
257    ///
258    /// #### `margin-end`
259    ///  Margin on end of widget, horizontally.
260    ///
261    /// This property supports left-to-right and right-to-left text
262    /// directions.
263    ///
264    /// This property adds margin outside of the widget's normal size
265    /// request, the margin will be added in addition to the size from
266    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
267    ///
268    /// Readable | Writeable
269    ///
270    ///
271    /// #### `margin-start`
272    ///  Margin on start of widget, horizontally.
273    ///
274    /// This property supports left-to-right and right-to-left text
275    /// directions.
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 | Writeable
282    ///
283    ///
284    /// #### `margin-top`
285    ///  Margin on top side of widget.
286    ///
287    /// This property adds margin outside of the widget's normal size
288    /// request, the margin will be added in addition to the size from
289    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
290    ///
291    /// Readable | Writeable
292    ///
293    ///
294    /// #### `name`
295    ///  The name of the widget.
296    ///
297    /// Readable | Writeable
298    ///
299    ///
300    /// #### `opacity`
301    ///  The requested opacity of the widget.
302    ///
303    /// Readable | Writeable
304    ///
305    ///
306    /// #### `overflow`
307    ///  How content outside the widget's content area is treated.
308    ///
309    /// This property is meant to be set by widget implementations,
310    /// typically in their instance init function.
311    ///
312    /// Readable | Writeable
313    ///
314    ///
315    /// #### `parent`
316    ///  The parent widget of this widget.
317    ///
318    /// Readable
319    ///
320    ///
321    /// #### `receives-default`
322    ///  Whether the widget will receive the default action when it is focused.
323    ///
324    /// Readable | Writeable
325    ///
326    ///
327    /// #### `root`
328    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
329    ///
330    /// This will be `NULL` if the widget is not contained in a root widget.
331    ///
332    /// Readable
333    ///
334    ///
335    /// #### `scale-factor`
336    ///  The scale factor of the widget.
337    ///
338    /// Readable
339    ///
340    ///
341    /// #### `sensitive`
342    ///  Whether the widget responds to input.
343    ///
344    /// Readable | Writeable
345    ///
346    ///
347    /// #### `tooltip-markup`
348    ///  Sets the text of tooltip to be the given string, which is marked up
349    /// with Pango markup.
350    ///
351    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
352    ///
353    /// This is a convenience property which will take care of getting the
354    /// tooltip shown if the given string is not `NULL`:
355    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
356    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
357    /// the default signal handler.
358    ///
359    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
360    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
361    ///
362    /// Readable | Writeable
363    ///
364    ///
365    /// #### `tooltip-text`
366    ///  Sets the text of tooltip to be the given string.
367    ///
368    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
369    ///
370    /// This is a convenience property which will take care of getting the
371    /// tooltip shown if the given string is not `NULL`:
372    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
373    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
374    /// the default signal handler.
375    ///
376    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
377    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
378    ///
379    /// Readable | Writeable
380    ///
381    ///
382    /// #### `valign`
383    ///  How to distribute vertical space if widget gets extra space.
384    ///
385    /// Readable | Writeable
386    ///
387    ///
388    /// #### `vexpand`
389    ///  Whether to expand vertically.
390    ///
391    /// Readable | Writeable
392    ///
393    ///
394    /// #### `vexpand-set`
395    ///  Whether to use the `vexpand` property.
396    ///
397    /// Readable | Writeable
398    ///
399    ///
400    /// #### `visible`
401    ///  Whether the widget is visible.
402    ///
403    /// Readable | Writeable
404    ///
405    ///
406    /// #### `width-request`
407    ///  Overrides for width request of the widget.
408    ///
409    /// If this is -1, the natural request will be used.
410    ///
411    /// Readable | Writeable
412    /// </details>
413    /// <details><summary><h4>Accessible</h4></summary>
414    ///
415    ///
416    /// #### `accessible-role`
417    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
418    ///
419    /// The accessible role cannot be changed once set.
420    ///
421    /// Readable | Writeable
422    /// </details>
423    /// <details><summary><h4>Orientable</h4></summary>
424    ///
425    ///
426    /// #### `orientation`
427    ///  The orientation of the orientable.
428    ///
429    /// Readable | Writeable
430    /// </details>
431    ///
432    /// ## Signals
433    ///
434    ///
435    /// #### `change-current-page`
436    ///  Emitted when we change the current page.
437    ///
438    /// The default bindings for this signal are
439    /// <kbd>Ctrl</kbd>+<kbd>PgUp</kbd>, <kbd>PgUp</kbd>,
440    /// <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>, <kbd>PgDn</kbd>.
441    ///
442    /// Action
443    /// <details><summary><h4>Widget</h4></summary>
444    ///
445    ///
446    /// #### `destroy`
447    ///  Signals that all holders of a reference to the widget should release
448    /// the reference that they hold.
449    ///
450    /// May result in finalization of the widget if all references are released.
451    ///
452    /// This signal is not suitable for saving widget state.
453    ///
454    ///
455    ///
456    ///
457    /// #### `direction-changed`
458    ///  Emitted when the text direction of a widget changes.
459    ///
460    ///
461    ///
462    ///
463    /// #### `hide`
464    ///  Emitted when @widget is hidden.
465    ///
466    ///
467    ///
468    ///
469    /// #### `keynav-failed`
470    ///  Emitted if keyboard navigation fails.
471    ///
472    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
473    ///
474    ///
475    ///
476    ///
477    /// #### `map`
478    ///  Emitted when @widget is going to be mapped.
479    ///
480    /// A widget is mapped when the widget is visible (which is controlled with
481    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
482    /// are also visible.
483    ///
484    /// The `::map` signal can be used to determine whether a widget will be drawn,
485    /// for instance it can resume an animation that was stopped during the
486    /// emission of [`unmap`][struct@crate::Widget#unmap].
487    ///
488    ///
489    ///
490    ///
491    /// #### `mnemonic-activate`
492    ///  Emitted when a widget is activated via a mnemonic.
493    ///
494    /// The default handler for this signal activates @widget if @group_cycling
495    /// is false, or just makes @widget grab focus if @group_cycling is true.
496    ///
497    ///
498    ///
499    ///
500    /// #### `move-focus`
501    ///  Emitted when the focus is moved.
502    ///
503    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
504    ///
505    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
506    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
507    ///
508    /// Action
509    ///
510    ///
511    /// #### `query-tooltip`
512    ///  Emitted when the widget’s tooltip is about to be shown.
513    ///
514    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
515    /// is true and the hover timeout has expired with the cursor hovering
516    /// above @widget; or emitted when @widget got focus in keyboard mode.
517    ///
518    /// Using the given coordinates, the signal handler should determine
519    /// whether a tooltip should be shown for @widget. If this is the case
520    /// true should be returned, false otherwise. Note that if @keyboard_mode
521    /// is true, the values of @x and @y are undefined and should not be used.
522    ///
523    /// The signal handler is free to manipulate @tooltip with the therefore
524    /// destined function calls.
525    ///
526    ///
527    ///
528    ///
529    /// #### `realize`
530    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
531    ///
532    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
533    /// or the widget has been mapped (that is, it is going to be drawn).
534    ///
535    ///
536    ///
537    ///
538    /// #### `show`
539    ///  Emitted when @widget is shown.
540    ///
541    ///
542    ///
543    ///
544    /// #### `state-flags-changed`
545    ///  Emitted when the widget state changes.
546    ///
547    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
548    ///
549    ///
550    ///
551    ///
552    /// #### `unmap`
553    ///  Emitted when @widget is going to be unmapped.
554    ///
555    /// A widget is unmapped when either it or any of its parents up to the
556    /// toplevel widget have been set as hidden.
557    ///
558    /// As `::unmap` indicates that a widget will not be shown any longer,
559    /// it can be used to, for example, stop an animation on the widget.
560    ///
561    ///
562    ///
563    ///
564    /// #### `unrealize`
565    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
566    ///
567    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
568    /// or the widget has been unmapped (that is, it is going to be hidden).
569    ///
570    ///
571    /// </details>
572    ///
573    /// # Implements
574    ///
575    /// [`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]
576    #[doc(alias = "GtkShortcutsSection")]
577    pub struct ShortcutsSection(Object<ffi::GtkShortcutsSection, ffi::GtkShortcutsSectionClass>) @extends Box, Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
578
579    match fn {
580        type_ => || ffi::gtk_shortcuts_section_get_type(),
581    }
582}
583
584impl ShortcutsSection {
585    // rustdoc-stripper-ignore-next
586    /// Creates a new builder-pattern struct instance to construct [`ShortcutsSection`] objects.
587    ///
588    /// This method returns an instance of [`ShortcutsSectionBuilder`](crate::builders::ShortcutsSectionBuilder) which can be used to create [`ShortcutsSection`] objects.
589    pub fn builder() -> ShortcutsSectionBuilder {
590        ShortcutsSectionBuilder::new()
591    }
592
593    /// Adds a group to the shortcuts section.
594    ///
595    /// This is the programmatic equivalent to using [`Builder`][crate::Builder] and a
596    /// `<child>` tag to add the child.
597    ///
598    /// Adding children with the [`Box`][crate::Box] API is not appropriate, as
599    /// [`ShortcutsSection`][crate::ShortcutsSection] manages its children internally.
600    ///
601    /// # Deprecated since 4.18
602    ///
603    /// This widget will be removed in GTK 5
604    /// ## `group`
605    /// the [`ShortcutsGroup`][crate::ShortcutsGroup] to add
606    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
607    #[cfg(feature = "v4_14")]
608    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
609    #[allow(deprecated)]
610    #[doc(alias = "gtk_shortcuts_section_add_group")]
611    pub fn add_group(&self, group: &ShortcutsGroup) {
612        unsafe {
613            ffi::gtk_shortcuts_section_add_group(self.to_glib_none().0, group.to_glib_none().0);
614        }
615    }
616
617    /// The maximum number of lines to allow per column.
618    ///
619    /// This property can be used to influence how the groups in this
620    /// section are distributed across pages and columns. The default
621    /// value of 15 should work in most cases.
622    ///
623    /// # Deprecated since 4.18
624    ///
625    /// This widget will be removed in GTK 5
626    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
627    #[doc(alias = "max-height")]
628    pub fn max_height(&self) -> u32 {
629        ObjectExt::property(self, "max-height")
630    }
631
632    /// The maximum number of lines to allow per column.
633    ///
634    /// This property can be used to influence how the groups in this
635    /// section are distributed across pages and columns. The default
636    /// value of 15 should work in most cases.
637    ///
638    /// # Deprecated since 4.18
639    ///
640    /// This widget will be removed in GTK 5
641    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
642    #[doc(alias = "max-height")]
643    pub fn set_max_height(&self, max_height: u32) {
644        ObjectExt::set_property(self, "max-height", max_height)
645    }
646
647    /// A unique name to identify this section among the sections
648    /// added to the [`ShortcutsWindow`][crate::ShortcutsWindow].
649    ///
650    /// Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name] property
651    /// to this string will make this section shown in the [`ShortcutsWindow`][crate::ShortcutsWindow].
652    ///
653    /// # Deprecated since 4.18
654    ///
655    /// This widget will be removed in GTK 5
656    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
657    #[doc(alias = "section-name")]
658    pub fn section_name(&self) -> Option<glib::GString> {
659        ObjectExt::property(self, "section-name")
660    }
661
662    /// A unique name to identify this section among the sections
663    /// added to the [`ShortcutsWindow`][crate::ShortcutsWindow].
664    ///
665    /// Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name] property
666    /// to this string will make this section shown in the [`ShortcutsWindow`][crate::ShortcutsWindow].
667    ///
668    /// # Deprecated since 4.18
669    ///
670    /// This widget will be removed in GTK 5
671    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
672    #[doc(alias = "section-name")]
673    pub fn set_section_name(&self, section_name: Option<&str>) {
674        ObjectExt::set_property(self, "section-name", section_name)
675    }
676
677    /// The string to show in the section selector of the [`ShortcutsWindow`][crate::ShortcutsWindow]
678    /// for this section.
679    ///
680    /// If there is only one section, you don't need to set a title,
681    /// since the section selector will not be shown in this case.
682    ///
683    /// # Deprecated since 4.18
684    ///
685    /// This widget will be removed in GTK 5
686    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
687    pub fn title(&self) -> Option<glib::GString> {
688        ObjectExt::property(self, "title")
689    }
690
691    /// The string to show in the section selector of the [`ShortcutsWindow`][crate::ShortcutsWindow]
692    /// for this section.
693    ///
694    /// If there is only one section, you don't need to set a title,
695    /// since the section selector will not be shown in this case.
696    ///
697    /// # Deprecated since 4.18
698    ///
699    /// This widget will be removed in GTK 5
700    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
701    pub fn set_title(&self, title: Option<&str>) {
702        ObjectExt::set_property(self, "title", title)
703    }
704
705    /// A view name to filter the groups in this section by.
706    ///
707    /// See [`view`][struct@crate::ShortcutsGroup#view].
708    ///
709    /// Applications are expected to use the
710    /// [`view-name`][struct@crate::ShortcutsWindow#view-name] property
711    /// for this purpose.
712    ///
713    /// # Deprecated since 4.18
714    ///
715    /// This widget will be removed in GTK 5
716    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
717    #[doc(alias = "view-name")]
718    pub fn view_name(&self) -> Option<glib::GString> {
719        ObjectExt::property(self, "view-name")
720    }
721
722    /// A view name to filter the groups in this section by.
723    ///
724    /// See [`view`][struct@crate::ShortcutsGroup#view].
725    ///
726    /// Applications are expected to use the
727    /// [`view-name`][struct@crate::ShortcutsWindow#view-name] property
728    /// for this purpose.
729    ///
730    /// # Deprecated since 4.18
731    ///
732    /// This widget will be removed in GTK 5
733    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
734    #[doc(alias = "view-name")]
735    pub fn set_view_name(&self, view_name: Option<&str>) {
736        ObjectExt::set_property(self, "view-name", view_name)
737    }
738
739    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
740    #[doc(alias = "max-height")]
741    pub fn connect_max_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
742        unsafe extern "C" fn notify_max_height_trampoline<F: Fn(&ShortcutsSection) + 'static>(
743            this: *mut ffi::GtkShortcutsSection,
744            _param_spec: glib::ffi::gpointer,
745            f: glib::ffi::gpointer,
746        ) {
747            unsafe {
748                let f: &F = &*(f as *const F);
749                f(&from_glib_borrow(this))
750            }
751        }
752        unsafe {
753            let f: Box_<F> = Box_::new(f);
754            connect_raw(
755                self.as_ptr() as *mut _,
756                c"notify::max-height".as_ptr() as *const _,
757                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
758                    notify_max_height_trampoline::<F> as *const (),
759                )),
760                Box_::into_raw(f),
761            )
762        }
763    }
764
765    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
766    #[doc(alias = "section-name")]
767    pub fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
768        unsafe extern "C" fn notify_section_name_trampoline<F: Fn(&ShortcutsSection) + 'static>(
769            this: *mut ffi::GtkShortcutsSection,
770            _param_spec: glib::ffi::gpointer,
771            f: glib::ffi::gpointer,
772        ) {
773            unsafe {
774                let f: &F = &*(f as *const F);
775                f(&from_glib_borrow(this))
776            }
777        }
778        unsafe {
779            let f: Box_<F> = Box_::new(f);
780            connect_raw(
781                self.as_ptr() as *mut _,
782                c"notify::section-name".as_ptr() as *const _,
783                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
784                    notify_section_name_trampoline::<F> as *const (),
785                )),
786                Box_::into_raw(f),
787            )
788        }
789    }
790
791    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
792    #[doc(alias = "title")]
793    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
794        unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsSection) + 'static>(
795            this: *mut ffi::GtkShortcutsSection,
796            _param_spec: glib::ffi::gpointer,
797            f: glib::ffi::gpointer,
798        ) {
799            unsafe {
800                let f: &F = &*(f as *const F);
801                f(&from_glib_borrow(this))
802            }
803        }
804        unsafe {
805            let f: Box_<F> = Box_::new(f);
806            connect_raw(
807                self.as_ptr() as *mut _,
808                c"notify::title".as_ptr() as *const _,
809                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
810                    notify_title_trampoline::<F> as *const (),
811                )),
812                Box_::into_raw(f),
813            )
814        }
815    }
816
817    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
818    #[doc(alias = "view-name")]
819    pub fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
820        unsafe extern "C" fn notify_view_name_trampoline<F: Fn(&ShortcutsSection) + 'static>(
821            this: *mut ffi::GtkShortcutsSection,
822            _param_spec: glib::ffi::gpointer,
823            f: glib::ffi::gpointer,
824        ) {
825            unsafe {
826                let f: &F = &*(f as *const F);
827                f(&from_glib_borrow(this))
828            }
829        }
830        unsafe {
831            let f: Box_<F> = Box_::new(f);
832            connect_raw(
833                self.as_ptr() as *mut _,
834                c"notify::view-name".as_ptr() as *const _,
835                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
836                    notify_view_name_trampoline::<F> as *const (),
837                )),
838                Box_::into_raw(f),
839            )
840        }
841    }
842}
843
844// rustdoc-stripper-ignore-next
845/// A [builder-pattern] type to construct [`ShortcutsSection`] objects.
846///
847/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
848#[must_use = "The builder must be built to be used"]
849pub struct ShortcutsSectionBuilder {
850    builder: glib::object::ObjectBuilder<'static, ShortcutsSection>,
851}
852
853impl ShortcutsSectionBuilder {
854    fn new() -> Self {
855        Self {
856            builder: glib::object::Object::builder(),
857        }
858    }
859
860    /// The maximum number of lines to allow per column.
861    ///
862    /// This property can be used to influence how the groups in this
863    /// section are distributed across pages and columns. The default
864    /// value of 15 should work in most cases.
865    /// This widget will be removed in GTK 5
866    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
867    pub fn max_height(self, max_height: u32) -> Self {
868        Self {
869            builder: self.builder.property("max-height", max_height),
870        }
871    }
872
873    /// A unique name to identify this section among the sections
874    /// added to the [`ShortcutsWindow`][crate::ShortcutsWindow].
875    ///
876    /// Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name] property
877    /// to this string will make this section shown in the [`ShortcutsWindow`][crate::ShortcutsWindow].
878    /// This widget will be removed in GTK 5
879    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
880    pub fn section_name(self, section_name: impl Into<glib::GString>) -> Self {
881        Self {
882            builder: self.builder.property("section-name", section_name.into()),
883        }
884    }
885
886    /// The string to show in the section selector of the [`ShortcutsWindow`][crate::ShortcutsWindow]
887    /// for this section.
888    ///
889    /// If there is only one section, you don't need to set a title,
890    /// since the section selector will not be shown in this case.
891    /// This widget will be removed in GTK 5
892    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
893    pub fn title(self, title: impl Into<glib::GString>) -> Self {
894        Self {
895            builder: self.builder.property("title", title.into()),
896        }
897    }
898
899    /// A view name to filter the groups in this section by.
900    ///
901    /// See [`view`][struct@crate::ShortcutsGroup#view].
902    ///
903    /// Applications are expected to use the
904    /// [`view-name`][struct@crate::ShortcutsWindow#view-name] property
905    /// for this purpose.
906    /// This widget will be removed in GTK 5
907    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
908    pub fn view_name(self, view_name: impl Into<glib::GString>) -> Self {
909        Self {
910            builder: self.builder.property("view-name", view_name.into()),
911        }
912    }
913
914    /// The position of the child that determines the baseline.
915    ///
916    /// This is only relevant if the box is in vertical orientation.
917    #[cfg(feature = "v4_12")]
918    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
919    pub fn baseline_child(self, baseline_child: i32) -> Self {
920        Self {
921            builder: self.builder.property("baseline-child", baseline_child),
922        }
923    }
924
925    /// How to position baseline-aligned widgets if extra space is available.
926    pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
927        Self {
928            builder: self
929                .builder
930                .property("baseline-position", baseline_position),
931        }
932    }
933
934    /// Whether the children should all be the same size.
935    pub fn homogeneous(self, homogeneous: bool) -> Self {
936        Self {
937            builder: self.builder.property("homogeneous", homogeneous),
938        }
939    }
940
941    /// The amount of space between children.
942    pub fn spacing(self, spacing: i32) -> Self {
943        Self {
944            builder: self.builder.property("spacing", spacing),
945        }
946    }
947
948    /// Whether the widget or any of its descendents can accept
949    /// the input focus.
950    ///
951    /// This property is meant to be set by widget implementations,
952    /// typically in their instance init function.
953    pub fn can_focus(self, can_focus: bool) -> Self {
954        Self {
955            builder: self.builder.property("can-focus", can_focus),
956        }
957    }
958
959    /// Whether the widget can receive pointer events.
960    pub fn can_target(self, can_target: bool) -> Self {
961        Self {
962            builder: self.builder.property("can-target", can_target),
963        }
964    }
965
966    /// A list of css classes applied to this widget.
967    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
968        Self {
969            builder: self.builder.property("css-classes", css_classes.into()),
970        }
971    }
972
973    /// The name of this widget in the CSS tree.
974    ///
975    /// This property is meant to be set by widget implementations,
976    /// typically in their instance init function.
977    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
978        Self {
979            builder: self.builder.property("css-name", css_name.into()),
980        }
981    }
982
983    /// The cursor used by @widget.
984    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
985        Self {
986            builder: self.builder.property("cursor", cursor.clone()),
987        }
988    }
989
990    /// Whether the widget should grab focus when it is clicked with the mouse.
991    ///
992    /// This property is only relevant for widgets that can take focus.
993    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
994        Self {
995            builder: self.builder.property("focus-on-click", focus_on_click),
996        }
997    }
998
999    /// Whether this widget itself will accept the input focus.
1000    pub fn focusable(self, focusable: bool) -> Self {
1001        Self {
1002            builder: self.builder.property("focusable", focusable),
1003        }
1004    }
1005
1006    /// How to distribute horizontal space if widget gets extra space.
1007    pub fn halign(self, halign: Align) -> Self {
1008        Self {
1009            builder: self.builder.property("halign", halign),
1010        }
1011    }
1012
1013    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1014    /// signal on @widget.
1015    ///
1016    /// A true value indicates that @widget can have a tooltip, in this case
1017    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1018    /// determine whether it will provide a tooltip or not.
1019    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1020        Self {
1021            builder: self.builder.property("has-tooltip", has_tooltip),
1022        }
1023    }
1024
1025    /// Overrides for height request of the widget.
1026    ///
1027    /// If this is -1, the natural request will be used.
1028    pub fn height_request(self, height_request: i32) -> Self {
1029        Self {
1030            builder: self.builder.property("height-request", height_request),
1031        }
1032    }
1033
1034    /// Whether to expand horizontally.
1035    pub fn hexpand(self, hexpand: bool) -> Self {
1036        Self {
1037            builder: self.builder.property("hexpand", hexpand),
1038        }
1039    }
1040
1041    /// Whether to use the `hexpand` property.
1042    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1043        Self {
1044            builder: self.builder.property("hexpand-set", hexpand_set),
1045        }
1046    }
1047
1048    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1049    /// the preferred size of the widget, and allocate its children.
1050    ///
1051    /// This property is meant to be set by widget implementations,
1052    /// typically in their instance init function.
1053    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1054        Self {
1055            builder: self
1056                .builder
1057                .property("layout-manager", layout_manager.clone().upcast()),
1058        }
1059    }
1060
1061    /// Makes this widget act like a modal dialog, with respect to
1062    /// event delivery.
1063    ///
1064    /// Global event controllers will not handle events with targets
1065    /// inside the widget, unless they are set up to ignore propagation
1066    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1067    #[cfg(feature = "v4_18")]
1068    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1069    pub fn limit_events(self, limit_events: bool) -> Self {
1070        Self {
1071            builder: self.builder.property("limit-events", limit_events),
1072        }
1073    }
1074
1075    /// Margin on bottom side of widget.
1076    ///
1077    /// This property adds margin outside of the widget's normal size
1078    /// request, the margin will be added in addition to the size from
1079    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1080    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1081        Self {
1082            builder: self.builder.property("margin-bottom", margin_bottom),
1083        }
1084    }
1085
1086    /// Margin on end of widget, horizontally.
1087    ///
1088    /// This property supports left-to-right and right-to-left text
1089    /// directions.
1090    ///
1091    /// This property adds margin outside of the widget's normal size
1092    /// request, the margin will be added in addition to the size from
1093    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1094    pub fn margin_end(self, margin_end: i32) -> Self {
1095        Self {
1096            builder: self.builder.property("margin-end", margin_end),
1097        }
1098    }
1099
1100    /// Margin on start of widget, horizontally.
1101    ///
1102    /// This property supports left-to-right and right-to-left text
1103    /// directions.
1104    ///
1105    /// This property adds margin outside of the widget's normal size
1106    /// request, the margin will be added in addition to the size from
1107    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1108    pub fn margin_start(self, margin_start: i32) -> Self {
1109        Self {
1110            builder: self.builder.property("margin-start", margin_start),
1111        }
1112    }
1113
1114    /// Margin on top side of widget.
1115    ///
1116    /// This property adds margin outside of the widget's normal size
1117    /// request, the margin will be added in addition to the size from
1118    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1119    pub fn margin_top(self, margin_top: i32) -> Self {
1120        Self {
1121            builder: self.builder.property("margin-top", margin_top),
1122        }
1123    }
1124
1125    /// The name of the widget.
1126    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1127        Self {
1128            builder: self.builder.property("name", name.into()),
1129        }
1130    }
1131
1132    /// The requested opacity of the widget.
1133    pub fn opacity(self, opacity: f64) -> Self {
1134        Self {
1135            builder: self.builder.property("opacity", opacity),
1136        }
1137    }
1138
1139    /// How content outside the widget's content area is treated.
1140    ///
1141    /// This property is meant to be set by widget implementations,
1142    /// typically in their instance init function.
1143    pub fn overflow(self, overflow: Overflow) -> Self {
1144        Self {
1145            builder: self.builder.property("overflow", overflow),
1146        }
1147    }
1148
1149    /// Whether the widget will receive the default action when it is focused.
1150    pub fn receives_default(self, receives_default: bool) -> Self {
1151        Self {
1152            builder: self.builder.property("receives-default", receives_default),
1153        }
1154    }
1155
1156    /// Whether the widget responds to input.
1157    pub fn sensitive(self, sensitive: bool) -> Self {
1158        Self {
1159            builder: self.builder.property("sensitive", sensitive),
1160        }
1161    }
1162
1163    /// Sets the text of tooltip to be the given string, which is marked up
1164    /// with Pango markup.
1165    ///
1166    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1167    ///
1168    /// This is a convenience property which will take care of getting the
1169    /// tooltip shown if the given string is not `NULL`:
1170    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1171    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1172    /// the default signal handler.
1173    ///
1174    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1175    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1176    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1177        Self {
1178            builder: self
1179                .builder
1180                .property("tooltip-markup", tooltip_markup.into()),
1181        }
1182    }
1183
1184    /// Sets the text of tooltip to be the given string.
1185    ///
1186    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1187    ///
1188    /// This is a convenience property which will take care of getting the
1189    /// tooltip shown if the given string is not `NULL`:
1190    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1191    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1192    /// the default signal handler.
1193    ///
1194    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1195    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1196    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1197        Self {
1198            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1199        }
1200    }
1201
1202    /// How to distribute vertical space if widget gets extra space.
1203    pub fn valign(self, valign: Align) -> Self {
1204        Self {
1205            builder: self.builder.property("valign", valign),
1206        }
1207    }
1208
1209    /// Whether to expand vertically.
1210    pub fn vexpand(self, vexpand: bool) -> Self {
1211        Self {
1212            builder: self.builder.property("vexpand", vexpand),
1213        }
1214    }
1215
1216    /// Whether to use the `vexpand` property.
1217    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1218        Self {
1219            builder: self.builder.property("vexpand-set", vexpand_set),
1220        }
1221    }
1222
1223    /// Whether the widget is visible.
1224    pub fn visible(self, visible: bool) -> Self {
1225        Self {
1226            builder: self.builder.property("visible", visible),
1227        }
1228    }
1229
1230    /// Overrides for width request of the widget.
1231    ///
1232    /// If this is -1, the natural request will be used.
1233    pub fn width_request(self, width_request: i32) -> Self {
1234        Self {
1235            builder: self.builder.property("width-request", width_request),
1236        }
1237    }
1238
1239    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1240    ///
1241    /// The accessible role cannot be changed once set.
1242    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1243        Self {
1244            builder: self.builder.property("accessible-role", accessible_role),
1245        }
1246    }
1247
1248    /// The orientation of the orientable.
1249    pub fn orientation(self, orientation: Orientation) -> Self {
1250        Self {
1251            builder: self.builder.property("orientation", orientation),
1252        }
1253    }
1254
1255    // rustdoc-stripper-ignore-next
1256    /// Build the [`ShortcutsSection`].
1257    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1258    pub fn build(self) -> ShortcutsSection {
1259        assert_initialized_main_thread!();
1260        self.builder.build()
1261    }
1262}