gtk4/auto/shortcuts_shortcut.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
5use crate::{
6 ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7 ShortcutType, SizeGroup, TextDirection, Widget,
8};
9use glib::{
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 /// This widget will be removed in GTK 5
18 /// A [`ShortcutsShortcut`][crate::ShortcutsShortcut] represents a single keyboard shortcut or gesture
19 /// with a short text.
20 ///
21 /// This widget is only meant to be used with [`ShortcutsWindow`][crate::ShortcutsWindow].
22 ///
23 /// ## Properties
24 ///
25 ///
26 /// #### `accel-size-group`
27 /// The size group for the accelerator portion of this shortcut.
28 ///
29 /// This is used internally by GTK, and must not be modified by applications.
30 ///
31 /// Writeable
32 ///
33 ///
34 /// #### `accelerator`
35 /// The accelerator(s) represented by this object.
36 ///
37 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
38 /// is set to [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator].
39 ///
40 /// The syntax of this property is (an extension of) the syntax understood
41 /// by [`accelerator_parse()`][crate::accelerator_parse()]. Multiple accelerators can be specified
42 /// by separating them with a space, but keep in mind that the available width
43 /// is limited.
44 ///
45 /// It is also possible to specify ranges of shortcuts, using `...` between
46 /// the keys. Sequences of keys can be specified using a `+` or `&` between
47 /// the keys.
48 ///
49 /// Examples:
50 ///
51 /// - A single shortcut: `<ctl><alt>delete`
52 /// - Two alternative shortcuts: `<shift>a Home`
53 /// - A range of shortcuts: `<alt>1...<alt>9`
54 /// - Several keys pressed together: `Control_L&Control_R`
55 /// - A sequence of shortcuts or keys: `<ctl>c+<ctl>x`
56 ///
57 /// Use "+" instead of "&" when the keys may (or have to be) pressed
58 /// sequentially (e.g use "t+t" for 'press the t key twice').
59 ///
60 /// Note that `<`, `>` and `&` need to be escaped as `<`, `>`; and `&`; when used
61 /// in .ui files.
62 ///
63 /// Readable | Writeable
64 ///
65 ///
66 /// #### `action-name`
67 /// A detailed action name.
68 ///
69 /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
70 /// then GTK will use the accelerators that are associated with the
71 /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
72 /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
73 ///
74 /// Readable | Writeable
75 ///
76 ///
77 /// #### `direction`
78 /// The text direction for which this shortcut is active.
79 ///
80 /// If the shortcut is used regardless of the text direction,
81 /// set this property to [`TextDirection::None`][crate::TextDirection::None].
82 ///
83 /// Readable | Writeable
84 ///
85 ///
86 /// #### `icon`
87 /// An icon to represent the shortcut or gesture.
88 ///
89 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
90 /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
91 ///
92 /// For the other predefined gesture types, GTK provides an icon on its own.
93 ///
94 /// Readable | Writeable
95 ///
96 ///
97 /// #### `icon-set`
98 /// [`true`] if an icon has been set.
99 ///
100 /// Readable | Writeable
101 ///
102 ///
103 /// #### `shortcut-type`
104 /// The type of shortcut that is represented.
105 ///
106 /// Readable | Writeable
107 ///
108 ///
109 /// #### `subtitle`
110 /// The subtitle for the shortcut or gesture.
111 ///
112 /// This is typically used for gestures and should be a short, one-line
113 /// text that describes the gesture itself. For the predefined gesture
114 /// types, GTK provides a subtitle on its own.
115 ///
116 /// Readable | Writeable
117 ///
118 ///
119 /// #### `subtitle-set`
120 /// [`true`] if a subtitle has been set.
121 ///
122 /// Readable | Writeable
123 ///
124 ///
125 /// #### `title`
126 /// The textual description for the shortcut or gesture represented by
127 /// this object.
128 ///
129 /// This should be a short string that can fit in a single line.
130 ///
131 /// Readable | Writeable
132 ///
133 ///
134 /// #### `title-size-group`
135 /// The size group for the textual portion of this shortcut.
136 ///
137 /// This is used internally by GTK, and must not be modified by applications.
138 ///
139 /// Writeable
140 /// <details><summary><h4>Widget</h4></summary>
141 ///
142 ///
143 /// #### `can-focus`
144 /// Whether the widget or any of its descendents can accept
145 /// the input focus.
146 ///
147 /// This property is meant to be set by widget implementations,
148 /// typically in their instance init function.
149 ///
150 /// Readable | Writeable
151 ///
152 ///
153 /// #### `can-target`
154 /// Whether the widget can receive pointer events.
155 ///
156 /// Readable | Writeable
157 ///
158 ///
159 /// #### `css-classes`
160 /// A list of css classes applied to this widget.
161 ///
162 /// Readable | Writeable
163 ///
164 ///
165 /// #### `css-name`
166 /// The name of this widget in the CSS tree.
167 ///
168 /// This property is meant to be set by widget implementations,
169 /// typically in their instance init function.
170 ///
171 /// Readable | Writeable | Construct Only
172 ///
173 ///
174 /// #### `cursor`
175 /// The cursor used by @widget.
176 ///
177 /// Readable | Writeable
178 ///
179 ///
180 /// #### `focus-on-click`
181 /// Whether the widget should grab focus when it is clicked with the mouse.
182 ///
183 /// This property is only relevant for widgets that can take focus.
184 ///
185 /// Readable | Writeable
186 ///
187 ///
188 /// #### `focusable`
189 /// Whether this widget itself will accept the input focus.
190 ///
191 /// Readable | Writeable
192 ///
193 ///
194 /// #### `halign`
195 /// How to distribute horizontal space if widget gets extra space.
196 ///
197 /// Readable | Writeable
198 ///
199 ///
200 /// #### `has-default`
201 /// Whether the widget is the default widget.
202 ///
203 /// Readable
204 ///
205 ///
206 /// #### `has-focus`
207 /// Whether the widget has the input focus.
208 ///
209 /// Readable
210 ///
211 ///
212 /// #### `has-tooltip`
213 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
214 /// signal on @widget.
215 ///
216 /// A true value indicates that @widget can have a tooltip, in this case
217 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
218 /// determine whether it will provide a tooltip or not.
219 ///
220 /// Readable | Writeable
221 ///
222 ///
223 /// #### `height-request`
224 /// Overrides for height request of the widget.
225 ///
226 /// If this is -1, the natural request will be used.
227 ///
228 /// Readable | Writeable
229 ///
230 ///
231 /// #### `hexpand`
232 /// Whether to expand horizontally.
233 ///
234 /// Readable | Writeable
235 ///
236 ///
237 /// #### `hexpand-set`
238 /// Whether to use the `hexpand` property.
239 ///
240 /// Readable | Writeable
241 ///
242 ///
243 /// #### `layout-manager`
244 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
245 /// the preferred size of the widget, and allocate its children.
246 ///
247 /// This property is meant to be set by widget implementations,
248 /// typically in their instance init function.
249 ///
250 /// Readable | Writeable
251 ///
252 ///
253 /// #### `limit-events`
254 /// Makes this widget act like a modal dialog, with respect to
255 /// event delivery.
256 ///
257 /// Global event controllers will not handle events with targets
258 /// inside the widget, unless they are set up to ignore propagation
259 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
260 ///
261 /// Readable | Writeable
262 ///
263 ///
264 /// #### `margin-bottom`
265 /// Margin on bottom 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 | Writeable
272 ///
273 ///
274 /// #### `margin-end`
275 /// Margin on end of widget, horizontally.
276 ///
277 /// This property supports left-to-right and right-to-left text
278 /// directions.
279 ///
280 /// This property adds margin outside of the widget's normal size
281 /// request, the margin will be added in addition to the size from
282 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
283 ///
284 /// Readable | Writeable
285 ///
286 ///
287 /// #### `margin-start`
288 /// Margin on start of widget, horizontally.
289 ///
290 /// This property supports left-to-right and right-to-left text
291 /// directions.
292 ///
293 /// This property adds margin outside of the widget's normal size
294 /// request, the margin will be added in addition to the size from
295 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
296 ///
297 /// Readable | Writeable
298 ///
299 ///
300 /// #### `margin-top`
301 /// Margin on top side of widget.
302 ///
303 /// This property adds margin outside of the widget's normal size
304 /// request, the margin will be added in addition to the size from
305 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
306 ///
307 /// Readable | Writeable
308 ///
309 ///
310 /// #### `name`
311 /// The name of the widget.
312 ///
313 /// Readable | Writeable
314 ///
315 ///
316 /// #### `opacity`
317 /// The requested opacity of the widget.
318 ///
319 /// Readable | Writeable
320 ///
321 ///
322 /// #### `overflow`
323 /// How content outside the widget's content area is treated.
324 ///
325 /// This property is meant to be set by widget implementations,
326 /// typically in their instance init function.
327 ///
328 /// Readable | Writeable
329 ///
330 ///
331 /// #### `parent`
332 /// The parent widget of this widget.
333 ///
334 /// Readable
335 ///
336 ///
337 /// #### `receives-default`
338 /// Whether the widget will receive the default action when it is focused.
339 ///
340 /// Readable | Writeable
341 ///
342 ///
343 /// #### `root`
344 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
345 ///
346 /// This will be `NULL` if the widget is not contained in a root widget.
347 ///
348 /// Readable
349 ///
350 ///
351 /// #### `scale-factor`
352 /// The scale factor of the widget.
353 ///
354 /// Readable
355 ///
356 ///
357 /// #### `sensitive`
358 /// Whether the widget responds to input.
359 ///
360 /// Readable | Writeable
361 ///
362 ///
363 /// #### `tooltip-markup`
364 /// Sets the text of tooltip to be the given string, which is marked up
365 /// with Pango markup.
366 ///
367 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
368 ///
369 /// This is a convenience property which will take care of getting the
370 /// tooltip shown if the given string is not `NULL`:
371 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
372 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
373 /// the default signal handler.
374 ///
375 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
376 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
377 ///
378 /// Readable | Writeable
379 ///
380 ///
381 /// #### `tooltip-text`
382 /// Sets the text of tooltip to be the given string.
383 ///
384 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
385 ///
386 /// This is a convenience property which will take care of getting the
387 /// tooltip shown if the given string is not `NULL`:
388 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
389 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
390 /// the default signal handler.
391 ///
392 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
393 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
394 ///
395 /// Readable | Writeable
396 ///
397 ///
398 /// #### `valign`
399 /// How to distribute vertical space if widget gets extra space.
400 ///
401 /// Readable | Writeable
402 ///
403 ///
404 /// #### `vexpand`
405 /// Whether to expand vertically.
406 ///
407 /// Readable | Writeable
408 ///
409 ///
410 /// #### `vexpand-set`
411 /// Whether to use the `vexpand` property.
412 ///
413 /// Readable | Writeable
414 ///
415 ///
416 /// #### `visible`
417 /// Whether the widget is visible.
418 ///
419 /// Readable | Writeable
420 ///
421 ///
422 /// #### `width-request`
423 /// Overrides for width request of the widget.
424 ///
425 /// If this is -1, the natural request will be used.
426 ///
427 /// Readable | Writeable
428 /// </details>
429 /// <details><summary><h4>Accessible</h4></summary>
430 ///
431 ///
432 /// #### `accessible-role`
433 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
434 ///
435 /// The accessible role cannot be changed once set.
436 ///
437 /// Readable | Writeable
438 /// </details>
439 ///
440 /// # Implements
441 ///
442 /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
443 #[doc(alias = "GtkShortcutsShortcut")]
444 pub struct ShortcutsShortcut(Object<ffi::GtkShortcutsShortcut, ffi::GtkShortcutsShortcutClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
445
446 match fn {
447 type_ => || ffi::gtk_shortcuts_shortcut_get_type(),
448 }
449}
450
451impl ShortcutsShortcut {
452 // rustdoc-stripper-ignore-next
453 /// Creates a new builder-pattern struct instance to construct [`ShortcutsShortcut`] objects.
454 ///
455 /// This method returns an instance of [`ShortcutsShortcutBuilder`](crate::builders::ShortcutsShortcutBuilder) which can be used to create [`ShortcutsShortcut`] objects.
456 pub fn builder() -> ShortcutsShortcutBuilder {
457 ShortcutsShortcutBuilder::new()
458 }
459
460 /// The size group for the accelerator portion of this shortcut.
461 ///
462 /// This is used internally by GTK, and must not be modified by applications.
463 ///
464 /// # Deprecated since 4.18
465 ///
466 /// This widget will be removed in GTK 5
467 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
468 #[doc(alias = "accel-size-group")]
469 pub fn set_accel_size_group(&self, accel_size_group: Option<&SizeGroup>) {
470 ObjectExt::set_property(self, "accel-size-group", accel_size_group)
471 }
472
473 /// The accelerator(s) represented by this object.
474 ///
475 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
476 /// is set to [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator].
477 ///
478 /// The syntax of this property is (an extension of) the syntax understood
479 /// by [`accelerator_parse()`][crate::accelerator_parse()]. Multiple accelerators can be specified
480 /// by separating them with a space, but keep in mind that the available width
481 /// is limited.
482 ///
483 /// It is also possible to specify ranges of shortcuts, using `...` between
484 /// the keys. Sequences of keys can be specified using a `+` or `&` between
485 /// the keys.
486 ///
487 /// Examples:
488 ///
489 /// - A single shortcut: `<ctl><alt>delete`
490 /// - Two alternative shortcuts: `<shift>a Home`
491 /// - A range of shortcuts: `<alt>1...<alt>9`
492 /// - Several keys pressed together: `Control_L&Control_R`
493 /// - A sequence of shortcuts or keys: `<ctl>c+<ctl>x`
494 ///
495 /// Use "+" instead of "&" when the keys may (or have to be) pressed
496 /// sequentially (e.g use "t+t" for 'press the t key twice').
497 ///
498 /// Note that `<`, `>` and `&` need to be escaped as `<`, `>`; and `&`; when used
499 /// in .ui files.
500 ///
501 /// # Deprecated since 4.18
502 ///
503 /// This widget will be removed in GTK 5
504 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
505 pub fn accelerator(&self) -> Option<glib::GString> {
506 ObjectExt::property(self, "accelerator")
507 }
508
509 /// The accelerator(s) represented by this object.
510 ///
511 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
512 /// is set to [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator].
513 ///
514 /// The syntax of this property is (an extension of) the syntax understood
515 /// by [`accelerator_parse()`][crate::accelerator_parse()]. Multiple accelerators can be specified
516 /// by separating them with a space, but keep in mind that the available width
517 /// is limited.
518 ///
519 /// It is also possible to specify ranges of shortcuts, using `...` between
520 /// the keys. Sequences of keys can be specified using a `+` or `&` between
521 /// the keys.
522 ///
523 /// Examples:
524 ///
525 /// - A single shortcut: `<ctl><alt>delete`
526 /// - Two alternative shortcuts: `<shift>a Home`
527 /// - A range of shortcuts: `<alt>1...<alt>9`
528 /// - Several keys pressed together: `Control_L&Control_R`
529 /// - A sequence of shortcuts or keys: `<ctl>c+<ctl>x`
530 ///
531 /// Use "+" instead of "&" when the keys may (or have to be) pressed
532 /// sequentially (e.g use "t+t" for 'press the t key twice').
533 ///
534 /// Note that `<`, `>` and `&` need to be escaped as `<`, `>`; and `&`; when used
535 /// in .ui files.
536 ///
537 /// # Deprecated since 4.18
538 ///
539 /// This widget will be removed in GTK 5
540 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
541 pub fn set_accelerator(&self, accelerator: Option<&str>) {
542 ObjectExt::set_property(self, "accelerator", accelerator)
543 }
544
545 /// A detailed action name.
546 ///
547 /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
548 /// then GTK will use the accelerators that are associated with the
549 /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
550 /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
551 ///
552 /// # Deprecated since 4.18
553 ///
554 /// This widget will be removed in GTK 5
555 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
556 #[doc(alias = "action-name")]
557 pub fn action_name(&self) -> Option<glib::GString> {
558 ObjectExt::property(self, "action-name")
559 }
560
561 /// A detailed action name.
562 ///
563 /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
564 /// then GTK will use the accelerators that are associated with the
565 /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
566 /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
567 ///
568 /// # Deprecated since 4.18
569 ///
570 /// This widget will be removed in GTK 5
571 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
572 #[doc(alias = "action-name")]
573 pub fn set_action_name(&self, action_name: Option<&str>) {
574 ObjectExt::set_property(self, "action-name", action_name)
575 }
576
577 /// An icon to represent the shortcut or gesture.
578 ///
579 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
580 /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
581 ///
582 /// For the other predefined gesture types, GTK provides an icon on its own.
583 ///
584 /// # Deprecated since 4.18
585 ///
586 /// This widget will be removed in GTK 5
587 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
588 pub fn icon(&self) -> Option<gio::Icon> {
589 ObjectExt::property(self, "icon")
590 }
591
592 /// An icon to represent the shortcut or gesture.
593 ///
594 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
595 /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
596 ///
597 /// For the other predefined gesture types, GTK provides an icon on its own.
598 ///
599 /// # Deprecated since 4.18
600 ///
601 /// This widget will be removed in GTK 5
602 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
603 pub fn set_icon<P: IsA<gio::Icon>>(&self, icon: Option<&P>) {
604 ObjectExt::set_property(self, "icon", icon)
605 }
606
607 /// [`true`] if an icon has been set.
608 ///
609 /// # Deprecated since 4.18
610 ///
611 /// This widget will be removed in GTK 5
612 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
613 #[doc(alias = "icon-set")]
614 pub fn is_icon_set(&self) -> bool {
615 ObjectExt::property(self, "icon-set")
616 }
617
618 /// The type of shortcut that is represented.
619 ///
620 /// # Deprecated since 4.18
621 ///
622 /// This widget will be removed in GTK 5
623 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
624 #[doc(alias = "shortcut-type")]
625 pub fn shortcut_type(&self) -> ShortcutType {
626 ObjectExt::property(self, "shortcut-type")
627 }
628
629 /// The type of shortcut that is represented.
630 ///
631 /// # Deprecated since 4.18
632 ///
633 /// This widget will be removed in GTK 5
634 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
635 #[doc(alias = "shortcut-type")]
636 pub fn set_shortcut_type(&self, shortcut_type: ShortcutType) {
637 ObjectExt::set_property(self, "shortcut-type", shortcut_type)
638 }
639
640 /// The subtitle for the shortcut or gesture.
641 ///
642 /// This is typically used for gestures and should be a short, one-line
643 /// text that describes the gesture itself. For the predefined gesture
644 /// types, GTK provides a subtitle on its own.
645 ///
646 /// # Deprecated since 4.18
647 ///
648 /// This widget will be removed in GTK 5
649 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
650 pub fn subtitle(&self) -> Option<glib::GString> {
651 ObjectExt::property(self, "subtitle")
652 }
653
654 /// The subtitle for the shortcut or gesture.
655 ///
656 /// This is typically used for gestures and should be a short, one-line
657 /// text that describes the gesture itself. For the predefined gesture
658 /// types, GTK provides a subtitle on its own.
659 ///
660 /// # Deprecated since 4.18
661 ///
662 /// This widget will be removed in GTK 5
663 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
664 pub fn set_subtitle(&self, subtitle: Option<&str>) {
665 ObjectExt::set_property(self, "subtitle", subtitle)
666 }
667
668 /// [`true`] if a subtitle has been set.
669 ///
670 /// # Deprecated since 4.18
671 ///
672 /// This widget will be removed in GTK 5
673 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
674 #[doc(alias = "subtitle-set")]
675 pub fn is_subtitle_set(&self) -> bool {
676 ObjectExt::property(self, "subtitle-set")
677 }
678
679 /// The textual description for the shortcut or gesture represented by
680 /// this object.
681 ///
682 /// This should be a short string that can fit in a single line.
683 ///
684 /// # Deprecated since 4.18
685 ///
686 /// This widget will be removed in GTK 5
687 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
688 pub fn title(&self) -> Option<glib::GString> {
689 ObjectExt::property(self, "title")
690 }
691
692 /// The textual description for the shortcut or gesture represented by
693 /// this object.
694 ///
695 /// This should be a short string that can fit in a single line.
696 ///
697 /// # Deprecated since 4.18
698 ///
699 /// This widget will be removed in GTK 5
700 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
701 pub fn set_title(&self, title: Option<&str>) {
702 ObjectExt::set_property(self, "title", title)
703 }
704
705 /// The size group for the textual portion of this shortcut.
706 ///
707 /// This is used internally by GTK, and must not be modified by applications.
708 ///
709 /// # Deprecated since 4.18
710 ///
711 /// This widget will be removed in GTK 5
712 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
713 #[doc(alias = "title-size-group")]
714 pub fn set_title_size_group(&self, title_size_group: Option<&SizeGroup>) {
715 ObjectExt::set_property(self, "title-size-group", title_size_group)
716 }
717
718 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
719 #[doc(alias = "accel-size-group")]
720 pub fn connect_accel_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
721 unsafe extern "C" fn notify_accel_size_group_trampoline<
722 F: Fn(&ShortcutsShortcut) + 'static,
723 >(
724 this: *mut ffi::GtkShortcutsShortcut,
725 _param_spec: glib::ffi::gpointer,
726 f: glib::ffi::gpointer,
727 ) {
728 let f: &F = &*(f as *const F);
729 f(&from_glib_borrow(this))
730 }
731 unsafe {
732 let f: Box_<F> = Box_::new(f);
733 connect_raw(
734 self.as_ptr() as *mut _,
735 b"notify::accel-size-group\0".as_ptr() as *const _,
736 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
737 notify_accel_size_group_trampoline::<F> as *const (),
738 )),
739 Box_::into_raw(f),
740 )
741 }
742 }
743
744 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
745 #[doc(alias = "accelerator")]
746 pub fn connect_accelerator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
747 unsafe extern "C" fn notify_accelerator_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
748 this: *mut ffi::GtkShortcutsShortcut,
749 _param_spec: glib::ffi::gpointer,
750 f: glib::ffi::gpointer,
751 ) {
752 let f: &F = &*(f as *const F);
753 f(&from_glib_borrow(this))
754 }
755 unsafe {
756 let f: Box_<F> = Box_::new(f);
757 connect_raw(
758 self.as_ptr() as *mut _,
759 b"notify::accelerator\0".as_ptr() as *const _,
760 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
761 notify_accelerator_trampoline::<F> as *const (),
762 )),
763 Box_::into_raw(f),
764 )
765 }
766 }
767
768 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
769 #[doc(alias = "action-name")]
770 pub fn connect_action_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
771 unsafe extern "C" fn notify_action_name_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
772 this: *mut ffi::GtkShortcutsShortcut,
773 _param_spec: glib::ffi::gpointer,
774 f: glib::ffi::gpointer,
775 ) {
776 let f: &F = &*(f as *const F);
777 f(&from_glib_borrow(this))
778 }
779 unsafe {
780 let f: Box_<F> = Box_::new(f);
781 connect_raw(
782 self.as_ptr() as *mut _,
783 b"notify::action-name\0".as_ptr() as *const _,
784 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
785 notify_action_name_trampoline::<F> as *const (),
786 )),
787 Box_::into_raw(f),
788 )
789 }
790 }
791
792 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
793 #[doc(alias = "direction")]
794 pub fn connect_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
795 unsafe extern "C" fn notify_direction_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
796 this: *mut ffi::GtkShortcutsShortcut,
797 _param_spec: glib::ffi::gpointer,
798 f: glib::ffi::gpointer,
799 ) {
800 let f: &F = &*(f as *const F);
801 f(&from_glib_borrow(this))
802 }
803 unsafe {
804 let f: Box_<F> = Box_::new(f);
805 connect_raw(
806 self.as_ptr() as *mut _,
807 b"notify::direction\0".as_ptr() as *const _,
808 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
809 notify_direction_trampoline::<F> as *const (),
810 )),
811 Box_::into_raw(f),
812 )
813 }
814 }
815
816 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
817 #[doc(alias = "icon")]
818 pub fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
819 unsafe extern "C" fn notify_icon_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
820 this: *mut ffi::GtkShortcutsShortcut,
821 _param_spec: glib::ffi::gpointer,
822 f: glib::ffi::gpointer,
823 ) {
824 let f: &F = &*(f as *const F);
825 f(&from_glib_borrow(this))
826 }
827 unsafe {
828 let f: Box_<F> = Box_::new(f);
829 connect_raw(
830 self.as_ptr() as *mut _,
831 b"notify::icon\0".as_ptr() as *const _,
832 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
833 notify_icon_trampoline::<F> as *const (),
834 )),
835 Box_::into_raw(f),
836 )
837 }
838 }
839
840 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
841 #[doc(alias = "icon-set")]
842 pub fn connect_icon_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
843 unsafe extern "C" fn notify_icon_set_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
844 this: *mut ffi::GtkShortcutsShortcut,
845 _param_spec: glib::ffi::gpointer,
846 f: glib::ffi::gpointer,
847 ) {
848 let f: &F = &*(f as *const F);
849 f(&from_glib_borrow(this))
850 }
851 unsafe {
852 let f: Box_<F> = Box_::new(f);
853 connect_raw(
854 self.as_ptr() as *mut _,
855 b"notify::icon-set\0".as_ptr() as *const _,
856 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
857 notify_icon_set_trampoline::<F> as *const (),
858 )),
859 Box_::into_raw(f),
860 )
861 }
862 }
863
864 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
865 #[doc(alias = "shortcut-type")]
866 pub fn connect_shortcut_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
867 unsafe extern "C" fn notify_shortcut_type_trampoline<
868 F: Fn(&ShortcutsShortcut) + 'static,
869 >(
870 this: *mut ffi::GtkShortcutsShortcut,
871 _param_spec: glib::ffi::gpointer,
872 f: glib::ffi::gpointer,
873 ) {
874 let f: &F = &*(f as *const F);
875 f(&from_glib_borrow(this))
876 }
877 unsafe {
878 let f: Box_<F> = Box_::new(f);
879 connect_raw(
880 self.as_ptr() as *mut _,
881 b"notify::shortcut-type\0".as_ptr() as *const _,
882 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
883 notify_shortcut_type_trampoline::<F> as *const (),
884 )),
885 Box_::into_raw(f),
886 )
887 }
888 }
889
890 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
891 #[doc(alias = "subtitle")]
892 pub fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
893 unsafe extern "C" fn notify_subtitle_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
894 this: *mut ffi::GtkShortcutsShortcut,
895 _param_spec: glib::ffi::gpointer,
896 f: glib::ffi::gpointer,
897 ) {
898 let f: &F = &*(f as *const F);
899 f(&from_glib_borrow(this))
900 }
901 unsafe {
902 let f: Box_<F> = Box_::new(f);
903 connect_raw(
904 self.as_ptr() as *mut _,
905 b"notify::subtitle\0".as_ptr() as *const _,
906 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
907 notify_subtitle_trampoline::<F> as *const (),
908 )),
909 Box_::into_raw(f),
910 )
911 }
912 }
913
914 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
915 #[doc(alias = "subtitle-set")]
916 pub fn connect_subtitle_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
917 unsafe extern "C" fn notify_subtitle_set_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
918 this: *mut ffi::GtkShortcutsShortcut,
919 _param_spec: glib::ffi::gpointer,
920 f: glib::ffi::gpointer,
921 ) {
922 let f: &F = &*(f as *const F);
923 f(&from_glib_borrow(this))
924 }
925 unsafe {
926 let f: Box_<F> = Box_::new(f);
927 connect_raw(
928 self.as_ptr() as *mut _,
929 b"notify::subtitle-set\0".as_ptr() as *const _,
930 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
931 notify_subtitle_set_trampoline::<F> as *const (),
932 )),
933 Box_::into_raw(f),
934 )
935 }
936 }
937
938 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
939 #[doc(alias = "title")]
940 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
941 unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
942 this: *mut ffi::GtkShortcutsShortcut,
943 _param_spec: glib::ffi::gpointer,
944 f: glib::ffi::gpointer,
945 ) {
946 let f: &F = &*(f as *const F);
947 f(&from_glib_borrow(this))
948 }
949 unsafe {
950 let f: Box_<F> = Box_::new(f);
951 connect_raw(
952 self.as_ptr() as *mut _,
953 b"notify::title\0".as_ptr() as *const _,
954 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
955 notify_title_trampoline::<F> as *const (),
956 )),
957 Box_::into_raw(f),
958 )
959 }
960 }
961
962 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
963 #[doc(alias = "title-size-group")]
964 pub fn connect_title_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
965 unsafe extern "C" fn notify_title_size_group_trampoline<
966 F: Fn(&ShortcutsShortcut) + 'static,
967 >(
968 this: *mut ffi::GtkShortcutsShortcut,
969 _param_spec: glib::ffi::gpointer,
970 f: glib::ffi::gpointer,
971 ) {
972 let f: &F = &*(f as *const F);
973 f(&from_glib_borrow(this))
974 }
975 unsafe {
976 let f: Box_<F> = Box_::new(f);
977 connect_raw(
978 self.as_ptr() as *mut _,
979 b"notify::title-size-group\0".as_ptr() as *const _,
980 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
981 notify_title_size_group_trampoline::<F> as *const (),
982 )),
983 Box_::into_raw(f),
984 )
985 }
986 }
987}
988
989// rustdoc-stripper-ignore-next
990/// A [builder-pattern] type to construct [`ShortcutsShortcut`] objects.
991///
992/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
993#[must_use = "The builder must be built to be used"]
994pub struct ShortcutsShortcutBuilder {
995 builder: glib::object::ObjectBuilder<'static, ShortcutsShortcut>,
996}
997
998impl ShortcutsShortcutBuilder {
999 fn new() -> Self {
1000 Self {
1001 builder: glib::object::Object::builder(),
1002 }
1003 }
1004
1005 /// The size group for the accelerator portion of this shortcut.
1006 ///
1007 /// This is used internally by GTK, and must not be modified by applications.
1008 /// This widget will be removed in GTK 5
1009 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1010 pub fn accel_size_group(self, accel_size_group: &SizeGroup) -> Self {
1011 Self {
1012 builder: self
1013 .builder
1014 .property("accel-size-group", accel_size_group.clone()),
1015 }
1016 }
1017
1018 /// The accelerator(s) represented by this object.
1019 ///
1020 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
1021 /// is set to [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator].
1022 ///
1023 /// The syntax of this property is (an extension of) the syntax understood
1024 /// by [`accelerator_parse()`][crate::accelerator_parse()]. Multiple accelerators can be specified
1025 /// by separating them with a space, but keep in mind that the available width
1026 /// is limited.
1027 ///
1028 /// It is also possible to specify ranges of shortcuts, using `...` between
1029 /// the keys. Sequences of keys can be specified using a `+` or `&` between
1030 /// the keys.
1031 ///
1032 /// Examples:
1033 ///
1034 /// - A single shortcut: `<ctl><alt>delete`
1035 /// - Two alternative shortcuts: `<shift>a Home`
1036 /// - A range of shortcuts: `<alt>1...<alt>9`
1037 /// - Several keys pressed together: `Control_L&Control_R`
1038 /// - A sequence of shortcuts or keys: `<ctl>c+<ctl>x`
1039 ///
1040 /// Use "+" instead of "&" when the keys may (or have to be) pressed
1041 /// sequentially (e.g use "t+t" for 'press the t key twice').
1042 ///
1043 /// Note that `<`, `>` and `&` need to be escaped as `<`, `>`; and `&`; when used
1044 /// in .ui files.
1045 /// This widget will be removed in GTK 5
1046 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1047 pub fn accelerator(self, accelerator: impl Into<glib::GString>) -> Self {
1048 Self {
1049 builder: self.builder.property("accelerator", accelerator.into()),
1050 }
1051 }
1052
1053 /// A detailed action name.
1054 ///
1055 /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
1056 /// then GTK will use the accelerators that are associated with the
1057 /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
1058 /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
1059 /// This widget will be removed in GTK 5
1060 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1061 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1062 Self {
1063 builder: self.builder.property("action-name", action_name.into()),
1064 }
1065 }
1066
1067 /// The text direction for which this shortcut is active.
1068 ///
1069 /// If the shortcut is used regardless of the text direction,
1070 /// set this property to [`TextDirection::None`][crate::TextDirection::None].
1071 /// This widget will be removed in GTK 5
1072 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1073 pub fn direction(self, direction: TextDirection) -> Self {
1074 Self {
1075 builder: self.builder.property("direction", direction),
1076 }
1077 }
1078
1079 /// An icon to represent the shortcut or gesture.
1080 ///
1081 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
1082 /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
1083 ///
1084 /// For the other predefined gesture types, GTK provides an icon on its own.
1085 /// This widget will be removed in GTK 5
1086 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1087 pub fn icon(self, icon: &impl IsA<gio::Icon>) -> Self {
1088 Self {
1089 builder: self.builder.property("icon", icon.clone().upcast()),
1090 }
1091 }
1092
1093 /// [`true`] if an icon has been set.
1094 /// This widget will be removed in GTK 5
1095 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1096 pub fn icon_set(self, icon_set: bool) -> Self {
1097 Self {
1098 builder: self.builder.property("icon-set", icon_set),
1099 }
1100 }
1101
1102 /// The type of shortcut that is represented.
1103 /// This widget will be removed in GTK 5
1104 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1105 pub fn shortcut_type(self, shortcut_type: ShortcutType) -> Self {
1106 Self {
1107 builder: self.builder.property("shortcut-type", shortcut_type),
1108 }
1109 }
1110
1111 /// The subtitle for the shortcut or gesture.
1112 ///
1113 /// This is typically used for gestures and should be a short, one-line
1114 /// text that describes the gesture itself. For the predefined gesture
1115 /// types, GTK provides a subtitle on its own.
1116 /// This widget will be removed in GTK 5
1117 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1118 pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
1119 Self {
1120 builder: self.builder.property("subtitle", subtitle.into()),
1121 }
1122 }
1123
1124 /// [`true`] if a subtitle has been set.
1125 /// This widget will be removed in GTK 5
1126 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1127 pub fn subtitle_set(self, subtitle_set: bool) -> Self {
1128 Self {
1129 builder: self.builder.property("subtitle-set", subtitle_set),
1130 }
1131 }
1132
1133 /// The textual description for the shortcut or gesture represented by
1134 /// this object.
1135 ///
1136 /// This should be a short string that can fit in a single line.
1137 /// This widget will be removed in GTK 5
1138 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1139 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1140 Self {
1141 builder: self.builder.property("title", title.into()),
1142 }
1143 }
1144
1145 /// The size group for the textual portion of this shortcut.
1146 ///
1147 /// This is used internally by GTK, and must not be modified by applications.
1148 /// This widget will be removed in GTK 5
1149 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1150 pub fn title_size_group(self, title_size_group: &SizeGroup) -> Self {
1151 Self {
1152 builder: self
1153 .builder
1154 .property("title-size-group", title_size_group.clone()),
1155 }
1156 }
1157
1158 /// Whether the widget or any of its descendents can accept
1159 /// the input focus.
1160 ///
1161 /// This property is meant to be set by widget implementations,
1162 /// typically in their instance init function.
1163 pub fn can_focus(self, can_focus: bool) -> Self {
1164 Self {
1165 builder: self.builder.property("can-focus", can_focus),
1166 }
1167 }
1168
1169 /// Whether the widget can receive pointer events.
1170 pub fn can_target(self, can_target: bool) -> Self {
1171 Self {
1172 builder: self.builder.property("can-target", can_target),
1173 }
1174 }
1175
1176 /// A list of css classes applied to this widget.
1177 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1178 Self {
1179 builder: self.builder.property("css-classes", css_classes.into()),
1180 }
1181 }
1182
1183 /// The name of this widget in the CSS tree.
1184 ///
1185 /// This property is meant to be set by widget implementations,
1186 /// typically in their instance init function.
1187 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1188 Self {
1189 builder: self.builder.property("css-name", css_name.into()),
1190 }
1191 }
1192
1193 /// The cursor used by @widget.
1194 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1195 Self {
1196 builder: self.builder.property("cursor", cursor.clone()),
1197 }
1198 }
1199
1200 /// Whether the widget should grab focus when it is clicked with the mouse.
1201 ///
1202 /// This property is only relevant for widgets that can take focus.
1203 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1204 Self {
1205 builder: self.builder.property("focus-on-click", focus_on_click),
1206 }
1207 }
1208
1209 /// Whether this widget itself will accept the input focus.
1210 pub fn focusable(self, focusable: bool) -> Self {
1211 Self {
1212 builder: self.builder.property("focusable", focusable),
1213 }
1214 }
1215
1216 /// How to distribute horizontal space if widget gets extra space.
1217 pub fn halign(self, halign: Align) -> Self {
1218 Self {
1219 builder: self.builder.property("halign", halign),
1220 }
1221 }
1222
1223 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1224 /// signal on @widget.
1225 ///
1226 /// A true value indicates that @widget can have a tooltip, in this case
1227 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1228 /// determine whether it will provide a tooltip or not.
1229 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1230 Self {
1231 builder: self.builder.property("has-tooltip", has_tooltip),
1232 }
1233 }
1234
1235 /// Overrides for height request of the widget.
1236 ///
1237 /// If this is -1, the natural request will be used.
1238 pub fn height_request(self, height_request: i32) -> Self {
1239 Self {
1240 builder: self.builder.property("height-request", height_request),
1241 }
1242 }
1243
1244 /// Whether to expand horizontally.
1245 pub fn hexpand(self, hexpand: bool) -> Self {
1246 Self {
1247 builder: self.builder.property("hexpand", hexpand),
1248 }
1249 }
1250
1251 /// Whether to use the `hexpand` property.
1252 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1253 Self {
1254 builder: self.builder.property("hexpand-set", hexpand_set),
1255 }
1256 }
1257
1258 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1259 /// the preferred size of the widget, and allocate its children.
1260 ///
1261 /// This property is meant to be set by widget implementations,
1262 /// typically in their instance init function.
1263 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1264 Self {
1265 builder: self
1266 .builder
1267 .property("layout-manager", layout_manager.clone().upcast()),
1268 }
1269 }
1270
1271 /// Makes this widget act like a modal dialog, with respect to
1272 /// event delivery.
1273 ///
1274 /// Global event controllers will not handle events with targets
1275 /// inside the widget, unless they are set up to ignore propagation
1276 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1277 #[cfg(feature = "v4_18")]
1278 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1279 pub fn limit_events(self, limit_events: bool) -> Self {
1280 Self {
1281 builder: self.builder.property("limit-events", limit_events),
1282 }
1283 }
1284
1285 /// Margin on bottom side of widget.
1286 ///
1287 /// This property adds margin outside of the widget's normal size
1288 /// request, the margin will be added in addition to the size from
1289 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1290 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1291 Self {
1292 builder: self.builder.property("margin-bottom", margin_bottom),
1293 }
1294 }
1295
1296 /// Margin on end of widget, horizontally.
1297 ///
1298 /// This property supports left-to-right and right-to-left text
1299 /// directions.
1300 ///
1301 /// This property adds margin outside of the widget's normal size
1302 /// request, the margin will be added in addition to the size from
1303 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1304 pub fn margin_end(self, margin_end: i32) -> Self {
1305 Self {
1306 builder: self.builder.property("margin-end", margin_end),
1307 }
1308 }
1309
1310 /// Margin on start of widget, horizontally.
1311 ///
1312 /// This property supports left-to-right and right-to-left text
1313 /// directions.
1314 ///
1315 /// This property adds margin outside of the widget's normal size
1316 /// request, the margin will be added in addition to the size from
1317 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1318 pub fn margin_start(self, margin_start: i32) -> Self {
1319 Self {
1320 builder: self.builder.property("margin-start", margin_start),
1321 }
1322 }
1323
1324 /// Margin on top side of widget.
1325 ///
1326 /// This property adds margin outside of the widget's normal size
1327 /// request, the margin will be added in addition to the size from
1328 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1329 pub fn margin_top(self, margin_top: i32) -> Self {
1330 Self {
1331 builder: self.builder.property("margin-top", margin_top),
1332 }
1333 }
1334
1335 /// The name of the widget.
1336 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1337 Self {
1338 builder: self.builder.property("name", name.into()),
1339 }
1340 }
1341
1342 /// The requested opacity of the widget.
1343 pub fn opacity(self, opacity: f64) -> Self {
1344 Self {
1345 builder: self.builder.property("opacity", opacity),
1346 }
1347 }
1348
1349 /// How content outside the widget's content area is treated.
1350 ///
1351 /// This property is meant to be set by widget implementations,
1352 /// typically in their instance init function.
1353 pub fn overflow(self, overflow: Overflow) -> Self {
1354 Self {
1355 builder: self.builder.property("overflow", overflow),
1356 }
1357 }
1358
1359 /// Whether the widget will receive the default action when it is focused.
1360 pub fn receives_default(self, receives_default: bool) -> Self {
1361 Self {
1362 builder: self.builder.property("receives-default", receives_default),
1363 }
1364 }
1365
1366 /// Whether the widget responds to input.
1367 pub fn sensitive(self, sensitive: bool) -> Self {
1368 Self {
1369 builder: self.builder.property("sensitive", sensitive),
1370 }
1371 }
1372
1373 /// Sets the text of tooltip to be the given string, which is marked up
1374 /// with Pango markup.
1375 ///
1376 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1377 ///
1378 /// This is a convenience property which will take care of getting the
1379 /// tooltip shown if the given string is not `NULL`:
1380 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1381 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1382 /// the default signal handler.
1383 ///
1384 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1385 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1386 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1387 Self {
1388 builder: self
1389 .builder
1390 .property("tooltip-markup", tooltip_markup.into()),
1391 }
1392 }
1393
1394 /// Sets the text of tooltip to be the given string.
1395 ///
1396 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1397 ///
1398 /// This is a convenience property which will take care of getting the
1399 /// tooltip shown if the given string is not `NULL`:
1400 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1401 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1402 /// the default signal handler.
1403 ///
1404 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1405 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1406 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1407 Self {
1408 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1409 }
1410 }
1411
1412 /// How to distribute vertical space if widget gets extra space.
1413 pub fn valign(self, valign: Align) -> Self {
1414 Self {
1415 builder: self.builder.property("valign", valign),
1416 }
1417 }
1418
1419 /// Whether to expand vertically.
1420 pub fn vexpand(self, vexpand: bool) -> Self {
1421 Self {
1422 builder: self.builder.property("vexpand", vexpand),
1423 }
1424 }
1425
1426 /// Whether to use the `vexpand` property.
1427 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1428 Self {
1429 builder: self.builder.property("vexpand-set", vexpand_set),
1430 }
1431 }
1432
1433 /// Whether the widget is visible.
1434 pub fn visible(self, visible: bool) -> Self {
1435 Self {
1436 builder: self.builder.property("visible", visible),
1437 }
1438 }
1439
1440 /// Overrides for width request of the widget.
1441 ///
1442 /// If this is -1, the natural request will be used.
1443 pub fn width_request(self, width_request: i32) -> Self {
1444 Self {
1445 builder: self.builder.property("width-request", width_request),
1446 }
1447 }
1448
1449 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1450 ///
1451 /// The accessible role cannot be changed once set.
1452 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1453 Self {
1454 builder: self.builder.property("accessible-role", accessible_role),
1455 }
1456 }
1457
1458 // rustdoc-stripper-ignore-next
1459 /// Build the [`ShortcutsShortcut`].
1460 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1461 pub fn build(self) -> ShortcutsShortcut {
1462 assert_initialized_main_thread!();
1463 self.builder.build()
1464 }
1465}