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