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    ffi, Accessible, AccessibleRole, Align, BaselinePosition, Box, Buildable, ConstraintTarget,
11    LayoutManager, Orientable, Orientation, Overflow, Widget,
12};
13use glib::{
14    prelude::*,
15    signal::{connect_raw, SignalHandlerId},
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            let f: &F = &*(f as *const F);
748            f(&from_glib_borrow(this))
749        }
750        unsafe {
751            let f: Box_<F> = Box_::new(f);
752            connect_raw(
753                self.as_ptr() as *mut _,
754                b"notify::max-height\0".as_ptr() as *const _,
755                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
756                    notify_max_height_trampoline::<F> as *const (),
757                )),
758                Box_::into_raw(f),
759            )
760        }
761    }
762
763    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
764    #[doc(alias = "section-name")]
765    pub fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
766        unsafe extern "C" fn notify_section_name_trampoline<F: Fn(&ShortcutsSection) + 'static>(
767            this: *mut ffi::GtkShortcutsSection,
768            _param_spec: glib::ffi::gpointer,
769            f: glib::ffi::gpointer,
770        ) {
771            let f: &F = &*(f as *const F);
772            f(&from_glib_borrow(this))
773        }
774        unsafe {
775            let f: Box_<F> = Box_::new(f);
776            connect_raw(
777                self.as_ptr() as *mut _,
778                b"notify::section-name\0".as_ptr() as *const _,
779                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
780                    notify_section_name_trampoline::<F> as *const (),
781                )),
782                Box_::into_raw(f),
783            )
784        }
785    }
786
787    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
788    #[doc(alias = "title")]
789    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
790        unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsSection) + 'static>(
791            this: *mut ffi::GtkShortcutsSection,
792            _param_spec: glib::ffi::gpointer,
793            f: glib::ffi::gpointer,
794        ) {
795            let f: &F = &*(f as *const F);
796            f(&from_glib_borrow(this))
797        }
798        unsafe {
799            let f: Box_<F> = Box_::new(f);
800            connect_raw(
801                self.as_ptr() as *mut _,
802                b"notify::title\0".as_ptr() as *const _,
803                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
804                    notify_title_trampoline::<F> as *const (),
805                )),
806                Box_::into_raw(f),
807            )
808        }
809    }
810
811    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
812    #[doc(alias = "view-name")]
813    pub fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
814        unsafe extern "C" fn notify_view_name_trampoline<F: Fn(&ShortcutsSection) + 'static>(
815            this: *mut ffi::GtkShortcutsSection,
816            _param_spec: glib::ffi::gpointer,
817            f: glib::ffi::gpointer,
818        ) {
819            let f: &F = &*(f as *const F);
820            f(&from_glib_borrow(this))
821        }
822        unsafe {
823            let f: Box_<F> = Box_::new(f);
824            connect_raw(
825                self.as_ptr() as *mut _,
826                b"notify::view-name\0".as_ptr() as *const _,
827                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
828                    notify_view_name_trampoline::<F> as *const (),
829                )),
830                Box_::into_raw(f),
831            )
832        }
833    }
834}
835
836// rustdoc-stripper-ignore-next
837/// A [builder-pattern] type to construct [`ShortcutsSection`] objects.
838///
839/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
840#[must_use = "The builder must be built to be used"]
841pub struct ShortcutsSectionBuilder {
842    builder: glib::object::ObjectBuilder<'static, ShortcutsSection>,
843}
844
845impl ShortcutsSectionBuilder {
846    fn new() -> Self {
847        Self {
848            builder: glib::object::Object::builder(),
849        }
850    }
851
852    /// The maximum number of lines to allow per column.
853    ///
854    /// This property can be used to influence how the groups in this
855    /// section are distributed across pages and columns. The default
856    /// value of 15 should work in most cases.
857    /// This widget will be removed in GTK 5
858    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
859    pub fn max_height(self, max_height: u32) -> Self {
860        Self {
861            builder: self.builder.property("max-height", max_height),
862        }
863    }
864
865    /// A unique name to identify this section among the sections
866    /// added to the [`ShortcutsWindow`][crate::ShortcutsWindow].
867    ///
868    /// Setting the [`section-name`][struct@crate::ShortcutsWindow#section-name] property
869    /// to this string will make this section shown in the [`ShortcutsWindow`][crate::ShortcutsWindow].
870    /// This widget will be removed in GTK 5
871    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
872    pub fn section_name(self, section_name: impl Into<glib::GString>) -> Self {
873        Self {
874            builder: self.builder.property("section-name", section_name.into()),
875        }
876    }
877
878    /// The string to show in the section selector of the [`ShortcutsWindow`][crate::ShortcutsWindow]
879    /// for this section.
880    ///
881    /// If there is only one section, you don't need to set a title,
882    /// since the section selector will not be shown in this case.
883    /// This widget will be removed in GTK 5
884    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
885    pub fn title(self, title: impl Into<glib::GString>) -> Self {
886        Self {
887            builder: self.builder.property("title", title.into()),
888        }
889    }
890
891    /// A view name to filter the groups in this section by.
892    ///
893    /// See [`view`][struct@crate::ShortcutsGroup#view].
894    ///
895    /// Applications are expected to use the
896    /// [`view-name`][struct@crate::ShortcutsWindow#view-name] property
897    /// for this purpose.
898    /// This widget will be removed in GTK 5
899    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
900    pub fn view_name(self, view_name: impl Into<glib::GString>) -> Self {
901        Self {
902            builder: self.builder.property("view-name", view_name.into()),
903        }
904    }
905
906    /// The position of the child that determines the baseline.
907    ///
908    /// This is only relevant if the box is in vertical orientation.
909    #[cfg(feature = "v4_12")]
910    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
911    pub fn baseline_child(self, baseline_child: i32) -> Self {
912        Self {
913            builder: self.builder.property("baseline-child", baseline_child),
914        }
915    }
916
917    /// How to position baseline-aligned widgets if extra space is available.
918    pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
919        Self {
920            builder: self
921                .builder
922                .property("baseline-position", baseline_position),
923        }
924    }
925
926    /// Whether the children should all be the same size.
927    pub fn homogeneous(self, homogeneous: bool) -> Self {
928        Self {
929            builder: self.builder.property("homogeneous", homogeneous),
930        }
931    }
932
933    /// The amount of space between children.
934    pub fn spacing(self, spacing: i32) -> Self {
935        Self {
936            builder: self.builder.property("spacing", spacing),
937        }
938    }
939
940    /// Whether the widget or any of its descendents can accept
941    /// the input focus.
942    ///
943    /// This property is meant to be set by widget implementations,
944    /// typically in their instance init function.
945    pub fn can_focus(self, can_focus: bool) -> Self {
946        Self {
947            builder: self.builder.property("can-focus", can_focus),
948        }
949    }
950
951    /// Whether the widget can receive pointer events.
952    pub fn can_target(self, can_target: bool) -> Self {
953        Self {
954            builder: self.builder.property("can-target", can_target),
955        }
956    }
957
958    /// A list of css classes applied to this widget.
959    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
960        Self {
961            builder: self.builder.property("css-classes", css_classes.into()),
962        }
963    }
964
965    /// The name of this widget in the CSS tree.
966    ///
967    /// This property is meant to be set by widget implementations,
968    /// typically in their instance init function.
969    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
970        Self {
971            builder: self.builder.property("css-name", css_name.into()),
972        }
973    }
974
975    /// The cursor used by @widget.
976    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
977        Self {
978            builder: self.builder.property("cursor", cursor.clone()),
979        }
980    }
981
982    /// Whether the widget should grab focus when it is clicked with the mouse.
983    ///
984    /// This property is only relevant for widgets that can take focus.
985    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
986        Self {
987            builder: self.builder.property("focus-on-click", focus_on_click),
988        }
989    }
990
991    /// Whether this widget itself will accept the input focus.
992    pub fn focusable(self, focusable: bool) -> Self {
993        Self {
994            builder: self.builder.property("focusable", focusable),
995        }
996    }
997
998    /// How to distribute horizontal space if widget gets extra space.
999    pub fn halign(self, halign: Align) -> Self {
1000        Self {
1001            builder: self.builder.property("halign", halign),
1002        }
1003    }
1004
1005    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1006    /// signal on @widget.
1007    ///
1008    /// A true value indicates that @widget can have a tooltip, in this case
1009    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1010    /// determine whether it will provide a tooltip or not.
1011    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1012        Self {
1013            builder: self.builder.property("has-tooltip", has_tooltip),
1014        }
1015    }
1016
1017    /// Overrides for height request of the widget.
1018    ///
1019    /// If this is -1, the natural request will be used.
1020    pub fn height_request(self, height_request: i32) -> Self {
1021        Self {
1022            builder: self.builder.property("height-request", height_request),
1023        }
1024    }
1025
1026    /// Whether to expand horizontally.
1027    pub fn hexpand(self, hexpand: bool) -> Self {
1028        Self {
1029            builder: self.builder.property("hexpand", hexpand),
1030        }
1031    }
1032
1033    /// Whether to use the `hexpand` property.
1034    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1035        Self {
1036            builder: self.builder.property("hexpand-set", hexpand_set),
1037        }
1038    }
1039
1040    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1041    /// the preferred size of the widget, and allocate its children.
1042    ///
1043    /// This property is meant to be set by widget implementations,
1044    /// typically in their instance init function.
1045    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1046        Self {
1047            builder: self
1048                .builder
1049                .property("layout-manager", layout_manager.clone().upcast()),
1050        }
1051    }
1052
1053    /// Makes this widget act like a modal dialog, with respect to
1054    /// event delivery.
1055    ///
1056    /// Global event controllers will not handle events with targets
1057    /// inside the widget, unless they are set up to ignore propagation
1058    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1059    #[cfg(feature = "v4_18")]
1060    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1061    pub fn limit_events(self, limit_events: bool) -> Self {
1062        Self {
1063            builder: self.builder.property("limit-events", limit_events),
1064        }
1065    }
1066
1067    /// Margin on bottom side of widget.
1068    ///
1069    /// This property adds margin outside of the widget's normal size
1070    /// request, the margin will be added in addition to the size from
1071    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1072    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1073        Self {
1074            builder: self.builder.property("margin-bottom", margin_bottom),
1075        }
1076    }
1077
1078    /// Margin on end of widget, horizontally.
1079    ///
1080    /// This property supports left-to-right and right-to-left text
1081    /// directions.
1082    ///
1083    /// This property adds margin outside of the widget's normal size
1084    /// request, the margin will be added in addition to the size from
1085    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1086    pub fn margin_end(self, margin_end: i32) -> Self {
1087        Self {
1088            builder: self.builder.property("margin-end", margin_end),
1089        }
1090    }
1091
1092    /// Margin on start of widget, horizontally.
1093    ///
1094    /// This property supports left-to-right and right-to-left text
1095    /// directions.
1096    ///
1097    /// This property adds margin outside of the widget's normal size
1098    /// request, the margin will be added in addition to the size from
1099    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1100    pub fn margin_start(self, margin_start: i32) -> Self {
1101        Self {
1102            builder: self.builder.property("margin-start", margin_start),
1103        }
1104    }
1105
1106    /// Margin on top side of widget.
1107    ///
1108    /// This property adds margin outside of the widget's normal size
1109    /// request, the margin will be added in addition to the size from
1110    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1111    pub fn margin_top(self, margin_top: i32) -> Self {
1112        Self {
1113            builder: self.builder.property("margin-top", margin_top),
1114        }
1115    }
1116
1117    /// The name of the widget.
1118    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1119        Self {
1120            builder: self.builder.property("name", name.into()),
1121        }
1122    }
1123
1124    /// The requested opacity of the widget.
1125    pub fn opacity(self, opacity: f64) -> Self {
1126        Self {
1127            builder: self.builder.property("opacity", opacity),
1128        }
1129    }
1130
1131    /// How content outside the widget's content area is treated.
1132    ///
1133    /// This property is meant to be set by widget implementations,
1134    /// typically in their instance init function.
1135    pub fn overflow(self, overflow: Overflow) -> Self {
1136        Self {
1137            builder: self.builder.property("overflow", overflow),
1138        }
1139    }
1140
1141    /// Whether the widget will receive the default action when it is focused.
1142    pub fn receives_default(self, receives_default: bool) -> Self {
1143        Self {
1144            builder: self.builder.property("receives-default", receives_default),
1145        }
1146    }
1147
1148    /// Whether the widget responds to input.
1149    pub fn sensitive(self, sensitive: bool) -> Self {
1150        Self {
1151            builder: self.builder.property("sensitive", sensitive),
1152        }
1153    }
1154
1155    /// Sets the text of tooltip to be the given string, which is marked up
1156    /// with Pango markup.
1157    ///
1158    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1159    ///
1160    /// This is a convenience property which will take care of getting the
1161    /// tooltip shown if the given string is not `NULL`:
1162    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1163    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1164    /// the default signal handler.
1165    ///
1166    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1167    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1168    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1169        Self {
1170            builder: self
1171                .builder
1172                .property("tooltip-markup", tooltip_markup.into()),
1173        }
1174    }
1175
1176    /// Sets the text of tooltip to be the given string.
1177    ///
1178    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1179    ///
1180    /// This is a convenience property which will take care of getting the
1181    /// tooltip shown if the given string is not `NULL`:
1182    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1183    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1184    /// the default signal handler.
1185    ///
1186    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1187    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1188    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1189        Self {
1190            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1191        }
1192    }
1193
1194    /// How to distribute vertical space if widget gets extra space.
1195    pub fn valign(self, valign: Align) -> Self {
1196        Self {
1197            builder: self.builder.property("valign", valign),
1198        }
1199    }
1200
1201    /// Whether to expand vertically.
1202    pub fn vexpand(self, vexpand: bool) -> Self {
1203        Self {
1204            builder: self.builder.property("vexpand", vexpand),
1205        }
1206    }
1207
1208    /// Whether to use the `vexpand` property.
1209    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1210        Self {
1211            builder: self.builder.property("vexpand-set", vexpand_set),
1212        }
1213    }
1214
1215    /// Whether the widget is visible.
1216    pub fn visible(self, visible: bool) -> Self {
1217        Self {
1218            builder: self.builder.property("visible", visible),
1219        }
1220    }
1221
1222    /// Overrides for width request of the widget.
1223    ///
1224    /// If this is -1, the natural request will be used.
1225    pub fn width_request(self, width_request: i32) -> Self {
1226        Self {
1227            builder: self.builder.property("width-request", width_request),
1228        }
1229    }
1230
1231    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1232    ///
1233    /// The accessible role cannot be changed once set.
1234    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1235        Self {
1236            builder: self.builder.property("accessible-role", accessible_role),
1237        }
1238    }
1239
1240    /// The orientation of the orientable.
1241    pub fn orientation(self, orientation: Orientation) -> Self {
1242        Self {
1243            builder: self.builder.property("orientation", orientation),
1244        }
1245    }
1246
1247    // rustdoc-stripper-ignore-next
1248    /// Build the [`ShortcutsSection`].
1249    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1250    pub fn build(self) -> ShortcutsSection {
1251        assert_initialized_main_thread!();
1252        self.builder.build()
1253    }
1254}