Skip to main content

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