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 Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7 ShortcutType, SizeGroup, TextDirection, Widget, ffi,
8};
9use glib::{
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
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 unsafe {
729 let f: &F = &*(f as *const F);
730 f(&from_glib_borrow(this))
731 }
732 }
733 unsafe {
734 let f: Box_<F> = Box_::new(f);
735 connect_raw(
736 self.as_ptr() as *mut _,
737 c"notify::accel-size-group".as_ptr() as *const _,
738 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
739 notify_accel_size_group_trampoline::<F> as *const (),
740 )),
741 Box_::into_raw(f),
742 )
743 }
744 }
745
746 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
747 #[doc(alias = "accelerator")]
748 pub fn connect_accelerator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
749 unsafe extern "C" fn notify_accelerator_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
750 this: *mut ffi::GtkShortcutsShortcut,
751 _param_spec: glib::ffi::gpointer,
752 f: glib::ffi::gpointer,
753 ) {
754 unsafe {
755 let f: &F = &*(f as *const F);
756 f(&from_glib_borrow(this))
757 }
758 }
759 unsafe {
760 let f: Box_<F> = Box_::new(f);
761 connect_raw(
762 self.as_ptr() as *mut _,
763 c"notify::accelerator".as_ptr() as *const _,
764 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
765 notify_accelerator_trampoline::<F> as *const (),
766 )),
767 Box_::into_raw(f),
768 )
769 }
770 }
771
772 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
773 #[doc(alias = "action-name")]
774 pub fn connect_action_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
775 unsafe extern "C" fn notify_action_name_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
776 this: *mut ffi::GtkShortcutsShortcut,
777 _param_spec: glib::ffi::gpointer,
778 f: glib::ffi::gpointer,
779 ) {
780 unsafe {
781 let f: &F = &*(f as *const F);
782 f(&from_glib_borrow(this))
783 }
784 }
785 unsafe {
786 let f: Box_<F> = Box_::new(f);
787 connect_raw(
788 self.as_ptr() as *mut _,
789 c"notify::action-name".as_ptr() as *const _,
790 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
791 notify_action_name_trampoline::<F> as *const (),
792 )),
793 Box_::into_raw(f),
794 )
795 }
796 }
797
798 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
799 #[doc(alias = "direction")]
800 pub fn connect_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
801 unsafe extern "C" fn notify_direction_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
802 this: *mut ffi::GtkShortcutsShortcut,
803 _param_spec: glib::ffi::gpointer,
804 f: glib::ffi::gpointer,
805 ) {
806 unsafe {
807 let f: &F = &*(f as *const F);
808 f(&from_glib_borrow(this))
809 }
810 }
811 unsafe {
812 let f: Box_<F> = Box_::new(f);
813 connect_raw(
814 self.as_ptr() as *mut _,
815 c"notify::direction".as_ptr() as *const _,
816 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
817 notify_direction_trampoline::<F> as *const (),
818 )),
819 Box_::into_raw(f),
820 )
821 }
822 }
823
824 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
825 #[doc(alias = "icon")]
826 pub fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
827 unsafe extern "C" fn notify_icon_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
828 this: *mut ffi::GtkShortcutsShortcut,
829 _param_spec: glib::ffi::gpointer,
830 f: glib::ffi::gpointer,
831 ) {
832 unsafe {
833 let f: &F = &*(f as *const F);
834 f(&from_glib_borrow(this))
835 }
836 }
837 unsafe {
838 let f: Box_<F> = Box_::new(f);
839 connect_raw(
840 self.as_ptr() as *mut _,
841 c"notify::icon".as_ptr() as *const _,
842 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
843 notify_icon_trampoline::<F> as *const (),
844 )),
845 Box_::into_raw(f),
846 )
847 }
848 }
849
850 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
851 #[doc(alias = "icon-set")]
852 pub fn connect_icon_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
853 unsafe extern "C" fn notify_icon_set_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
854 this: *mut ffi::GtkShortcutsShortcut,
855 _param_spec: glib::ffi::gpointer,
856 f: glib::ffi::gpointer,
857 ) {
858 unsafe {
859 let f: &F = &*(f as *const F);
860 f(&from_glib_borrow(this))
861 }
862 }
863 unsafe {
864 let f: Box_<F> = Box_::new(f);
865 connect_raw(
866 self.as_ptr() as *mut _,
867 c"notify::icon-set".as_ptr() as *const _,
868 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
869 notify_icon_set_trampoline::<F> as *const (),
870 )),
871 Box_::into_raw(f),
872 )
873 }
874 }
875
876 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
877 #[doc(alias = "shortcut-type")]
878 pub fn connect_shortcut_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
879 unsafe extern "C" fn notify_shortcut_type_trampoline<
880 F: Fn(&ShortcutsShortcut) + 'static,
881 >(
882 this: *mut ffi::GtkShortcutsShortcut,
883 _param_spec: glib::ffi::gpointer,
884 f: glib::ffi::gpointer,
885 ) {
886 unsafe {
887 let f: &F = &*(f as *const F);
888 f(&from_glib_borrow(this))
889 }
890 }
891 unsafe {
892 let f: Box_<F> = Box_::new(f);
893 connect_raw(
894 self.as_ptr() as *mut _,
895 c"notify::shortcut-type".as_ptr() as *const _,
896 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
897 notify_shortcut_type_trampoline::<F> as *const (),
898 )),
899 Box_::into_raw(f),
900 )
901 }
902 }
903
904 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
905 #[doc(alias = "subtitle")]
906 pub fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
907 unsafe extern "C" fn notify_subtitle_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
908 this: *mut ffi::GtkShortcutsShortcut,
909 _param_spec: glib::ffi::gpointer,
910 f: glib::ffi::gpointer,
911 ) {
912 unsafe {
913 let f: &F = &*(f as *const F);
914 f(&from_glib_borrow(this))
915 }
916 }
917 unsafe {
918 let f: Box_<F> = Box_::new(f);
919 connect_raw(
920 self.as_ptr() as *mut _,
921 c"notify::subtitle".as_ptr() as *const _,
922 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
923 notify_subtitle_trampoline::<F> as *const (),
924 )),
925 Box_::into_raw(f),
926 )
927 }
928 }
929
930 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
931 #[doc(alias = "subtitle-set")]
932 pub fn connect_subtitle_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
933 unsafe extern "C" fn notify_subtitle_set_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
934 this: *mut ffi::GtkShortcutsShortcut,
935 _param_spec: glib::ffi::gpointer,
936 f: glib::ffi::gpointer,
937 ) {
938 unsafe {
939 let f: &F = &*(f as *const F);
940 f(&from_glib_borrow(this))
941 }
942 }
943 unsafe {
944 let f: Box_<F> = Box_::new(f);
945 connect_raw(
946 self.as_ptr() as *mut _,
947 c"notify::subtitle-set".as_ptr() as *const _,
948 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
949 notify_subtitle_set_trampoline::<F> as *const (),
950 )),
951 Box_::into_raw(f),
952 )
953 }
954 }
955
956 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
957 #[doc(alias = "title")]
958 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
959 unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsShortcut) + 'static>(
960 this: *mut ffi::GtkShortcutsShortcut,
961 _param_spec: glib::ffi::gpointer,
962 f: glib::ffi::gpointer,
963 ) {
964 unsafe {
965 let f: &F = &*(f as *const F);
966 f(&from_glib_borrow(this))
967 }
968 }
969 unsafe {
970 let f: Box_<F> = Box_::new(f);
971 connect_raw(
972 self.as_ptr() as *mut _,
973 c"notify::title".as_ptr() as *const _,
974 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
975 notify_title_trampoline::<F> as *const (),
976 )),
977 Box_::into_raw(f),
978 )
979 }
980 }
981
982 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
983 #[doc(alias = "title-size-group")]
984 pub fn connect_title_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
985 unsafe extern "C" fn notify_title_size_group_trampoline<
986 F: Fn(&ShortcutsShortcut) + 'static,
987 >(
988 this: *mut ffi::GtkShortcutsShortcut,
989 _param_spec: glib::ffi::gpointer,
990 f: glib::ffi::gpointer,
991 ) {
992 unsafe {
993 let f: &F = &*(f as *const F);
994 f(&from_glib_borrow(this))
995 }
996 }
997 unsafe {
998 let f: Box_<F> = Box_::new(f);
999 connect_raw(
1000 self.as_ptr() as *mut _,
1001 c"notify::title-size-group".as_ptr() as *const _,
1002 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1003 notify_title_size_group_trampoline::<F> as *const (),
1004 )),
1005 Box_::into_raw(f),
1006 )
1007 }
1008 }
1009}
1010
1011// rustdoc-stripper-ignore-next
1012/// A [builder-pattern] type to construct [`ShortcutsShortcut`] objects.
1013///
1014/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1015#[must_use = "The builder must be built to be used"]
1016pub struct ShortcutsShortcutBuilder {
1017 builder: glib::object::ObjectBuilder<'static, ShortcutsShortcut>,
1018}
1019
1020impl ShortcutsShortcutBuilder {
1021 fn new() -> Self {
1022 Self {
1023 builder: glib::object::Object::builder(),
1024 }
1025 }
1026
1027 /// The size group for the accelerator portion of this shortcut.
1028 ///
1029 /// This is used internally by GTK, and must not be modified by applications.
1030 /// This widget will be removed in GTK 5
1031 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1032 pub fn accel_size_group(self, accel_size_group: &SizeGroup) -> Self {
1033 Self {
1034 builder: self
1035 .builder
1036 .property("accel-size-group", accel_size_group.clone()),
1037 }
1038 }
1039
1040 /// The accelerator(s) represented by this object.
1041 ///
1042 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
1043 /// is set to [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator].
1044 ///
1045 /// The syntax of this property is (an extension of) the syntax understood
1046 /// by [`accelerator_parse()`][crate::accelerator_parse()]. Multiple accelerators can be specified
1047 /// by separating them with a space, but keep in mind that the available width
1048 /// is limited.
1049 ///
1050 /// It is also possible to specify ranges of shortcuts, using `...` between
1051 /// the keys. Sequences of keys can be specified using a `+` or `&` between
1052 /// the keys.
1053 ///
1054 /// Examples:
1055 ///
1056 /// - A single shortcut: `<ctl><alt>delete`
1057 /// - Two alternative shortcuts: `<shift>a Home`
1058 /// - A range of shortcuts: `<alt>1...<alt>9`
1059 /// - Several keys pressed together: `Control_L&Control_R`
1060 /// - A sequence of shortcuts or keys: `<ctl>c+<ctl>x`
1061 ///
1062 /// Use "+" instead of "&" when the keys may (or have to be) pressed
1063 /// sequentially (e.g use "t+t" for 'press the t key twice').
1064 ///
1065 /// Note that `<`, `>` and `&` need to be escaped as `<`, `>`; and `&`; when used
1066 /// in .ui files.
1067 /// This widget will be removed in GTK 5
1068 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1069 pub fn accelerator(self, accelerator: impl Into<glib::GString>) -> Self {
1070 Self {
1071 builder: self.builder.property("accelerator", accelerator.into()),
1072 }
1073 }
1074
1075 /// A detailed action name.
1076 ///
1077 /// If this is set for a shortcut of type [`ShortcutType::Accelerator`][crate::ShortcutType::Accelerator],
1078 /// then GTK will use the accelerators that are associated with the
1079 /// action via [`GtkApplicationExt::set_accels_for_action()`][crate::prelude::GtkApplicationExt::set_accels_for_action()], and
1080 /// setting [`accelerator`][struct@crate::ShortcutsShortcut#accelerator] is not necessary.
1081 /// This widget will be removed in GTK 5
1082 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1083 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1084 Self {
1085 builder: self.builder.property("action-name", action_name.into()),
1086 }
1087 }
1088
1089 /// The text direction for which this shortcut is active.
1090 ///
1091 /// If the shortcut is used regardless of the text direction,
1092 /// set this property to [`TextDirection::None`][crate::TextDirection::None].
1093 /// This widget will be removed in GTK 5
1094 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1095 pub fn direction(self, direction: TextDirection) -> Self {
1096 Self {
1097 builder: self.builder.property("direction", direction),
1098 }
1099 }
1100
1101 /// An icon to represent the shortcut or gesture.
1102 ///
1103 /// This property is used if [`shortcut-type`][struct@crate::ShortcutsShortcut#shortcut-type]
1104 /// is set to [`ShortcutType::Gesture`][crate::ShortcutType::Gesture].
1105 ///
1106 /// For the other predefined gesture types, GTK provides an icon on its own.
1107 /// This widget will be removed in GTK 5
1108 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1109 pub fn icon(self, icon: &impl IsA<gio::Icon>) -> Self {
1110 Self {
1111 builder: self.builder.property("icon", icon.clone().upcast()),
1112 }
1113 }
1114
1115 /// [`true`] if an icon has been set.
1116 /// This widget will be removed in GTK 5
1117 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1118 pub fn icon_set(self, icon_set: bool) -> Self {
1119 Self {
1120 builder: self.builder.property("icon-set", icon_set),
1121 }
1122 }
1123
1124 /// The type of shortcut that is represented.
1125 /// This widget will be removed in GTK 5
1126 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1127 pub fn shortcut_type(self, shortcut_type: ShortcutType) -> Self {
1128 Self {
1129 builder: self.builder.property("shortcut-type", shortcut_type),
1130 }
1131 }
1132
1133 /// The subtitle for the shortcut or gesture.
1134 ///
1135 /// This is typically used for gestures and should be a short, one-line
1136 /// text that describes the gesture itself. For the predefined gesture
1137 /// types, GTK provides a subtitle on its own.
1138 /// This widget will be removed in GTK 5
1139 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1140 pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
1141 Self {
1142 builder: self.builder.property("subtitle", subtitle.into()),
1143 }
1144 }
1145
1146 /// [`true`] if a subtitle has been set.
1147 /// This widget will be removed in GTK 5
1148 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1149 pub fn subtitle_set(self, subtitle_set: bool) -> Self {
1150 Self {
1151 builder: self.builder.property("subtitle-set", subtitle_set),
1152 }
1153 }
1154
1155 /// The textual description for the shortcut or gesture represented by
1156 /// this object.
1157 ///
1158 /// This should be a short string that can fit in a single line.
1159 /// This widget will be removed in GTK 5
1160 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1161 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1162 Self {
1163 builder: self.builder.property("title", title.into()),
1164 }
1165 }
1166
1167 /// The size group for the textual portion of this shortcut.
1168 ///
1169 /// This is used internally by GTK, and must not be modified by applications.
1170 /// This widget will be removed in GTK 5
1171 #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1172 pub fn title_size_group(self, title_size_group: &SizeGroup) -> Self {
1173 Self {
1174 builder: self
1175 .builder
1176 .property("title-size-group", title_size_group.clone()),
1177 }
1178 }
1179
1180 /// Whether the widget or any of its descendents can accept
1181 /// the input focus.
1182 ///
1183 /// This property is meant to be set by widget implementations,
1184 /// typically in their instance init function.
1185 pub fn can_focus(self, can_focus: bool) -> Self {
1186 Self {
1187 builder: self.builder.property("can-focus", can_focus),
1188 }
1189 }
1190
1191 /// Whether the widget can receive pointer events.
1192 pub fn can_target(self, can_target: bool) -> Self {
1193 Self {
1194 builder: self.builder.property("can-target", can_target),
1195 }
1196 }
1197
1198 /// A list of css classes applied to this widget.
1199 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1200 Self {
1201 builder: self.builder.property("css-classes", css_classes.into()),
1202 }
1203 }
1204
1205 /// The name of this widget in the CSS tree.
1206 ///
1207 /// This property is meant to be set by widget implementations,
1208 /// typically in their instance init function.
1209 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1210 Self {
1211 builder: self.builder.property("css-name", css_name.into()),
1212 }
1213 }
1214
1215 /// The cursor used by @widget.
1216 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1217 Self {
1218 builder: self.builder.property("cursor", cursor.clone()),
1219 }
1220 }
1221
1222 /// Whether the widget should grab focus when it is clicked with the mouse.
1223 ///
1224 /// This property is only relevant for widgets that can take focus.
1225 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1226 Self {
1227 builder: self.builder.property("focus-on-click", focus_on_click),
1228 }
1229 }
1230
1231 /// Whether this widget itself will accept the input focus.
1232 pub fn focusable(self, focusable: bool) -> Self {
1233 Self {
1234 builder: self.builder.property("focusable", focusable),
1235 }
1236 }
1237
1238 /// How to distribute horizontal space if widget gets extra space.
1239 pub fn halign(self, halign: Align) -> Self {
1240 Self {
1241 builder: self.builder.property("halign", halign),
1242 }
1243 }
1244
1245 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1246 /// signal on @widget.
1247 ///
1248 /// A true value indicates that @widget can have a tooltip, in this case
1249 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1250 /// determine whether it will provide a tooltip or not.
1251 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1252 Self {
1253 builder: self.builder.property("has-tooltip", has_tooltip),
1254 }
1255 }
1256
1257 /// Overrides for height request of the widget.
1258 ///
1259 /// If this is -1, the natural request will be used.
1260 pub fn height_request(self, height_request: i32) -> Self {
1261 Self {
1262 builder: self.builder.property("height-request", height_request),
1263 }
1264 }
1265
1266 /// Whether to expand horizontally.
1267 pub fn hexpand(self, hexpand: bool) -> Self {
1268 Self {
1269 builder: self.builder.property("hexpand", hexpand),
1270 }
1271 }
1272
1273 /// Whether to use the `hexpand` property.
1274 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1275 Self {
1276 builder: self.builder.property("hexpand-set", hexpand_set),
1277 }
1278 }
1279
1280 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1281 /// the preferred size of the widget, and allocate its children.
1282 ///
1283 /// This property is meant to be set by widget implementations,
1284 /// typically in their instance init function.
1285 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1286 Self {
1287 builder: self
1288 .builder
1289 .property("layout-manager", layout_manager.clone().upcast()),
1290 }
1291 }
1292
1293 /// Makes this widget act like a modal dialog, with respect to
1294 /// event delivery.
1295 ///
1296 /// Global event controllers will not handle events with targets
1297 /// inside the widget, unless they are set up to ignore propagation
1298 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1299 #[cfg(feature = "v4_18")]
1300 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1301 pub fn limit_events(self, limit_events: bool) -> Self {
1302 Self {
1303 builder: self.builder.property("limit-events", limit_events),
1304 }
1305 }
1306
1307 /// Margin on bottom side of widget.
1308 ///
1309 /// This property adds margin outside of the widget's normal size
1310 /// request, the margin will be added in addition to the size from
1311 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1312 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1313 Self {
1314 builder: self.builder.property("margin-bottom", margin_bottom),
1315 }
1316 }
1317
1318 /// Margin on end of widget, horizontally.
1319 ///
1320 /// This property supports left-to-right and right-to-left text
1321 /// directions.
1322 ///
1323 /// This property adds margin outside of the widget's normal size
1324 /// request, the margin will be added in addition to the size from
1325 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1326 pub fn margin_end(self, margin_end: i32) -> Self {
1327 Self {
1328 builder: self.builder.property("margin-end", margin_end),
1329 }
1330 }
1331
1332 /// Margin on start of widget, horizontally.
1333 ///
1334 /// This property supports left-to-right and right-to-left text
1335 /// directions.
1336 ///
1337 /// This property adds margin outside of the widget's normal size
1338 /// request, the margin will be added in addition to the size from
1339 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1340 pub fn margin_start(self, margin_start: i32) -> Self {
1341 Self {
1342 builder: self.builder.property("margin-start", margin_start),
1343 }
1344 }
1345
1346 /// Margin on top side of widget.
1347 ///
1348 /// This property adds margin outside of the widget's normal size
1349 /// request, the margin will be added in addition to the size from
1350 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1351 pub fn margin_top(self, margin_top: i32) -> Self {
1352 Self {
1353 builder: self.builder.property("margin-top", margin_top),
1354 }
1355 }
1356
1357 /// The name of the widget.
1358 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1359 Self {
1360 builder: self.builder.property("name", name.into()),
1361 }
1362 }
1363
1364 /// The requested opacity of the widget.
1365 pub fn opacity(self, opacity: f64) -> Self {
1366 Self {
1367 builder: self.builder.property("opacity", opacity),
1368 }
1369 }
1370
1371 /// How content outside the widget's content area is treated.
1372 ///
1373 /// This property is meant to be set by widget implementations,
1374 /// typically in their instance init function.
1375 pub fn overflow(self, overflow: Overflow) -> Self {
1376 Self {
1377 builder: self.builder.property("overflow", overflow),
1378 }
1379 }
1380
1381 /// Whether the widget will receive the default action when it is focused.
1382 pub fn receives_default(self, receives_default: bool) -> Self {
1383 Self {
1384 builder: self.builder.property("receives-default", receives_default),
1385 }
1386 }
1387
1388 /// Whether the widget responds to input.
1389 pub fn sensitive(self, sensitive: bool) -> Self {
1390 Self {
1391 builder: self.builder.property("sensitive", sensitive),
1392 }
1393 }
1394
1395 /// Sets the text of tooltip to be the given string, which is marked up
1396 /// with Pango markup.
1397 ///
1398 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1399 ///
1400 /// This is a convenience property which will take care of getting the
1401 /// tooltip shown if the given string is not `NULL`:
1402 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1403 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1404 /// the default signal handler.
1405 ///
1406 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1407 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1408 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1409 Self {
1410 builder: self
1411 .builder
1412 .property("tooltip-markup", tooltip_markup.into()),
1413 }
1414 }
1415
1416 /// Sets the text of tooltip to be the given string.
1417 ///
1418 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1419 ///
1420 /// This is a convenience property which will take care of getting the
1421 /// tooltip shown if the given string is not `NULL`:
1422 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1423 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1424 /// the default signal handler.
1425 ///
1426 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1427 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1428 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1429 Self {
1430 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1431 }
1432 }
1433
1434 /// How to distribute vertical space if widget gets extra space.
1435 pub fn valign(self, valign: Align) -> Self {
1436 Self {
1437 builder: self.builder.property("valign", valign),
1438 }
1439 }
1440
1441 /// Whether to expand vertically.
1442 pub fn vexpand(self, vexpand: bool) -> Self {
1443 Self {
1444 builder: self.builder.property("vexpand", vexpand),
1445 }
1446 }
1447
1448 /// Whether to use the `vexpand` property.
1449 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1450 Self {
1451 builder: self.builder.property("vexpand-set", vexpand_set),
1452 }
1453 }
1454
1455 /// Whether the widget is visible.
1456 pub fn visible(self, visible: bool) -> Self {
1457 Self {
1458 builder: self.builder.property("visible", visible),
1459 }
1460 }
1461
1462 /// Overrides for width request of the widget.
1463 ///
1464 /// If this is -1, the natural request will be used.
1465 pub fn width_request(self, width_request: i32) -> Self {
1466 Self {
1467 builder: self.builder.property("width-request", width_request),
1468 }
1469 }
1470
1471 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1472 ///
1473 /// The accessible role cannot be changed once set.
1474 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1475 Self {
1476 builder: self.builder.property("accessible-role", accessible_role),
1477 }
1478 }
1479
1480 // rustdoc-stripper-ignore-next
1481 /// Build the [`ShortcutsShortcut`].
1482 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1483 pub fn build(self) -> ShortcutsShortcut {
1484 assert_initialized_main_thread!();
1485 self.builder.build()
1486 }
1487}