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