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