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 ffi, Accessible, AccessibleRole, Align, BaselinePosition, Box, Buildable, ConstraintTarget,
11 LayoutManager, Orientable, Orientation, Overflow, SizeGroup, Widget,
12};
13use glib::{
14 prelude::*,
15 signal::{connect_raw, SignalHandlerId},
16 translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21 /// This widget will be removed in GTK 5
22 /// A [`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 let f: &F = &*(f as *const F);
558 f(&from_glib_borrow(this))
559 }
560 unsafe {
561 let f: Box_<F> = Box_::new(f);
562 connect_raw(
563 self.as_ptr() as *mut _,
564 b"notify::accel-size-group\0".as_ptr() as *const _,
565 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
566 notify_accel_size_group_trampoline::<F> as *const (),
567 )),
568 Box_::into_raw(f),
569 )
570 }
571 }
572
573 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
574 #[doc(alias = "height")]
575 pub fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
576 unsafe extern "C" fn notify_height_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
577 this: *mut ffi::GtkShortcutsGroup,
578 _param_spec: glib::ffi::gpointer,
579 f: glib::ffi::gpointer,
580 ) {
581 let f: &F = &*(f as *const F);
582 f(&from_glib_borrow(this))
583 }
584 unsafe {
585 let f: Box_<F> = Box_::new(f);
586 connect_raw(
587 self.as_ptr() as *mut _,
588 b"notify::height\0".as_ptr() as *const _,
589 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
590 notify_height_trampoline::<F> as *const (),
591 )),
592 Box_::into_raw(f),
593 )
594 }
595 }
596
597 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
598 #[doc(alias = "title")]
599 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
600 unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
601 this: *mut ffi::GtkShortcutsGroup,
602 _param_spec: glib::ffi::gpointer,
603 f: glib::ffi::gpointer,
604 ) {
605 let f: &F = &*(f as *const F);
606 f(&from_glib_borrow(this))
607 }
608 unsafe {
609 let f: Box_<F> = Box_::new(f);
610 connect_raw(
611 self.as_ptr() as *mut _,
612 b"notify::title\0".as_ptr() as *const _,
613 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
614 notify_title_trampoline::<F> as *const (),
615 )),
616 Box_::into_raw(f),
617 )
618 }
619 }
620
621 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
622 #[doc(alias = "title-size-group")]
623 pub fn connect_title_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
624 unsafe extern "C" fn notify_title_size_group_trampoline<
625 F: Fn(&ShortcutsGroup) + 'static,
626 >(
627 this: *mut ffi::GtkShortcutsGroup,
628 _param_spec: glib::ffi::gpointer,
629 f: glib::ffi::gpointer,
630 ) {
631 let f: &F = &*(f as *const F);
632 f(&from_glib_borrow(this))
633 }
634 unsafe {
635 let f: Box_<F> = Box_::new(f);
636 connect_raw(
637 self.as_ptr() as *mut _,
638 b"notify::title-size-group\0".as_ptr() as *const _,
639 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
640 notify_title_size_group_trampoline::<F> as *const (),
641 )),
642 Box_::into_raw(f),
643 )
644 }
645 }
646
647 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
648 #[doc(alias = "view")]
649 pub fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
650 unsafe extern "C" fn notify_view_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
651 this: *mut ffi::GtkShortcutsGroup,
652 _param_spec: glib::ffi::gpointer,
653 f: glib::ffi::gpointer,
654 ) {
655 let f: &F = &*(f as *const F);
656 f(&from_glib_borrow(this))
657 }
658 unsafe {
659 let f: Box_<F> = Box_::new(f);
660 connect_raw(
661 self.as_ptr() as *mut _,
662 b"notify::view\0".as_ptr() as *const _,
663 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
664 notify_view_trampoline::<F> as *const (),
665 )),
666 Box_::into_raw(f),
667 )
668 }
669 }
670}
671
672// rustdoc-stripper-ignore-next
673/// A [builder-pattern] type to construct [`ShortcutsGroup`] objects.
674///
675/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
676#[must_use = "The builder must be built to be used"]
677pub struct ShortcutsGroupBuilder {
678 builder: glib::object::ObjectBuilder<'static, ShortcutsGroup>,
679}
680
681impl ShortcutsGroupBuilder {
682 fn new() -> Self {
683 Self {
684 builder: glib::object::Object::builder(),
685 }
686 }
687
688 /// The size group for the accelerator portion of shortcuts in this group.
689 ///
690 /// This is used internally by GTK, and must not be modified by applications.
691 /// This widget will be removed in GTK 5
692 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
693 pub fn accel_size_group(self, accel_size_group: &SizeGroup) -> Self {
694 Self {
695 builder: self
696 .builder
697 .property("accel-size-group", accel_size_group.clone()),
698 }
699 }
700
701 /// The title for this group of shortcuts.
702 /// This widget will be removed in GTK 5
703 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
704 pub fn title(self, title: impl Into<glib::GString>) -> Self {
705 Self {
706 builder: self.builder.property("title", title.into()),
707 }
708 }
709
710 /// The size group for the textual portion of shortcuts in this group.
711 ///
712 /// This is used internally by GTK, and must not be modified by applications.
713 /// This widget will be removed in GTK 5
714 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
715 pub fn title_size_group(self, title_size_group: &SizeGroup) -> Self {
716 Self {
717 builder: self
718 .builder
719 .property("title-size-group", title_size_group.clone()),
720 }
721 }
722
723 /// An optional view that the shortcuts in this group are relevant for.
724 ///
725 /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name]
726 /// property does not match the view of this group.
727 ///
728 /// Set this to [`None`] to make the group always visible.
729 /// This widget will be removed in GTK 5
730 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
731 pub fn view(self, view: impl Into<glib::GString>) -> Self {
732 Self {
733 builder: self.builder.property("view", view.into()),
734 }
735 }
736
737 /// The position of the child that determines the baseline.
738 ///
739 /// This is only relevant if the box is in vertical orientation.
740 #[cfg(feature = "v4_12")]
741 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
742 pub fn baseline_child(self, baseline_child: i32) -> Self {
743 Self {
744 builder: self.builder.property("baseline-child", baseline_child),
745 }
746 }
747
748 /// How to position baseline-aligned widgets if extra space is available.
749 pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
750 Self {
751 builder: self
752 .builder
753 .property("baseline-position", baseline_position),
754 }
755 }
756
757 /// Whether the children should all be the same size.
758 pub fn homogeneous(self, homogeneous: bool) -> Self {
759 Self {
760 builder: self.builder.property("homogeneous", homogeneous),
761 }
762 }
763
764 /// The amount of space between children.
765 pub fn spacing(self, spacing: i32) -> Self {
766 Self {
767 builder: self.builder.property("spacing", spacing),
768 }
769 }
770
771 /// Whether the widget or any of its descendents can accept
772 /// the input focus.
773 ///
774 /// This property is meant to be set by widget implementations,
775 /// typically in their instance init function.
776 pub fn can_focus(self, can_focus: bool) -> Self {
777 Self {
778 builder: self.builder.property("can-focus", can_focus),
779 }
780 }
781
782 /// Whether the widget can receive pointer events.
783 pub fn can_target(self, can_target: bool) -> Self {
784 Self {
785 builder: self.builder.property("can-target", can_target),
786 }
787 }
788
789 /// A list of css classes applied to this widget.
790 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
791 Self {
792 builder: self.builder.property("css-classes", css_classes.into()),
793 }
794 }
795
796 /// The name of this widget in the CSS tree.
797 ///
798 /// This property is meant to be set by widget implementations,
799 /// typically in their instance init function.
800 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
801 Self {
802 builder: self.builder.property("css-name", css_name.into()),
803 }
804 }
805
806 /// The cursor used by @widget.
807 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
808 Self {
809 builder: self.builder.property("cursor", cursor.clone()),
810 }
811 }
812
813 /// Whether the widget should grab focus when it is clicked with the mouse.
814 ///
815 /// This property is only relevant for widgets that can take focus.
816 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
817 Self {
818 builder: self.builder.property("focus-on-click", focus_on_click),
819 }
820 }
821
822 /// Whether this widget itself will accept the input focus.
823 pub fn focusable(self, focusable: bool) -> Self {
824 Self {
825 builder: self.builder.property("focusable", focusable),
826 }
827 }
828
829 /// How to distribute horizontal space if widget gets extra space.
830 pub fn halign(self, halign: Align) -> Self {
831 Self {
832 builder: self.builder.property("halign", halign),
833 }
834 }
835
836 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
837 /// signal on @widget.
838 ///
839 /// A true value indicates that @widget can have a tooltip, in this case
840 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
841 /// determine whether it will provide a tooltip or not.
842 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
843 Self {
844 builder: self.builder.property("has-tooltip", has_tooltip),
845 }
846 }
847
848 /// Overrides for height request of the widget.
849 ///
850 /// If this is -1, the natural request will be used.
851 pub fn height_request(self, height_request: i32) -> Self {
852 Self {
853 builder: self.builder.property("height-request", height_request),
854 }
855 }
856
857 /// Whether to expand horizontally.
858 pub fn hexpand(self, hexpand: bool) -> Self {
859 Self {
860 builder: self.builder.property("hexpand", hexpand),
861 }
862 }
863
864 /// Whether to use the `hexpand` property.
865 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
866 Self {
867 builder: self.builder.property("hexpand-set", hexpand_set),
868 }
869 }
870
871 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
872 /// the preferred size of the widget, and allocate its children.
873 ///
874 /// This property is meant to be set by widget implementations,
875 /// typically in their instance init function.
876 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
877 Self {
878 builder: self
879 .builder
880 .property("layout-manager", layout_manager.clone().upcast()),
881 }
882 }
883
884 /// Makes this widget act like a modal dialog, with respect to
885 /// event delivery.
886 ///
887 /// Global event controllers will not handle events with targets
888 /// inside the widget, unless they are set up to ignore propagation
889 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
890 #[cfg(feature = "v4_18")]
891 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
892 pub fn limit_events(self, limit_events: bool) -> Self {
893 Self {
894 builder: self.builder.property("limit-events", limit_events),
895 }
896 }
897
898 /// Margin on bottom side of widget.
899 ///
900 /// This property adds margin outside of the widget's normal size
901 /// request, the margin will be added in addition to the size from
902 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
903 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
904 Self {
905 builder: self.builder.property("margin-bottom", margin_bottom),
906 }
907 }
908
909 /// Margin on end of widget, horizontally.
910 ///
911 /// This property supports left-to-right and right-to-left text
912 /// directions.
913 ///
914 /// This property adds margin outside of the widget's normal size
915 /// request, the margin will be added in addition to the size from
916 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
917 pub fn margin_end(self, margin_end: i32) -> Self {
918 Self {
919 builder: self.builder.property("margin-end", margin_end),
920 }
921 }
922
923 /// Margin on start of widget, horizontally.
924 ///
925 /// This property supports left-to-right and right-to-left text
926 /// directions.
927 ///
928 /// This property adds margin outside of the widget's normal size
929 /// request, the margin will be added in addition to the size from
930 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
931 pub fn margin_start(self, margin_start: i32) -> Self {
932 Self {
933 builder: self.builder.property("margin-start", margin_start),
934 }
935 }
936
937 /// Margin on top side of widget.
938 ///
939 /// This property adds margin outside of the widget's normal size
940 /// request, the margin will be added in addition to the size from
941 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
942 pub fn margin_top(self, margin_top: i32) -> Self {
943 Self {
944 builder: self.builder.property("margin-top", margin_top),
945 }
946 }
947
948 /// The name of the widget.
949 pub fn name(self, name: impl Into<glib::GString>) -> Self {
950 Self {
951 builder: self.builder.property("name", name.into()),
952 }
953 }
954
955 /// The requested opacity of the widget.
956 pub fn opacity(self, opacity: f64) -> Self {
957 Self {
958 builder: self.builder.property("opacity", opacity),
959 }
960 }
961
962 /// How content outside the widget's content area is treated.
963 ///
964 /// This property is meant to be set by widget implementations,
965 /// typically in their instance init function.
966 pub fn overflow(self, overflow: Overflow) -> Self {
967 Self {
968 builder: self.builder.property("overflow", overflow),
969 }
970 }
971
972 /// Whether the widget will receive the default action when it is focused.
973 pub fn receives_default(self, receives_default: bool) -> Self {
974 Self {
975 builder: self.builder.property("receives-default", receives_default),
976 }
977 }
978
979 /// Whether the widget responds to input.
980 pub fn sensitive(self, sensitive: bool) -> Self {
981 Self {
982 builder: self.builder.property("sensitive", sensitive),
983 }
984 }
985
986 /// Sets the text of tooltip to be the given string, which is marked up
987 /// with Pango markup.
988 ///
989 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
990 ///
991 /// This is a convenience property which will take care of getting the
992 /// tooltip shown if the given string is not `NULL`:
993 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
994 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
995 /// the default signal handler.
996 ///
997 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
998 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
999 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1000 Self {
1001 builder: self
1002 .builder
1003 .property("tooltip-markup", tooltip_markup.into()),
1004 }
1005 }
1006
1007 /// Sets the text of tooltip to be the given string.
1008 ///
1009 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1010 ///
1011 /// This is a convenience property which will take care of getting the
1012 /// tooltip shown if the given string is not `NULL`:
1013 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1014 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1015 /// the default signal handler.
1016 ///
1017 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1018 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1019 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1020 Self {
1021 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1022 }
1023 }
1024
1025 /// How to distribute vertical space if widget gets extra space.
1026 pub fn valign(self, valign: Align) -> Self {
1027 Self {
1028 builder: self.builder.property("valign", valign),
1029 }
1030 }
1031
1032 /// Whether to expand vertically.
1033 pub fn vexpand(self, vexpand: bool) -> Self {
1034 Self {
1035 builder: self.builder.property("vexpand", vexpand),
1036 }
1037 }
1038
1039 /// Whether to use the `vexpand` property.
1040 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1041 Self {
1042 builder: self.builder.property("vexpand-set", vexpand_set),
1043 }
1044 }
1045
1046 /// Whether the widget is visible.
1047 pub fn visible(self, visible: bool) -> Self {
1048 Self {
1049 builder: self.builder.property("visible", visible),
1050 }
1051 }
1052
1053 /// Overrides for width request of the widget.
1054 ///
1055 /// If this is -1, the natural request will be used.
1056 pub fn width_request(self, width_request: i32) -> Self {
1057 Self {
1058 builder: self.builder.property("width-request", width_request),
1059 }
1060 }
1061
1062 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1063 ///
1064 /// The accessible role cannot be changed once set.
1065 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1066 Self {
1067 builder: self.builder.property("accessible-role", accessible_role),
1068 }
1069 }
1070
1071 /// The orientation of the orientable.
1072 pub fn orientation(self, orientation: Orientation) -> Self {
1073 Self {
1074 builder: self.builder.property("orientation", orientation),
1075 }
1076 }
1077
1078 // rustdoc-stripper-ignore-next
1079 /// Build the [`ShortcutsGroup`].
1080 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1081 pub fn build(self) -> ShortcutsGroup {
1082 assert_initialized_main_thread!();
1083 self.builder.build()
1084 }
1085}