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