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,
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    /// 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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
152    ///
153    ///
154    /// #### `text`
155    ///  The label for the button.
156    ///
157    /// Readable | Writeable
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 | Writeable
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 | Writeable | Construct
177    ///
178    ///
179    /// #### `image`
180    ///  The child widget to appear next to the button text.
181    ///
182    /// Readable | Writeable
183    ///
184    ///
185    /// #### `image-position`
186    ///  The position of the image relative to the text inside the button.
187    ///
188    /// Readable | Writeable
189    ///
190    ///
191    /// #### `label`
192    ///  Readable | Writeable | Construct
193    ///
194    ///
195    /// #### `relief`
196    ///  Readable | Writeable
197    ///
198    ///
199    /// #### `use-stock`
200    ///  Readable | Writeable | Construct
201    ///
202    ///
203    /// #### `use-underline`
204    ///  Readable | Writeable | 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 | Writeable
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 | Writeable
221    /// </details>
222    /// <details><summary><h4>Container</h4></summary>
223    ///
224    ///
225    /// #### `border-width`
226    ///  Readable | Writeable
227    ///
228    ///
229    /// #### `child`
230    ///  Writeable
231    ///
232    ///
233    /// #### `resize-mode`
234    ///  Readable | Writeable
235    /// </details>
236    /// <details><summary><h4>Widget</h4></summary>
237    ///
238    ///
239    /// #### `app-paintable`
240    ///  Readable | Writeable
241    ///
242    ///
243    /// #### `can-default`
244    ///  Readable | Writeable
245    ///
246    ///
247    /// #### `can-focus`
248    ///  Readable | Writeable
249    ///
250    ///
251    /// #### `composite-child`
252    ///  Readable
253    ///
254    ///
255    /// #### `double-buffered`
256    ///  Whether the widget is double buffered.
257    ///
258    /// Readable | Writeable
259    ///
260    ///
261    /// #### `events`
262    ///  Readable | Writeable
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 | Writeable
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 | Writeable
280    ///
281    ///
282    /// #### `halign`
283    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
284    ///
285    /// Readable | Writeable
286    ///
287    ///
288    /// #### `has-default`
289    ///  Readable | Writeable
290    ///
291    ///
292    /// #### `has-focus`
293    ///  Readable | Writeable
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 | Writeable
308    ///
309    ///
310    /// #### `height-request`
311    ///  Readable | Writeable
312    ///
313    ///
314    /// #### `hexpand`
315    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
316    ///
317    /// Readable | Writeable
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 | Writeable
324    ///
325    ///
326    /// #### `is-focus`
327    ///  Readable | Writeable
328    ///
329    ///
330    /// #### `margin`
331    ///  Sets all four sides' margin at once. If read, returns max
332    /// margin on any side.
333    ///
334    /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
397    ///
398    ///
399    /// #### `name`
400    ///  Readable | Writeable
401    ///
402    ///
403    /// #### `no-show-all`
404    ///  Readable | Writeable
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 | Writeable
414    ///
415    ///
416    /// #### `parent`
417    ///  Readable | Writeable
418    ///
419    ///
420    /// #### `receives-default`
421    ///  Readable | Writeable
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 | Writeable
433    ///
434    ///
435    /// #### `style`
436    ///  The style of the widget, which contains information about how it will look (colors, etc).
437    ///
438    /// Readable | Writeable
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 | Writeable
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 | Writeable
471    ///
472    ///
473    /// #### `valign`
474    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
475    ///
476    /// Readable | Writeable
477    ///
478    ///
479    /// #### `vexpand`
480    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
481    ///
482    /// Readable | Writeable
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 | Writeable
489    ///
490    ///
491    /// #### `visible`
492    ///  Readable | Writeable
493    ///
494    ///
495    /// #### `width-request`
496    ///  Readable | Writeable
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 | Writeable
509    ///
510    ///
511    /// #### `action-target`
512    ///  Readable | Writeable
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 | Writeable
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 | Writeable
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            let f: &F = &*(f as *const F);
703            f(&from_glib_borrow(this))
704        }
705        unsafe {
706            let f: Box_<F> = Box_::new(f);
707            connect_raw(
708                self.as_ptr() as *mut _,
709                b"notify::active\0".as_ptr() as *const _,
710                Some(transmute::<_, unsafe extern "C" fn()>(
711                    notify_active_trampoline::<F> as *const (),
712                )),
713                Box_::into_raw(f),
714            )
715        }
716    }
717
718    #[doc(alias = "centered")]
719    pub fn connect_centered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
720        unsafe extern "C" fn notify_centered_trampoline<F: Fn(&ModelButton) + 'static>(
721            this: *mut ffi::GtkModelButton,
722            _param_spec: glib::ffi::gpointer,
723            f: glib::ffi::gpointer,
724        ) {
725            let f: &F = &*(f as *const F);
726            f(&from_glib_borrow(this))
727        }
728        unsafe {
729            let f: Box_<F> = Box_::new(f);
730            connect_raw(
731                self.as_ptr() as *mut _,
732                b"notify::centered\0".as_ptr() as *const _,
733                Some(transmute::<_, unsafe extern "C" fn()>(
734                    notify_centered_trampoline::<F> as *const (),
735                )),
736                Box_::into_raw(f),
737            )
738        }
739    }
740
741    #[doc(alias = "icon")]
742    pub fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
743        unsafe extern "C" fn notify_icon_trampoline<F: Fn(&ModelButton) + 'static>(
744            this: *mut ffi::GtkModelButton,
745            _param_spec: glib::ffi::gpointer,
746            f: glib::ffi::gpointer,
747        ) {
748            let f: &F = &*(f as *const F);
749            f(&from_glib_borrow(this))
750        }
751        unsafe {
752            let f: Box_<F> = Box_::new(f);
753            connect_raw(
754                self.as_ptr() as *mut _,
755                b"notify::icon\0".as_ptr() as *const _,
756                Some(transmute::<_, unsafe extern "C" fn()>(
757                    notify_icon_trampoline::<F> as *const (),
758                )),
759                Box_::into_raw(f),
760            )
761        }
762    }
763
764    #[doc(alias = "iconic")]
765    pub fn connect_iconic_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
766        unsafe extern "C" fn notify_iconic_trampoline<F: Fn(&ModelButton) + 'static>(
767            this: *mut ffi::GtkModelButton,
768            _param_spec: glib::ffi::gpointer,
769            f: glib::ffi::gpointer,
770        ) {
771            let f: &F = &*(f as *const F);
772            f(&from_glib_borrow(this))
773        }
774        unsafe {
775            let f: Box_<F> = Box_::new(f);
776            connect_raw(
777                self.as_ptr() as *mut _,
778                b"notify::iconic\0".as_ptr() as *const _,
779                Some(transmute::<_, unsafe extern "C" fn()>(
780                    notify_iconic_trampoline::<F> as *const (),
781                )),
782                Box_::into_raw(f),
783            )
784        }
785    }
786
787    #[doc(alias = "inverted")]
788    pub fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
789        unsafe extern "C" fn notify_inverted_trampoline<F: Fn(&ModelButton) + 'static>(
790            this: *mut ffi::GtkModelButton,
791            _param_spec: glib::ffi::gpointer,
792            f: glib::ffi::gpointer,
793        ) {
794            let f: &F = &*(f as *const F);
795            f(&from_glib_borrow(this))
796        }
797        unsafe {
798            let f: Box_<F> = Box_::new(f);
799            connect_raw(
800                self.as_ptr() as *mut _,
801                b"notify::inverted\0".as_ptr() as *const _,
802                Some(transmute::<_, unsafe extern "C" fn()>(
803                    notify_inverted_trampoline::<F> as *const (),
804                )),
805                Box_::into_raw(f),
806            )
807        }
808    }
809
810    #[doc(alias = "menu-name")]
811    pub fn connect_menu_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
812        unsafe extern "C" fn notify_menu_name_trampoline<F: Fn(&ModelButton) + 'static>(
813            this: *mut ffi::GtkModelButton,
814            _param_spec: glib::ffi::gpointer,
815            f: glib::ffi::gpointer,
816        ) {
817            let f: &F = &*(f as *const F);
818            f(&from_glib_borrow(this))
819        }
820        unsafe {
821            let f: Box_<F> = Box_::new(f);
822            connect_raw(
823                self.as_ptr() as *mut _,
824                b"notify::menu-name\0".as_ptr() as *const _,
825                Some(transmute::<_, unsafe extern "C" fn()>(
826                    notify_menu_name_trampoline::<F> as *const (),
827                )),
828                Box_::into_raw(f),
829            )
830        }
831    }
832
833    #[doc(alias = "role")]
834    pub fn connect_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
835        unsafe extern "C" fn notify_role_trampoline<F: Fn(&ModelButton) + 'static>(
836            this: *mut ffi::GtkModelButton,
837            _param_spec: glib::ffi::gpointer,
838            f: glib::ffi::gpointer,
839        ) {
840            let f: &F = &*(f as *const F);
841            f(&from_glib_borrow(this))
842        }
843        unsafe {
844            let f: Box_<F> = Box_::new(f);
845            connect_raw(
846                self.as_ptr() as *mut _,
847                b"notify::role\0".as_ptr() as *const _,
848                Some(transmute::<_, unsafe extern "C" fn()>(
849                    notify_role_trampoline::<F> as *const (),
850                )),
851                Box_::into_raw(f),
852            )
853        }
854    }
855
856    #[doc(alias = "text")]
857    pub fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
858        unsafe extern "C" fn notify_text_trampoline<F: Fn(&ModelButton) + 'static>(
859            this: *mut ffi::GtkModelButton,
860            _param_spec: glib::ffi::gpointer,
861            f: glib::ffi::gpointer,
862        ) {
863            let f: &F = &*(f as *const F);
864            f(&from_glib_borrow(this))
865        }
866        unsafe {
867            let f: Box_<F> = Box_::new(f);
868            connect_raw(
869                self.as_ptr() as *mut _,
870                b"notify::text\0".as_ptr() as *const _,
871                Some(transmute::<_, unsafe extern "C" fn()>(
872                    notify_text_trampoline::<F> as *const (),
873                )),
874                Box_::into_raw(f),
875            )
876        }
877    }
878
879    #[cfg(feature = "v3_24")]
880    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
881    #[doc(alias = "use-markup")]
882    pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
883        unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&ModelButton) + 'static>(
884            this: *mut ffi::GtkModelButton,
885            _param_spec: glib::ffi::gpointer,
886            f: glib::ffi::gpointer,
887        ) {
888            let f: &F = &*(f as *const F);
889            f(&from_glib_borrow(this))
890        }
891        unsafe {
892            let f: Box_<F> = Box_::new(f);
893            connect_raw(
894                self.as_ptr() as *mut _,
895                b"notify::use-markup\0".as_ptr() as *const _,
896                Some(transmute::<_, unsafe extern "C" fn()>(
897                    notify_use_markup_trampoline::<F> as *const (),
898                )),
899                Box_::into_raw(f),
900            )
901        }
902    }
903}
904
905impl Default for ModelButton {
906    fn default() -> Self {
907        Self::new()
908    }
909}
910
911// rustdoc-stripper-ignore-next
912/// A [builder-pattern] type to construct [`ModelButton`] objects.
913///
914/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
915#[must_use = "The builder must be built to be used"]
916pub struct ModelButtonBuilder {
917    builder: glib::object::ObjectBuilder<'static, ModelButton>,
918}
919
920impl ModelButtonBuilder {
921    fn new() -> Self {
922        Self {
923            builder: glib::object::Object::builder(),
924        }
925    }
926
927    /// The state of the button. This is reflecting the state of the associated
928    /// `GAction`.
929    pub fn active(self, active: bool) -> Self {
930        Self {
931            builder: self.builder.property("active", active),
932        }
933    }
934
935    /// Whether to render the button contents centered instead of left-aligned.
936    /// This property should be set for title-like items.
937    pub fn centered(self, centered: bool) -> Self {
938        Self {
939            builder: self.builder.property("centered", centered),
940        }
941    }
942
943    /// A [`gio::Icon`][crate::gio::Icon] that will be used if iconic appearance for the button is
944    /// desired.
945    pub fn icon(self, icon: &impl IsA<gio::Icon>) -> Self {
946        Self {
947            builder: self.builder.property("icon", icon.clone().upcast()),
948        }
949    }
950
951    /// If this property is set, the button will show an icon if one is set.
952    /// If no icon is set, the text will be used. This is typically used for
953    /// horizontal sections of linked buttons.
954    pub fn iconic(self, iconic: bool) -> Self {
955        Self {
956            builder: self.builder.property("iconic", iconic),
957        }
958    }
959
960    /// Whether to show the submenu indicator at the opposite side than normal.
961    /// This property should be set for model buttons that 'go back' to a parent
962    /// menu.
963    pub fn inverted(self, inverted: bool) -> Self {
964        Self {
965            builder: self.builder.property("inverted", inverted),
966        }
967    }
968
969    /// The name of a submenu to open when the button is activated.
970    /// If this is set, the button should not have an action associated with it.
971    pub fn menu_name(self, menu_name: impl Into<glib::GString>) -> Self {
972        Self {
973            builder: self.builder.property("menu-name", menu_name.into()),
974        }
975    }
976
977    /// Specifies whether the button is a plain, check or radio button.
978    /// When [`action-name`][struct@crate::Actionable#action-name] is set, the role will be determined
979    /// from the action and does not have to be set explicitly.
980    pub fn role(self, role: ButtonRole) -> Self {
981        Self {
982            builder: self.builder.property("role", role),
983        }
984    }
985
986    /// The label for the button.
987    pub fn text(self, text: impl Into<glib::GString>) -> Self {
988        Self {
989            builder: self.builder.property("text", text.into()),
990        }
991    }
992
993    /// If [`true`], XML tags in the text of the button are interpreted as by
994    /// `pango_parse_markup()` to format the enclosed spans of text. If [`false`], the
995    /// text will be displayed verbatim.
996    #[cfg(feature = "v3_24")]
997    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
998    pub fn use_markup(self, use_markup: bool) -> Self {
999        Self {
1000            builder: self.builder.property("use-markup", use_markup),
1001        }
1002    }
1003
1004    /// If [`true`], the button will ignore the [`gtk-button-images`][struct@crate::Settings#gtk-button-images]
1005    /// setting and always show the image, if available.
1006    ///
1007    /// Use this property if the button would be useless or hard to use
1008    /// without the image.
1009    pub fn always_show_image(self, always_show_image: bool) -> Self {
1010        Self {
1011            builder: self
1012                .builder
1013                .property("always-show-image", always_show_image),
1014        }
1015    }
1016
1017    /// The child widget to appear next to the button text.
1018    pub fn image(self, image: &impl IsA<Widget>) -> Self {
1019        Self {
1020            builder: self.builder.property("image", image.clone().upcast()),
1021        }
1022    }
1023
1024    /// The position of the image relative to the text inside the button.
1025    pub fn image_position(self, image_position: PositionType) -> Self {
1026        Self {
1027            builder: self.builder.property("image-position", image_position),
1028        }
1029    }
1030
1031    pub fn label(self, label: impl Into<glib::GString>) -> Self {
1032        Self {
1033            builder: self.builder.property("label", label.into()),
1034        }
1035    }
1036
1037    pub fn relief(self, relief: ReliefStyle) -> Self {
1038        Self {
1039            builder: self.builder.property("relief", relief),
1040        }
1041    }
1042
1043    pub fn use_underline(self, use_underline: bool) -> Self {
1044        Self {
1045            builder: self.builder.property("use-underline", use_underline),
1046        }
1047    }
1048
1049    pub fn border_width(self, border_width: u32) -> Self {
1050        Self {
1051            builder: self.builder.property("border-width", border_width),
1052        }
1053    }
1054
1055    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1056        Self {
1057            builder: self.builder.property("child", child.clone().upcast()),
1058        }
1059    }
1060
1061    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1062        Self {
1063            builder: self.builder.property("resize-mode", resize_mode),
1064        }
1065    }
1066
1067    pub fn app_paintable(self, app_paintable: bool) -> Self {
1068        Self {
1069            builder: self.builder.property("app-paintable", app_paintable),
1070        }
1071    }
1072
1073    pub fn can_default(self, can_default: bool) -> Self {
1074        Self {
1075            builder: self.builder.property("can-default", can_default),
1076        }
1077    }
1078
1079    pub fn can_focus(self, can_focus: bool) -> Self {
1080        Self {
1081            builder: self.builder.property("can-focus", can_focus),
1082        }
1083    }
1084
1085    pub fn events(self, events: gdk::EventMask) -> Self {
1086        Self {
1087            builder: self.builder.property("events", events),
1088        }
1089    }
1090
1091    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1092    pub fn expand(self, expand: bool) -> Self {
1093        Self {
1094            builder: self.builder.property("expand", expand),
1095        }
1096    }
1097
1098    /// Whether the widget should grab focus when it is clicked with the mouse.
1099    ///
1100    /// This property is only relevant for widgets that can take focus.
1101    ///
1102    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1103    /// GtkComboBox) implemented this property individually.
1104    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1105        Self {
1106            builder: self.builder.property("focus-on-click", focus_on_click),
1107        }
1108    }
1109
1110    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1111    pub fn halign(self, halign: Align) -> Self {
1112        Self {
1113            builder: self.builder.property("halign", halign),
1114        }
1115    }
1116
1117    pub fn has_default(self, has_default: bool) -> Self {
1118        Self {
1119            builder: self.builder.property("has-default", has_default),
1120        }
1121    }
1122
1123    pub fn has_focus(self, has_focus: bool) -> Self {
1124        Self {
1125            builder: self.builder.property("has-focus", has_focus),
1126        }
1127    }
1128
1129    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1130    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1131    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1132    /// whether it will provide a tooltip or not.
1133    ///
1134    /// Note that setting this property to [`true`] for the first time will change
1135    /// the event masks of the GdkWindows of this widget to include leave-notify
1136    /// and motion-notify events. This cannot and will not be undone when the
1137    /// property is set to [`false`] again.
1138    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1139        Self {
1140            builder: self.builder.property("has-tooltip", has_tooltip),
1141        }
1142    }
1143
1144    pub fn height_request(self, height_request: i32) -> Self {
1145        Self {
1146            builder: self.builder.property("height-request", height_request),
1147        }
1148    }
1149
1150    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1151    pub fn hexpand(self, hexpand: bool) -> Self {
1152        Self {
1153            builder: self.builder.property("hexpand", hexpand),
1154        }
1155    }
1156
1157    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1158    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1159        Self {
1160            builder: self.builder.property("hexpand-set", hexpand_set),
1161        }
1162    }
1163
1164    pub fn is_focus(self, is_focus: bool) -> Self {
1165        Self {
1166            builder: self.builder.property("is-focus", is_focus),
1167        }
1168    }
1169
1170    /// Sets all four sides' margin at once. If read, returns max
1171    /// margin on any side.
1172    pub fn margin(self, margin: i32) -> Self {
1173        Self {
1174            builder: self.builder.property("margin", margin),
1175        }
1176    }
1177
1178    /// Margin on bottom side of widget.
1179    ///
1180    /// This property adds margin outside of the widget's normal size
1181    /// request, the margin will be added in addition to the size from
1182    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1183    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1184        Self {
1185            builder: self.builder.property("margin-bottom", margin_bottom),
1186        }
1187    }
1188
1189    /// Margin on end of widget, horizontally. This property supports
1190    /// left-to-right and right-to-left text directions.
1191    ///
1192    /// This property adds margin outside of the widget's normal size
1193    /// request, the margin will be added in addition to the size from
1194    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1195    pub fn margin_end(self, margin_end: i32) -> Self {
1196        Self {
1197            builder: self.builder.property("margin-end", margin_end),
1198        }
1199    }
1200
1201    /// Margin on start of widget, horizontally. This property supports
1202    /// left-to-right and right-to-left text directions.
1203    ///
1204    /// This property adds margin outside of the widget's normal size
1205    /// request, the margin will be added in addition to the size from
1206    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1207    pub fn margin_start(self, margin_start: i32) -> Self {
1208        Self {
1209            builder: self.builder.property("margin-start", margin_start),
1210        }
1211    }
1212
1213    /// Margin on top side of widget.
1214    ///
1215    /// This property adds margin outside of the widget's normal size
1216    /// request, the margin will be added in addition to the size from
1217    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1218    pub fn margin_top(self, margin_top: i32) -> Self {
1219        Self {
1220            builder: self.builder.property("margin-top", margin_top),
1221        }
1222    }
1223
1224    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1225        Self {
1226            builder: self.builder.property("name", name.into()),
1227        }
1228    }
1229
1230    pub fn no_show_all(self, no_show_all: bool) -> Self {
1231        Self {
1232            builder: self.builder.property("no-show-all", no_show_all),
1233        }
1234    }
1235
1236    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1237    /// more details about window opacity.
1238    ///
1239    /// Before 3.8 this was only available in GtkWindow
1240    pub fn opacity(self, opacity: f64) -> Self {
1241        Self {
1242            builder: self.builder.property("opacity", opacity),
1243        }
1244    }
1245
1246    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1247        Self {
1248            builder: self.builder.property("parent", parent.clone().upcast()),
1249        }
1250    }
1251
1252    pub fn receives_default(self, receives_default: bool) -> Self {
1253        Self {
1254            builder: self.builder.property("receives-default", receives_default),
1255        }
1256    }
1257
1258    pub fn sensitive(self, sensitive: bool) -> Self {
1259        Self {
1260            builder: self.builder.property("sensitive", sensitive),
1261        }
1262    }
1263
1264    /// Sets the text of tooltip to be the given string, which is marked up
1265    /// with the [Pango text markup language][PangoMarkupFormat].
1266    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1267    ///
1268    /// This is a convenience property which will take care of getting the
1269    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1270    /// will automatically be set to [`true`] and there will be taken care of
1271    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1272    ///
1273    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1274    /// are set, the last one wins.
1275    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1276        Self {
1277            builder: self
1278                .builder
1279                .property("tooltip-markup", tooltip_markup.into()),
1280        }
1281    }
1282
1283    /// Sets the text of tooltip to be the given string.
1284    ///
1285    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1286    ///
1287    /// This is a convenience property which will take care of getting the
1288    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1289    /// will automatically be set to [`true`] and there will be taken care of
1290    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1291    ///
1292    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1293    /// are set, the last one wins.
1294    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1295        Self {
1296            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1297        }
1298    }
1299
1300    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1301    pub fn valign(self, valign: Align) -> Self {
1302        Self {
1303            builder: self.builder.property("valign", valign),
1304        }
1305    }
1306
1307    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1308    pub fn vexpand(self, vexpand: bool) -> Self {
1309        Self {
1310            builder: self.builder.property("vexpand", vexpand),
1311        }
1312    }
1313
1314    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1315    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1316        Self {
1317            builder: self.builder.property("vexpand-set", vexpand_set),
1318        }
1319    }
1320
1321    pub fn visible(self, visible: bool) -> Self {
1322        Self {
1323            builder: self.builder.property("visible", visible),
1324        }
1325    }
1326
1327    pub fn width_request(self, width_request: i32) -> Self {
1328        Self {
1329            builder: self.builder.property("width-request", width_request),
1330        }
1331    }
1332
1333    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1334        Self {
1335            builder: self.builder.property("action-name", action_name.into()),
1336        }
1337    }
1338
1339    pub fn action_target(self, action_target: &glib::Variant) -> Self {
1340        Self {
1341            builder: self
1342                .builder
1343                .property("action-target", action_target.clone()),
1344        }
1345    }
1346
1347    // rustdoc-stripper-ignore-next
1348    /// Build the [`ModelButton`].
1349    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1350    pub fn build(self) -> ModelButton {
1351        self.builder.build()
1352    }
1353}
1354
1355impl fmt::Display for ModelButton {
1356    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1357        f.write_str("ModelButton")
1358    }
1359}