gtk/auto/shortcuts_group.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6 Align, BaselinePosition, Box, Buildable, Container, Orientable, Orientation, ResizeMode,
7 SizeGroup, Widget, ffi,
8};
9use glib::{
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 /// A GtkShortcutsGroup represents a group of related keyboard shortcuts
18 /// or gestures. The group has a title. It may optionally be associated with
19 /// a view of the application, which can be used to show only relevant shortcuts
20 /// depending on the application context.
21 ///
22 /// This widget is only meant to be used with [`ShortcutsWindow`][crate::ShortcutsWindow].
23 ///
24 /// ## Properties
25 ///
26 ///
27 /// #### `accel-size-group`
28 /// The size group for the accelerator portion of shortcuts in this group.
29 ///
30 /// This is used internally by GTK+, and must not be modified by applications.
31 ///
32 /// Writable
33 ///
34 ///
35 /// #### `height`
36 /// A rough measure for the number of lines in this group.
37 ///
38 /// This is used internally by GTK+, and is not useful for applications.
39 ///
40 /// Readable
41 ///
42 ///
43 /// #### `title`
44 /// The title for this group of shortcuts.
45 ///
46 /// Readable | Writable
47 ///
48 ///
49 /// #### `title-size-group`
50 /// The size group for the textual portion of shortcuts in this group.
51 ///
52 /// This is used internally by GTK+, and must not be modified by applications.
53 ///
54 /// Writable
55 ///
56 ///
57 /// #### `view`
58 /// An optional view that the shortcuts in this group are relevant for.
59 /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name] property
60 /// does not match the view of this group.
61 ///
62 /// Set this to [`None`] to make the group always visible.
63 ///
64 /// Readable | Writable
65 /// <details><summary><h4>Box</h4></summary>
66 ///
67 ///
68 /// #### `baseline-position`
69 /// Readable | Writable
70 ///
71 ///
72 /// #### `homogeneous`
73 /// Readable | Writable
74 ///
75 ///
76 /// #### `spacing`
77 /// Readable | Writable
78 /// </details>
79 /// <details><summary><h4>Container</h4></summary>
80 ///
81 ///
82 /// #### `border-width`
83 /// Readable | Writable
84 ///
85 ///
86 /// #### `child`
87 /// Writable
88 ///
89 ///
90 /// #### `resize-mode`
91 /// Readable | Writable
92 /// </details>
93 /// <details><summary><h4>Widget</h4></summary>
94 ///
95 ///
96 /// #### `app-paintable`
97 /// Readable | Writable
98 ///
99 ///
100 /// #### `can-default`
101 /// Readable | Writable
102 ///
103 ///
104 /// #### `can-focus`
105 /// Readable | Writable
106 ///
107 ///
108 /// #### `composite-child`
109 /// Readable
110 ///
111 ///
112 /// #### `double-buffered`
113 /// Whether the widget is double buffered.
114 ///
115 /// Readable | Writable
116 ///
117 ///
118 /// #### `events`
119 /// Readable | Writable
120 ///
121 ///
122 /// #### `expand`
123 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
124 ///
125 /// Readable | Writable
126 ///
127 ///
128 /// #### `focus-on-click`
129 /// Whether the widget should grab focus when it is clicked with the mouse.
130 ///
131 /// This property is only relevant for widgets that can take focus.
132 ///
133 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
134 /// GtkComboBox) implemented this property individually.
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `halign`
140 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `has-default`
146 /// Readable | Writable
147 ///
148 ///
149 /// #### `has-focus`
150 /// Readable | Writable
151 ///
152 ///
153 /// #### `has-tooltip`
154 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
155 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
156 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
157 /// whether it will provide a tooltip or not.
158 ///
159 /// Note that setting this property to [`true`] for the first time will change
160 /// the event masks of the GdkWindows of this widget to include leave-notify
161 /// and motion-notify events. This cannot and will not be undone when the
162 /// property is set to [`false`] again.
163 ///
164 /// Readable | Writable
165 ///
166 ///
167 /// #### `height-request`
168 /// Readable | Writable
169 ///
170 ///
171 /// #### `hexpand`
172 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
173 ///
174 /// Readable | Writable
175 ///
176 ///
177 /// #### `hexpand-set`
178 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
179 ///
180 /// Readable | Writable
181 ///
182 ///
183 /// #### `is-focus`
184 /// Readable | Writable
185 ///
186 ///
187 /// #### `margin`
188 /// Sets all four sides' margin at once. If read, returns max
189 /// margin on any side.
190 ///
191 /// Readable | Writable
192 ///
193 ///
194 /// #### `margin-bottom`
195 /// Margin on bottom side of widget.
196 ///
197 /// This property adds margin outside of the widget's normal size
198 /// request, the margin will be added in addition to the size from
199 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
200 ///
201 /// Readable | Writable
202 ///
203 ///
204 /// #### `margin-end`
205 /// Margin on end of widget, horizontally. This property supports
206 /// left-to-right and right-to-left text directions.
207 ///
208 /// This property adds margin outside of the widget's normal size
209 /// request, the margin will be added in addition to the size from
210 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
211 ///
212 /// Readable | Writable
213 ///
214 ///
215 /// #### `margin-left`
216 /// Margin on left side of widget.
217 ///
218 /// This property adds margin outside of the widget's normal size
219 /// request, the margin will be added in addition to the size from
220 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
221 ///
222 /// Readable | Writable
223 ///
224 ///
225 /// #### `margin-right`
226 /// Margin on right side of widget.
227 ///
228 /// This property adds margin outside of the widget's normal size
229 /// request, the margin will be added in addition to the size from
230 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
231 ///
232 /// Readable | Writable
233 ///
234 ///
235 /// #### `margin-start`
236 /// Margin on start of widget, horizontally. This property supports
237 /// left-to-right and right-to-left text directions.
238 ///
239 /// This property adds margin outside of the widget's normal size
240 /// request, the margin will be added in addition to the size from
241 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
242 ///
243 /// Readable | Writable
244 ///
245 ///
246 /// #### `margin-top`
247 /// Margin on top side of widget.
248 ///
249 /// This property adds margin outside of the widget's normal size
250 /// request, the margin will be added in addition to the size from
251 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
252 ///
253 /// Readable | Writable
254 ///
255 ///
256 /// #### `name`
257 /// Readable | Writable
258 ///
259 ///
260 /// #### `no-show-all`
261 /// Readable | Writable
262 ///
263 ///
264 /// #### `opacity`
265 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
266 /// more details about window opacity.
267 ///
268 /// Before 3.8 this was only available in GtkWindow
269 ///
270 /// Readable | Writable
271 ///
272 ///
273 /// #### `parent`
274 /// Readable | Writable
275 ///
276 ///
277 /// #### `receives-default`
278 /// Readable | Writable
279 ///
280 ///
281 /// #### `scale-factor`
282 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
283 /// more details about widget scaling.
284 ///
285 /// Readable
286 ///
287 ///
288 /// #### `sensitive`
289 /// Readable | Writable
290 ///
291 ///
292 /// #### `style`
293 /// The style of the widget, which contains information about how it will look (colors, etc).
294 ///
295 /// Readable | Writable
296 ///
297 ///
298 /// #### `tooltip-markup`
299 /// Sets the text of tooltip to be the given string, which is marked up
300 /// with the [Pango text markup language][PangoMarkupFormat].
301 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
302 ///
303 /// This is a convenience property which will take care of getting the
304 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
305 /// will automatically be set to [`true`] and there will be taken care of
306 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
307 ///
308 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
309 /// are set, the last one wins.
310 ///
311 /// Readable | Writable
312 ///
313 ///
314 /// #### `tooltip-text`
315 /// Sets the text of tooltip to be the given string.
316 ///
317 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
318 ///
319 /// This is a convenience property which will take care of getting the
320 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
321 /// will automatically be set to [`true`] and there will be taken care of
322 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
323 ///
324 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
325 /// are set, the last one wins.
326 ///
327 /// Readable | Writable
328 ///
329 ///
330 /// #### `valign`
331 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
332 ///
333 /// Readable | Writable
334 ///
335 ///
336 /// #### `vexpand`
337 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
338 ///
339 /// Readable | Writable
340 ///
341 ///
342 /// #### `vexpand-set`
343 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
344 ///
345 /// Readable | Writable
346 ///
347 ///
348 /// #### `visible`
349 /// Readable | Writable
350 ///
351 ///
352 /// #### `width-request`
353 /// Readable | Writable
354 ///
355 ///
356 /// #### `window`
357 /// The widget's window if it is realized, [`None`] otherwise.
358 ///
359 /// Readable
360 /// </details>
361 /// <details><summary><h4>Orientable</h4></summary>
362 ///
363 ///
364 /// #### `orientation`
365 /// The orientation of the orientable.
366 ///
367 /// Readable | Writable
368 /// </details>
369 ///
370 /// # Implements
371 ///
372 /// [`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]
373 #[doc(alias = "GtkShortcutsGroup")]
374 pub struct ShortcutsGroup(Object<ffi::GtkShortcutsGroup, ffi::GtkShortcutsGroupClass>) @extends Box, Container, Widget, @implements Buildable, Orientable;
375
376 match fn {
377 type_ => || ffi::gtk_shortcuts_group_get_type(),
378 }
379}
380
381impl ShortcutsGroup {
382 // rustdoc-stripper-ignore-next
383 /// Creates a new builder-pattern struct instance to construct [`ShortcutsGroup`] objects.
384 ///
385 /// This method returns an instance of [`ShortcutsGroupBuilder`](crate::builders::ShortcutsGroupBuilder) which can be used to create [`ShortcutsGroup`] objects.
386 pub fn builder() -> ShortcutsGroupBuilder {
387 ShortcutsGroupBuilder::new()
388 }
389
390 /// The size group for the accelerator portion of shortcuts in this group.
391 ///
392 /// This is used internally by GTK+, and must not be modified by applications.
393 #[doc(alias = "accel-size-group")]
394 pub fn set_accel_size_group<P: IsA<SizeGroup>>(&self, accel_size_group: Option<&P>) {
395 ObjectExt::set_property(self, "accel-size-group", accel_size_group)
396 }
397
398 /// A rough measure for the number of lines in this group.
399 ///
400 /// This is used internally by GTK+, and is not useful for applications.
401 pub fn height(&self) -> u32 {
402 ObjectExt::property(self, "height")
403 }
404
405 /// The title for this group of shortcuts.
406 pub fn title(&self) -> Option<glib::GString> {
407 ObjectExt::property(self, "title")
408 }
409
410 /// The title for this group of shortcuts.
411 pub fn set_title(&self, title: Option<&str>) {
412 ObjectExt::set_property(self, "title", title)
413 }
414
415 /// The size group for the textual portion of shortcuts in this group.
416 ///
417 /// This is used internally by GTK+, and must not be modified by applications.
418 #[doc(alias = "title-size-group")]
419 pub fn set_title_size_group<P: IsA<SizeGroup>>(&self, title_size_group: Option<&P>) {
420 ObjectExt::set_property(self, "title-size-group", title_size_group)
421 }
422
423 /// An optional view that the shortcuts in this group are relevant for.
424 /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name] property
425 /// does not match the view of this group.
426 ///
427 /// Set this to [`None`] to make the group always visible.
428 pub fn view(&self) -> Option<glib::GString> {
429 ObjectExt::property(self, "view")
430 }
431
432 /// An optional view that the shortcuts in this group are relevant for.
433 /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name] property
434 /// does not match the view of this group.
435 ///
436 /// Set this to [`None`] to make the group always visible.
437 pub fn set_view(&self, view: Option<&str>) {
438 ObjectExt::set_property(self, "view", view)
439 }
440
441 #[doc(alias = "accel-size-group")]
442 pub fn connect_accel_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
443 unsafe extern "C" fn notify_accel_size_group_trampoline<
444 F: Fn(&ShortcutsGroup) + 'static,
445 >(
446 this: *mut ffi::GtkShortcutsGroup,
447 _param_spec: glib::ffi::gpointer,
448 f: glib::ffi::gpointer,
449 ) {
450 unsafe {
451 let f: &F = &*(f as *const F);
452 f(&from_glib_borrow(this))
453 }
454 }
455 unsafe {
456 let f: Box_<F> = Box_::new(f);
457 connect_raw(
458 self.as_ptr() as *mut _,
459 c"notify::accel-size-group".as_ptr(),
460 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
461 notify_accel_size_group_trampoline::<F> as *const (),
462 )),
463 Box_::into_raw(f),
464 )
465 }
466 }
467
468 #[doc(alias = "height")]
469 pub fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
470 unsafe extern "C" fn notify_height_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
471 this: *mut ffi::GtkShortcutsGroup,
472 _param_spec: glib::ffi::gpointer,
473 f: glib::ffi::gpointer,
474 ) {
475 unsafe {
476 let f: &F = &*(f as *const F);
477 f(&from_glib_borrow(this))
478 }
479 }
480 unsafe {
481 let f: Box_<F> = Box_::new(f);
482 connect_raw(
483 self.as_ptr() as *mut _,
484 c"notify::height".as_ptr(),
485 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
486 notify_height_trampoline::<F> as *const (),
487 )),
488 Box_::into_raw(f),
489 )
490 }
491 }
492
493 #[doc(alias = "title")]
494 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
495 unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
496 this: *mut ffi::GtkShortcutsGroup,
497 _param_spec: glib::ffi::gpointer,
498 f: glib::ffi::gpointer,
499 ) {
500 unsafe {
501 let f: &F = &*(f as *const F);
502 f(&from_glib_borrow(this))
503 }
504 }
505 unsafe {
506 let f: Box_<F> = Box_::new(f);
507 connect_raw(
508 self.as_ptr() as *mut _,
509 c"notify::title".as_ptr(),
510 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
511 notify_title_trampoline::<F> as *const (),
512 )),
513 Box_::into_raw(f),
514 )
515 }
516 }
517
518 #[doc(alias = "title-size-group")]
519 pub fn connect_title_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
520 unsafe extern "C" fn notify_title_size_group_trampoline<
521 F: Fn(&ShortcutsGroup) + 'static,
522 >(
523 this: *mut ffi::GtkShortcutsGroup,
524 _param_spec: glib::ffi::gpointer,
525 f: glib::ffi::gpointer,
526 ) {
527 unsafe {
528 let f: &F = &*(f as *const F);
529 f(&from_glib_borrow(this))
530 }
531 }
532 unsafe {
533 let f: Box_<F> = Box_::new(f);
534 connect_raw(
535 self.as_ptr() as *mut _,
536 c"notify::title-size-group".as_ptr(),
537 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
538 notify_title_size_group_trampoline::<F> as *const (),
539 )),
540 Box_::into_raw(f),
541 )
542 }
543 }
544
545 #[doc(alias = "view")]
546 pub fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
547 unsafe extern "C" fn notify_view_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
548 this: *mut ffi::GtkShortcutsGroup,
549 _param_spec: glib::ffi::gpointer,
550 f: glib::ffi::gpointer,
551 ) {
552 unsafe {
553 let f: &F = &*(f as *const F);
554 f(&from_glib_borrow(this))
555 }
556 }
557 unsafe {
558 let f: Box_<F> = Box_::new(f);
559 connect_raw(
560 self.as_ptr() as *mut _,
561 c"notify::view".as_ptr(),
562 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
563 notify_view_trampoline::<F> as *const (),
564 )),
565 Box_::into_raw(f),
566 )
567 }
568 }
569}
570
571// rustdoc-stripper-ignore-next
572/// A [builder-pattern] type to construct [`ShortcutsGroup`] objects.
573///
574/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
575#[must_use = "The builder must be built to be used"]
576pub struct ShortcutsGroupBuilder {
577 builder: glib::object::ObjectBuilder<'static, ShortcutsGroup>,
578}
579
580impl ShortcutsGroupBuilder {
581 fn new() -> Self {
582 Self {
583 builder: glib::object::Object::builder(),
584 }
585 }
586
587 /// The size group for the accelerator portion of shortcuts in this group.
588 ///
589 /// This is used internally by GTK+, and must not be modified by applications.
590 pub fn accel_size_group(self, accel_size_group: &impl IsA<SizeGroup>) -> Self {
591 Self {
592 builder: self
593 .builder
594 .property("accel-size-group", accel_size_group.clone().upcast()),
595 }
596 }
597
598 /// The title for this group of shortcuts.
599 pub fn title(self, title: impl Into<glib::GString>) -> Self {
600 Self {
601 builder: self.builder.property("title", title.into()),
602 }
603 }
604
605 /// The size group for the textual portion of shortcuts in this group.
606 ///
607 /// This is used internally by GTK+, and must not be modified by applications.
608 pub fn title_size_group(self, title_size_group: &impl IsA<SizeGroup>) -> Self {
609 Self {
610 builder: self
611 .builder
612 .property("title-size-group", title_size_group.clone().upcast()),
613 }
614 }
615
616 /// An optional view that the shortcuts in this group are relevant for.
617 /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name] property
618 /// does not match the view of this group.
619 ///
620 /// Set this to [`None`] to make the group always visible.
621 pub fn view(self, view: impl Into<glib::GString>) -> Self {
622 Self {
623 builder: self.builder.property("view", view.into()),
624 }
625 }
626
627 pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
628 Self {
629 builder: self
630 .builder
631 .property("baseline-position", baseline_position),
632 }
633 }
634
635 pub fn homogeneous(self, homogeneous: bool) -> Self {
636 Self {
637 builder: self.builder.property("homogeneous", homogeneous),
638 }
639 }
640
641 pub fn spacing(self, spacing: i32) -> Self {
642 Self {
643 builder: self.builder.property("spacing", spacing),
644 }
645 }
646
647 pub fn border_width(self, border_width: u32) -> Self {
648 Self {
649 builder: self.builder.property("border-width", border_width),
650 }
651 }
652
653 pub fn child(self, child: &impl IsA<Widget>) -> Self {
654 Self {
655 builder: self.builder.property("child", child.clone().upcast()),
656 }
657 }
658
659 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
660 Self {
661 builder: self.builder.property("resize-mode", resize_mode),
662 }
663 }
664
665 pub fn app_paintable(self, app_paintable: bool) -> Self {
666 Self {
667 builder: self.builder.property("app-paintable", app_paintable),
668 }
669 }
670
671 pub fn can_default(self, can_default: bool) -> Self {
672 Self {
673 builder: self.builder.property("can-default", can_default),
674 }
675 }
676
677 pub fn can_focus(self, can_focus: bool) -> Self {
678 Self {
679 builder: self.builder.property("can-focus", can_focus),
680 }
681 }
682
683 pub fn events(self, events: gdk::EventMask) -> Self {
684 Self {
685 builder: self.builder.property("events", events),
686 }
687 }
688
689 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
690 pub fn expand(self, expand: bool) -> Self {
691 Self {
692 builder: self.builder.property("expand", expand),
693 }
694 }
695
696 /// Whether the widget should grab focus when it is clicked with the mouse.
697 ///
698 /// This property is only relevant for widgets that can take focus.
699 ///
700 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
701 /// GtkComboBox) implemented this property individually.
702 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
703 Self {
704 builder: self.builder.property("focus-on-click", focus_on_click),
705 }
706 }
707
708 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
709 pub fn halign(self, halign: Align) -> Self {
710 Self {
711 builder: self.builder.property("halign", halign),
712 }
713 }
714
715 pub fn has_default(self, has_default: bool) -> Self {
716 Self {
717 builder: self.builder.property("has-default", has_default),
718 }
719 }
720
721 pub fn has_focus(self, has_focus: bool) -> Self {
722 Self {
723 builder: self.builder.property("has-focus", has_focus),
724 }
725 }
726
727 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
728 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
729 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
730 /// whether it will provide a tooltip or not.
731 ///
732 /// Note that setting this property to [`true`] for the first time will change
733 /// the event masks of the GdkWindows of this widget to include leave-notify
734 /// and motion-notify events. This cannot and will not be undone when the
735 /// property is set to [`false`] again.
736 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
737 Self {
738 builder: self.builder.property("has-tooltip", has_tooltip),
739 }
740 }
741
742 pub fn height_request(self, height_request: i32) -> Self {
743 Self {
744 builder: self.builder.property("height-request", height_request),
745 }
746 }
747
748 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
749 pub fn hexpand(self, hexpand: bool) -> Self {
750 Self {
751 builder: self.builder.property("hexpand", hexpand),
752 }
753 }
754
755 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
756 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
757 Self {
758 builder: self.builder.property("hexpand-set", hexpand_set),
759 }
760 }
761
762 pub fn is_focus(self, is_focus: bool) -> Self {
763 Self {
764 builder: self.builder.property("is-focus", is_focus),
765 }
766 }
767
768 /// Sets all four sides' margin at once. If read, returns max
769 /// margin on any side.
770 pub fn margin(self, margin: i32) -> Self {
771 Self {
772 builder: self.builder.property("margin", margin),
773 }
774 }
775
776 /// Margin on bottom side of widget.
777 ///
778 /// This property adds margin outside of the widget's normal size
779 /// request, the margin will be added in addition to the size from
780 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
781 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
782 Self {
783 builder: self.builder.property("margin-bottom", margin_bottom),
784 }
785 }
786
787 /// Margin on end of widget, horizontally. This property supports
788 /// left-to-right and right-to-left text directions.
789 ///
790 /// This property adds margin outside of the widget's normal size
791 /// request, the margin will be added in addition to the size from
792 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
793 pub fn margin_end(self, margin_end: i32) -> Self {
794 Self {
795 builder: self.builder.property("margin-end", margin_end),
796 }
797 }
798
799 /// Margin on start of widget, horizontally. This property supports
800 /// left-to-right and right-to-left text directions.
801 ///
802 /// This property adds margin outside of the widget's normal size
803 /// request, the margin will be added in addition to the size from
804 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
805 pub fn margin_start(self, margin_start: i32) -> Self {
806 Self {
807 builder: self.builder.property("margin-start", margin_start),
808 }
809 }
810
811 /// Margin on top side of widget.
812 ///
813 /// This property adds margin outside of the widget's normal size
814 /// request, the margin will be added in addition to the size from
815 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
816 pub fn margin_top(self, margin_top: i32) -> Self {
817 Self {
818 builder: self.builder.property("margin-top", margin_top),
819 }
820 }
821
822 pub fn name(self, name: impl Into<glib::GString>) -> Self {
823 Self {
824 builder: self.builder.property("name", name.into()),
825 }
826 }
827
828 pub fn no_show_all(self, no_show_all: bool) -> Self {
829 Self {
830 builder: self.builder.property("no-show-all", no_show_all),
831 }
832 }
833
834 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
835 /// more details about window opacity.
836 ///
837 /// Before 3.8 this was only available in GtkWindow
838 pub fn opacity(self, opacity: f64) -> Self {
839 Self {
840 builder: self.builder.property("opacity", opacity),
841 }
842 }
843
844 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
845 Self {
846 builder: self.builder.property("parent", parent.clone().upcast()),
847 }
848 }
849
850 pub fn receives_default(self, receives_default: bool) -> Self {
851 Self {
852 builder: self.builder.property("receives-default", receives_default),
853 }
854 }
855
856 pub fn sensitive(self, sensitive: bool) -> Self {
857 Self {
858 builder: self.builder.property("sensitive", sensitive),
859 }
860 }
861
862 /// Sets the text of tooltip to be the given string, which is marked up
863 /// with the [Pango text markup language][PangoMarkupFormat].
864 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
865 ///
866 /// This is a convenience property which will take care of getting the
867 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
868 /// will automatically be set to [`true`] and there will be taken care of
869 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
870 ///
871 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
872 /// are set, the last one wins.
873 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
874 Self {
875 builder: self
876 .builder
877 .property("tooltip-markup", tooltip_markup.into()),
878 }
879 }
880
881 /// Sets the text of tooltip to be the given string.
882 ///
883 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
884 ///
885 /// This is a convenience property which will take care of getting the
886 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
887 /// will automatically be set to [`true`] and there will be taken care of
888 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
889 ///
890 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
891 /// are set, the last one wins.
892 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
893 Self {
894 builder: self.builder.property("tooltip-text", tooltip_text.into()),
895 }
896 }
897
898 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
899 pub fn valign(self, valign: Align) -> Self {
900 Self {
901 builder: self.builder.property("valign", valign),
902 }
903 }
904
905 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
906 pub fn vexpand(self, vexpand: bool) -> Self {
907 Self {
908 builder: self.builder.property("vexpand", vexpand),
909 }
910 }
911
912 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
913 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
914 Self {
915 builder: self.builder.property("vexpand-set", vexpand_set),
916 }
917 }
918
919 pub fn visible(self, visible: bool) -> Self {
920 Self {
921 builder: self.builder.property("visible", visible),
922 }
923 }
924
925 pub fn width_request(self, width_request: i32) -> Self {
926 Self {
927 builder: self.builder.property("width-request", width_request),
928 }
929 }
930
931 /// The orientation of the orientable.
932 pub fn orientation(self, orientation: Orientation) -> Self {
933 Self {
934 builder: self.builder.property("orientation", orientation),
935 }
936 }
937
938 // rustdoc-stripper-ignore-next
939 /// Build the [`ShortcutsGroup`].
940 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
941 pub fn build(self) -> ShortcutsGroup {
942 assert_initialized_main_thread!();
943 self.builder.build()
944 }
945}