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