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