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,
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 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 /// Writeable
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 | Writeable
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 /// Writeable
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 | Writeable
65 /// <details><summary><h4>Box</h4></summary>
66 ///
67 ///
68 /// #### `baseline-position`
69 /// Readable | Writeable
70 ///
71 ///
72 /// #### `homogeneous`
73 /// Readable | Writeable
74 ///
75 ///
76 /// #### `spacing`
77 /// Readable | Writeable
78 /// </details>
79 /// <details><summary><h4>Container</h4></summary>
80 ///
81 ///
82 /// #### `border-width`
83 /// Readable | Writeable
84 ///
85 ///
86 /// #### `child`
87 /// Writeable
88 ///
89 ///
90 /// #### `resize-mode`
91 /// Readable | Writeable
92 /// </details>
93 /// <details><summary><h4>Widget</h4></summary>
94 ///
95 ///
96 /// #### `app-paintable`
97 /// Readable | Writeable
98 ///
99 ///
100 /// #### `can-default`
101 /// Readable | Writeable
102 ///
103 ///
104 /// #### `can-focus`
105 /// Readable | Writeable
106 ///
107 ///
108 /// #### `composite-child`
109 /// Readable
110 ///
111 ///
112 /// #### `double-buffered`
113 /// Whether the widget is double buffered.
114 ///
115 /// Readable | Writeable
116 ///
117 ///
118 /// #### `events`
119 /// Readable | Writeable
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 | Writeable
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 | Writeable
137 ///
138 ///
139 /// #### `halign`
140 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
141 ///
142 /// Readable | Writeable
143 ///
144 ///
145 /// #### `has-default`
146 /// Readable | Writeable
147 ///
148 ///
149 /// #### `has-focus`
150 /// Readable | Writeable
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 | Writeable
165 ///
166 ///
167 /// #### `height-request`
168 /// Readable | Writeable
169 ///
170 ///
171 /// #### `hexpand`
172 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
173 ///
174 /// Readable | Writeable
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 | Writeable
181 ///
182 ///
183 /// #### `is-focus`
184 /// Readable | Writeable
185 ///
186 ///
187 /// #### `margin`
188 /// Sets all four sides' margin at once. If read, returns max
189 /// margin on any side.
190 ///
191 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
254 ///
255 ///
256 /// #### `name`
257 /// Readable | Writeable
258 ///
259 ///
260 /// #### `no-show-all`
261 /// Readable | Writeable
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 | Writeable
271 ///
272 ///
273 /// #### `parent`
274 /// Readable | Writeable
275 ///
276 ///
277 /// #### `receives-default`
278 /// Readable | Writeable
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 | Writeable
290 ///
291 ///
292 /// #### `style`
293 /// The style of the widget, which contains information about how it will look (colors, etc).
294 ///
295 /// Readable | Writeable
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 | Writeable
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 | Writeable
328 ///
329 ///
330 /// #### `valign`
331 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
332 ///
333 /// Readable | Writeable
334 ///
335 ///
336 /// #### `vexpand`
337 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
338 ///
339 /// Readable | Writeable
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 | Writeable
346 ///
347 ///
348 /// #### `visible`
349 /// Readable | Writeable
350 ///
351 ///
352 /// #### `width-request`
353 /// Readable | Writeable
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 | Writeable
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 let f: &F = &*(f as *const F);
451 f(&from_glib_borrow(this))
452 }
453 unsafe {
454 let f: Box_<F> = Box_::new(f);
455 connect_raw(
456 self.as_ptr() as *mut _,
457 b"notify::accel-size-group\0".as_ptr() as *const _,
458 Some(transmute::<_, unsafe extern "C" fn()>(
459 notify_accel_size_group_trampoline::<F> as *const (),
460 )),
461 Box_::into_raw(f),
462 )
463 }
464 }
465
466 #[doc(alias = "height")]
467 pub fn connect_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
468 unsafe extern "C" fn notify_height_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
469 this: *mut ffi::GtkShortcutsGroup,
470 _param_spec: glib::ffi::gpointer,
471 f: glib::ffi::gpointer,
472 ) {
473 let f: &F = &*(f as *const F);
474 f(&from_glib_borrow(this))
475 }
476 unsafe {
477 let f: Box_<F> = Box_::new(f);
478 connect_raw(
479 self.as_ptr() as *mut _,
480 b"notify::height\0".as_ptr() as *const _,
481 Some(transmute::<_, unsafe extern "C" fn()>(
482 notify_height_trampoline::<F> as *const (),
483 )),
484 Box_::into_raw(f),
485 )
486 }
487 }
488
489 #[doc(alias = "title")]
490 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
491 unsafe extern "C" fn notify_title_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
492 this: *mut ffi::GtkShortcutsGroup,
493 _param_spec: glib::ffi::gpointer,
494 f: glib::ffi::gpointer,
495 ) {
496 let f: &F = &*(f as *const F);
497 f(&from_glib_borrow(this))
498 }
499 unsafe {
500 let f: Box_<F> = Box_::new(f);
501 connect_raw(
502 self.as_ptr() as *mut _,
503 b"notify::title\0".as_ptr() as *const _,
504 Some(transmute::<_, unsafe extern "C" fn()>(
505 notify_title_trampoline::<F> as *const (),
506 )),
507 Box_::into_raw(f),
508 )
509 }
510 }
511
512 #[doc(alias = "title-size-group")]
513 pub fn connect_title_size_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
514 unsafe extern "C" fn notify_title_size_group_trampoline<
515 F: Fn(&ShortcutsGroup) + 'static,
516 >(
517 this: *mut ffi::GtkShortcutsGroup,
518 _param_spec: glib::ffi::gpointer,
519 f: glib::ffi::gpointer,
520 ) {
521 let f: &F = &*(f as *const F);
522 f(&from_glib_borrow(this))
523 }
524 unsafe {
525 let f: Box_<F> = Box_::new(f);
526 connect_raw(
527 self.as_ptr() as *mut _,
528 b"notify::title-size-group\0".as_ptr() as *const _,
529 Some(transmute::<_, unsafe extern "C" fn()>(
530 notify_title_size_group_trampoline::<F> as *const (),
531 )),
532 Box_::into_raw(f),
533 )
534 }
535 }
536
537 #[doc(alias = "view")]
538 pub fn connect_view_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
539 unsafe extern "C" fn notify_view_trampoline<F: Fn(&ShortcutsGroup) + 'static>(
540 this: *mut ffi::GtkShortcutsGroup,
541 _param_spec: glib::ffi::gpointer,
542 f: glib::ffi::gpointer,
543 ) {
544 let f: &F = &*(f as *const F);
545 f(&from_glib_borrow(this))
546 }
547 unsafe {
548 let f: Box_<F> = Box_::new(f);
549 connect_raw(
550 self.as_ptr() as *mut _,
551 b"notify::view\0".as_ptr() as *const _,
552 Some(transmute::<_, unsafe extern "C" fn()>(
553 notify_view_trampoline::<F> as *const (),
554 )),
555 Box_::into_raw(f),
556 )
557 }
558 }
559}
560
561// rustdoc-stripper-ignore-next
562/// A [builder-pattern] type to construct [`ShortcutsGroup`] objects.
563///
564/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
565#[must_use = "The builder must be built to be used"]
566pub struct ShortcutsGroupBuilder {
567 builder: glib::object::ObjectBuilder<'static, ShortcutsGroup>,
568}
569
570impl ShortcutsGroupBuilder {
571 fn new() -> Self {
572 Self {
573 builder: glib::object::Object::builder(),
574 }
575 }
576
577 /// The size group for the accelerator portion of shortcuts in this group.
578 ///
579 /// This is used internally by GTK+, and must not be modified by applications.
580 pub fn accel_size_group(self, accel_size_group: &impl IsA<SizeGroup>) -> Self {
581 Self {
582 builder: self
583 .builder
584 .property("accel-size-group", accel_size_group.clone().upcast()),
585 }
586 }
587
588 /// The title for this group of shortcuts.
589 pub fn title(self, title: impl Into<glib::GString>) -> Self {
590 Self {
591 builder: self.builder.property("title", title.into()),
592 }
593 }
594
595 /// The size group for the textual portion of shortcuts in this group.
596 ///
597 /// This is used internally by GTK+, and must not be modified by applications.
598 pub fn title_size_group(self, title_size_group: &impl IsA<SizeGroup>) -> Self {
599 Self {
600 builder: self
601 .builder
602 .property("title-size-group", title_size_group.clone().upcast()),
603 }
604 }
605
606 /// An optional view that the shortcuts in this group are relevant for.
607 /// The group will be hidden if the [`view-name`][struct@crate::ShortcutsWindow#view-name] property
608 /// does not match the view of this group.
609 ///
610 /// Set this to [`None`] to make the group always visible.
611 pub fn view(self, view: impl Into<glib::GString>) -> Self {
612 Self {
613 builder: self.builder.property("view", view.into()),
614 }
615 }
616
617 pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
618 Self {
619 builder: self
620 .builder
621 .property("baseline-position", baseline_position),
622 }
623 }
624
625 pub fn homogeneous(self, homogeneous: bool) -> Self {
626 Self {
627 builder: self.builder.property("homogeneous", homogeneous),
628 }
629 }
630
631 pub fn spacing(self, spacing: i32) -> Self {
632 Self {
633 builder: self.builder.property("spacing", spacing),
634 }
635 }
636
637 pub fn border_width(self, border_width: u32) -> Self {
638 Self {
639 builder: self.builder.property("border-width", border_width),
640 }
641 }
642
643 pub fn child(self, child: &impl IsA<Widget>) -> Self {
644 Self {
645 builder: self.builder.property("child", child.clone().upcast()),
646 }
647 }
648
649 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
650 Self {
651 builder: self.builder.property("resize-mode", resize_mode),
652 }
653 }
654
655 pub fn app_paintable(self, app_paintable: bool) -> Self {
656 Self {
657 builder: self.builder.property("app-paintable", app_paintable),
658 }
659 }
660
661 pub fn can_default(self, can_default: bool) -> Self {
662 Self {
663 builder: self.builder.property("can-default", can_default),
664 }
665 }
666
667 pub fn can_focus(self, can_focus: bool) -> Self {
668 Self {
669 builder: self.builder.property("can-focus", can_focus),
670 }
671 }
672
673 pub fn events(self, events: gdk::EventMask) -> Self {
674 Self {
675 builder: self.builder.property("events", events),
676 }
677 }
678
679 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
680 pub fn expand(self, expand: bool) -> Self {
681 Self {
682 builder: self.builder.property("expand", expand),
683 }
684 }
685
686 /// Whether the widget should grab focus when it is clicked with the mouse.
687 ///
688 /// This property is only relevant for widgets that can take focus.
689 ///
690 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
691 /// GtkComboBox) implemented this property individually.
692 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
693 Self {
694 builder: self.builder.property("focus-on-click", focus_on_click),
695 }
696 }
697
698 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
699 pub fn halign(self, halign: Align) -> Self {
700 Self {
701 builder: self.builder.property("halign", halign),
702 }
703 }
704
705 pub fn has_default(self, has_default: bool) -> Self {
706 Self {
707 builder: self.builder.property("has-default", has_default),
708 }
709 }
710
711 pub fn has_focus(self, has_focus: bool) -> Self {
712 Self {
713 builder: self.builder.property("has-focus", has_focus),
714 }
715 }
716
717 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
718 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
719 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
720 /// whether it will provide a tooltip or not.
721 ///
722 /// Note that setting this property to [`true`] for the first time will change
723 /// the event masks of the GdkWindows of this widget to include leave-notify
724 /// and motion-notify events. This cannot and will not be undone when the
725 /// property is set to [`false`] again.
726 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
727 Self {
728 builder: self.builder.property("has-tooltip", has_tooltip),
729 }
730 }
731
732 pub fn height_request(self, height_request: i32) -> Self {
733 Self {
734 builder: self.builder.property("height-request", height_request),
735 }
736 }
737
738 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
739 pub fn hexpand(self, hexpand: bool) -> Self {
740 Self {
741 builder: self.builder.property("hexpand", hexpand),
742 }
743 }
744
745 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
746 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
747 Self {
748 builder: self.builder.property("hexpand-set", hexpand_set),
749 }
750 }
751
752 pub fn is_focus(self, is_focus: bool) -> Self {
753 Self {
754 builder: self.builder.property("is-focus", is_focus),
755 }
756 }
757
758 /// Sets all four sides' margin at once. If read, returns max
759 /// margin on any side.
760 pub fn margin(self, margin: i32) -> Self {
761 Self {
762 builder: self.builder.property("margin", margin),
763 }
764 }
765
766 /// Margin on bottom side of widget.
767 ///
768 /// This property adds margin outside of the widget's normal size
769 /// request, the margin will be added in addition to the size from
770 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
771 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
772 Self {
773 builder: self.builder.property("margin-bottom", margin_bottom),
774 }
775 }
776
777 /// Margin on end of widget, horizontally. This property supports
778 /// left-to-right and right-to-left text directions.
779 ///
780 /// This property adds margin outside of the widget's normal size
781 /// request, the margin will be added in addition to the size from
782 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
783 pub fn margin_end(self, margin_end: i32) -> Self {
784 Self {
785 builder: self.builder.property("margin-end", margin_end),
786 }
787 }
788
789 /// Margin on start of widget, horizontally. This property supports
790 /// left-to-right and right-to-left text directions.
791 ///
792 /// This property adds margin outside of the widget's normal size
793 /// request, the margin will be added in addition to the size from
794 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
795 pub fn margin_start(self, margin_start: i32) -> Self {
796 Self {
797 builder: self.builder.property("margin-start", margin_start),
798 }
799 }
800
801 /// Margin on top side of widget.
802 ///
803 /// This property adds margin outside of the widget's normal size
804 /// request, the margin will be added in addition to the size from
805 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
806 pub fn margin_top(self, margin_top: i32) -> Self {
807 Self {
808 builder: self.builder.property("margin-top", margin_top),
809 }
810 }
811
812 pub fn name(self, name: impl Into<glib::GString>) -> Self {
813 Self {
814 builder: self.builder.property("name", name.into()),
815 }
816 }
817
818 pub fn no_show_all(self, no_show_all: bool) -> Self {
819 Self {
820 builder: self.builder.property("no-show-all", no_show_all),
821 }
822 }
823
824 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
825 /// more details about window opacity.
826 ///
827 /// Before 3.8 this was only available in GtkWindow
828 pub fn opacity(self, opacity: f64) -> Self {
829 Self {
830 builder: self.builder.property("opacity", opacity),
831 }
832 }
833
834 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
835 Self {
836 builder: self.builder.property("parent", parent.clone().upcast()),
837 }
838 }
839
840 pub fn receives_default(self, receives_default: bool) -> Self {
841 Self {
842 builder: self.builder.property("receives-default", receives_default),
843 }
844 }
845
846 pub fn sensitive(self, sensitive: bool) -> Self {
847 Self {
848 builder: self.builder.property("sensitive", sensitive),
849 }
850 }
851
852 /// Sets the text of tooltip to be the given string, which is marked up
853 /// with the [Pango text markup language][PangoMarkupFormat].
854 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
855 ///
856 /// This is a convenience property which will take care of getting the
857 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
858 /// will automatically be set to [`true`] and there will be taken care of
859 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
860 ///
861 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
862 /// are set, the last one wins.
863 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
864 Self {
865 builder: self
866 .builder
867 .property("tooltip-markup", tooltip_markup.into()),
868 }
869 }
870
871 /// Sets the text of tooltip to be the given string.
872 ///
873 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
874 ///
875 /// This is a convenience property which will take care of getting the
876 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
877 /// will automatically be set to [`true`] and there will be taken care of
878 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
879 ///
880 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
881 /// are set, the last one wins.
882 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
883 Self {
884 builder: self.builder.property("tooltip-text", tooltip_text.into()),
885 }
886 }
887
888 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
889 pub fn valign(self, valign: Align) -> Self {
890 Self {
891 builder: self.builder.property("valign", valign),
892 }
893 }
894
895 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
896 pub fn vexpand(self, vexpand: bool) -> Self {
897 Self {
898 builder: self.builder.property("vexpand", vexpand),
899 }
900 }
901
902 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
903 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
904 Self {
905 builder: self.builder.property("vexpand-set", vexpand_set),
906 }
907 }
908
909 pub fn visible(self, visible: bool) -> Self {
910 Self {
911 builder: self.builder.property("visible", visible),
912 }
913 }
914
915 pub fn width_request(self, width_request: i32) -> Self {
916 Self {
917 builder: self.builder.property("width-request", width_request),
918 }
919 }
920
921 /// The orientation of the orientable.
922 pub fn orientation(self, orientation: Orientation) -> Self {
923 Self {
924 builder: self.builder.property("orientation", orientation),
925 }
926 }
927
928 // rustdoc-stripper-ignore-next
929 /// Build the [`ShortcutsGroup`].
930 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
931 pub fn build(self) -> ShortcutsGroup {
932 self.builder.build()
933 }
934}
935
936impl fmt::Display for ShortcutsGroup {
937 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
938 f.write_str("ShortcutsGroup")
939 }
940}