gtk4/auto/
print_unix_dialog.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    ffi, Accessible, AccessibleRole, Align, Application, Buildable, ConstraintTarget, Dialog,
7    LayoutManager, Native, Overflow, PageSetup, PrintCapabilities, PrintSettings, Printer, Root,
8    ShortcutManager, Widget, Window,
9};
10use glib::{
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// [`PrintUnixDialog`][crate::PrintUnixDialog] implements a print dialog for platforms
19    /// which don’t provide a native print dialog, like Unix.
20    ///
21    /// ![An example GtkPrintUnixDialog](printdialog.png)
22    ///
23    /// It can be used very much like any other GTK dialog, at the cost of
24    /// the portability offered by the high-level printing API with
25    /// [`PrintOperation`][crate::PrintOperation].
26    ///
27    /// In order to print something with [`PrintUnixDialog`][crate::PrintUnixDialog], you need to
28    /// use [`selected_printer()`][Self::selected_printer()] to obtain a
29    /// [`Printer`][crate::Printer] object and use it to construct a [`PrintJob`][crate::PrintJob]
30    /// using [`PrintJob::new()`][crate::PrintJob::new()].
31    ///
32    /// [`PrintUnixDialog`][crate::PrintUnixDialog] uses the following response values:
33    ///
34    /// - [`ResponseType::Ok`][crate::ResponseType::Ok]: for the “Print” button
35    /// - [`ResponseType::Apply`][crate::ResponseType::Apply]: for the “Preview” button
36    /// - [`ResponseType::Cancel`][crate::ResponseType::Cancel]: for the “Cancel” button
37    ///
38    /// # GtkPrintUnixDialog as GtkBuildable
39    ///
40    /// The [`PrintUnixDialog`][crate::PrintUnixDialog] implementation of the [`Buildable`][crate::Buildable] interface
41    /// exposes its @notebook internal children with the name “notebook”.
42    ///
43    /// An example of a [`PrintUnixDialog`][crate::PrintUnixDialog] UI definition fragment:
44    ///
45    /// ```xml
46    /// <object class="GtkPrintUnixDialog" id="dialog1">
47    ///   <child internal-child="notebook">
48    ///     <object class="GtkNotebook" id="notebook">
49    ///       <child>
50    ///         <object type="GtkNotebookPage">
51    ///           <property name="tab_expand">False</property>
52    ///           <property name="tab_fill">False</property>
53    ///           <property name="tab">
54    ///             <object class="GtkLabel" id="tablabel">
55    ///               <property name="label">Tab label</property>
56    ///             </object>
57    ///           </property>
58    ///           <property name="child">
59    ///             <object class="GtkLabel" id="tabcontent">
60    ///               <property name="label">Content on notebook tab</property>
61    ///             </object>
62    ///           </property>
63    ///         </object>
64    ///       </child>
65    ///     </object>
66    ///   </child>
67    /// </object>
68    /// ```
69    ///
70    /// # CSS nodes
71    ///
72    /// [`PrintUnixDialog`][crate::PrintUnixDialog] has a single CSS node with name window. The style classes
73    /// dialog and print are added.
74    ///
75    /// ## Properties
76    ///
77    ///
78    /// #### `current-page`
79    ///  The current page in the document.
80    ///
81    /// Readable | Writeable
82    ///
83    ///
84    /// #### `embed-page-setup`
85    ///  [`true`] if the page setup controls are embedded.
86    ///
87    /// Readable | Writeable
88    ///
89    ///
90    /// #### `has-selection`
91    ///  Whether the application has a selection.
92    ///
93    /// Readable | Writeable
94    ///
95    ///
96    /// #### `manual-capabilities`
97    ///  Capabilities the application can handle.
98    ///
99    /// Readable | Writeable
100    ///
101    ///
102    /// #### `page-setup`
103    ///  The [`PageSetup`][crate::PageSetup] object to use.
104    ///
105    /// Readable | Writeable
106    ///
107    ///
108    /// #### `print-settings`
109    ///  The [`PrintSettings`][crate::PrintSettings] object used for this dialog.
110    ///
111    /// Readable | Writeable
112    ///
113    ///
114    /// #### `selected-printer`
115    ///  The [`Printer`][crate::Printer] which is selected.
116    ///
117    /// Readable
118    ///
119    ///
120    /// #### `support-selection`
121    ///  Whether the dialog supports selection.
122    ///
123    /// Readable | Writeable
124    /// <details><summary><h4>Dialog</h4></summary>
125    ///
126    ///
127    /// #### `use-header-bar`
128    ///  [`true`] if the dialog uses a headerbar for action buttons
129    /// instead of the action-area.
130    ///
131    /// For technical reasons, this property is declared as an integer
132    /// property, but you should only set it to [`true`] or [`false`].
133    ///
134    /// ## Creating a dialog with headerbar
135    ///
136    /// Builtin [`Dialog`][crate::Dialog] subclasses such as [`ColorChooserDialog`][crate::ColorChooserDialog]
137    /// set this property according to platform conventions (using the
138    /// [`gtk-dialogs-use-header`][struct@crate::Settings#gtk-dialogs-use-header] setting).
139    ///
140    /// Here is how you can achieve the same:
141    ///
142    /// **⚠️ The following code is in c ⚠️**
143    ///
144    /// ```c
145    /// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
146    /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
147    /// ```
148    ///
149    /// Readable | Writeable | Construct Only
150    /// </details>
151    /// <details><summary><h4>Window</h4></summary>
152    ///
153    ///
154    /// #### `application`
155    ///  The [`Application`][crate::Application] associated with the window.
156    ///
157    /// The application will be kept alive for at least as long as it
158    /// has any windows associated with it (see g_application_hold()
159    /// for a way to keep it alive without windows).
160    ///
161    /// Normally, the connection between the application and the window
162    /// will remain until the window is destroyed, but you can explicitly
163    /// remove it by setting the this property to `NULL`.
164    ///
165    /// Readable | Writeable
166    ///
167    ///
168    /// #### `child`
169    ///  The child widget.
170    ///
171    /// Readable | Writeable
172    ///
173    ///
174    /// #### `decorated`
175    ///  Whether the window should have a frame (also known as *decorations*).
176    ///
177    /// Readable | Writeable
178    ///
179    ///
180    /// #### `default-height`
181    ///  The default height of the window.
182    ///
183    /// Readable | Writeable
184    ///
185    ///
186    /// #### `default-widget`
187    ///  The default widget.
188    ///
189    /// Readable | Writeable
190    ///
191    ///
192    /// #### `default-width`
193    ///  The default width of the window.
194    ///
195    /// Readable | Writeable
196    ///
197    ///
198    /// #### `deletable`
199    ///  Whether the window frame should have a close button.
200    ///
201    /// Readable | Writeable
202    ///
203    ///
204    /// #### `destroy-with-parent`
205    ///  If this window should be destroyed when the parent is destroyed.
206    ///
207    /// Readable | Writeable
208    ///
209    ///
210    /// #### `display`
211    ///  The display that will display this window.
212    ///
213    /// Readable | Writeable
214    ///
215    ///
216    /// #### `focus-visible`
217    ///  Whether 'focus rectangles' are currently visible in this window.
218    ///
219    /// This property is maintained by GTK based on user input
220    /// and should not be set by applications.
221    ///
222    /// Readable | Writeable
223    ///
224    ///
225    /// #### `focus-widget`
226    ///  The focus widget.
227    ///
228    /// Readable | Writeable
229    ///
230    ///
231    /// #### `fullscreened`
232    ///  Whether the window is fullscreen.
233    ///
234    /// Setting this property is the equivalent of calling
235    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
236    /// either operation is asynchronous, which means you will need to
237    /// connect to the ::notify signal in order to know whether the
238    /// operation was successful.
239    ///
240    /// Readable | Writeable | Construct
241    ///
242    ///
243    /// #### `handle-menubar-accel`
244    ///  Whether the window frame should handle <kbd>F10</kbd> for activating
245    /// menubars.
246    ///
247    /// Readable | Writeable
248    ///
249    ///
250    /// #### `hide-on-close`
251    ///  If this window should be hidden when the users clicks the close button.
252    ///
253    /// Readable | Writeable
254    ///
255    ///
256    /// #### `icon-name`
257    ///  Specifies the name of the themed icon to use as the window icon.
258    ///
259    /// See [`IconTheme`][crate::IconTheme] for more details.
260    ///
261    /// Readable | Writeable
262    ///
263    ///
264    /// #### `is-active`
265    ///  Whether the toplevel is the currently active window.
266    ///
267    /// Readable
268    ///
269    ///
270    /// #### `maximized`
271    ///  Whether the window is maximized.
272    ///
273    /// Setting this property is the equivalent of calling
274    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
275    /// either operation is asynchronous, which means you will need to
276    /// connect to the ::notify signal in order to know whether the
277    /// operation was successful.
278    ///
279    /// Readable | Writeable | Construct
280    ///
281    ///
282    /// #### `mnemonics-visible`
283    ///  Whether mnemonics are currently visible in this window.
284    ///
285    /// This property is maintained by GTK based on user input,
286    /// and should not be set by applications.
287    ///
288    /// Readable | Writeable
289    ///
290    ///
291    /// #### `modal`
292    ///  If true, the window is modal.
293    ///
294    /// Readable | Writeable
295    ///
296    ///
297    /// #### `resizable`
298    ///  If true, users can resize the window.
299    ///
300    /// Readable | Writeable
301    ///
302    ///
303    /// #### `startup-id`
304    ///  A write-only property for setting window's startup notification identifier.
305    ///
306    /// Writeable
307    ///
308    ///
309    /// #### `suspended`
310    ///  Whether the window is suspended.
311    ///
312    /// See [`GtkWindowExt::is_suspended()`][crate::prelude::GtkWindowExt::is_suspended()] for details about what suspended means.
313    ///
314    /// Readable
315    ///
316    ///
317    /// #### `title`
318    ///  The title of the window.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `titlebar`
324    ///  The titlebar widget.
325    ///
326    /// Readable | Writeable
327    ///
328    ///
329    /// #### `transient-for`
330    ///  The transient parent of the window.
331    ///
332    /// Readable | Writeable | Construct
333    /// </details>
334    /// <details><summary><h4>Widget</h4></summary>
335    ///
336    ///
337    /// #### `can-focus`
338    ///  Whether the widget or any of its descendents can accept
339    /// the input focus.
340    ///
341    /// This property is meant to be set by widget implementations,
342    /// typically in their instance init function.
343    ///
344    /// Readable | Writeable
345    ///
346    ///
347    /// #### `can-target`
348    ///  Whether the widget can receive pointer events.
349    ///
350    /// Readable | Writeable
351    ///
352    ///
353    /// #### `css-classes`
354    ///  A list of css classes applied to this widget.
355    ///
356    /// Readable | Writeable
357    ///
358    ///
359    /// #### `css-name`
360    ///  The name of this widget in the CSS tree.
361    ///
362    /// This property is meant to be set by widget implementations,
363    /// typically in their instance init function.
364    ///
365    /// Readable | Writeable | Construct Only
366    ///
367    ///
368    /// #### `cursor`
369    ///  The cursor used by @widget.
370    ///
371    /// Readable | Writeable
372    ///
373    ///
374    /// #### `focus-on-click`
375    ///  Whether the widget should grab focus when it is clicked with the mouse.
376    ///
377    /// This property is only relevant for widgets that can take focus.
378    ///
379    /// Readable | Writeable
380    ///
381    ///
382    /// #### `focusable`
383    ///  Whether this widget itself will accept the input focus.
384    ///
385    /// Readable | Writeable
386    ///
387    ///
388    /// #### `halign`
389    ///  How to distribute horizontal space if widget gets extra space.
390    ///
391    /// Readable | Writeable
392    ///
393    ///
394    /// #### `has-default`
395    ///  Whether the widget is the default widget.
396    ///
397    /// Readable
398    ///
399    ///
400    /// #### `has-focus`
401    ///  Whether the widget has the input focus.
402    ///
403    /// Readable
404    ///
405    ///
406    /// #### `has-tooltip`
407    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
408    /// signal on @widget.
409    ///
410    /// A true value indicates that @widget can have a tooltip, in this case
411    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
412    /// determine whether it will provide a tooltip or not.
413    ///
414    /// Readable | Writeable
415    ///
416    ///
417    /// #### `height-request`
418    ///  Overrides for height request of the widget.
419    ///
420    /// If this is -1, the natural request will be used.
421    ///
422    /// Readable | Writeable
423    ///
424    ///
425    /// #### `hexpand`
426    ///  Whether to expand horizontally.
427    ///
428    /// Readable | Writeable
429    ///
430    ///
431    /// #### `hexpand-set`
432    ///  Whether to use the `hexpand` property.
433    ///
434    /// Readable | Writeable
435    ///
436    ///
437    /// #### `layout-manager`
438    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
439    /// the preferred size of the widget, and allocate its children.
440    ///
441    /// This property is meant to be set by widget implementations,
442    /// typically in their instance init function.
443    ///
444    /// Readable | Writeable
445    ///
446    ///
447    /// #### `limit-events`
448    ///  Makes this widget act like a modal dialog, with respect to
449    /// event delivery.
450    ///
451    /// Global event controllers will not handle events with targets
452    /// inside the widget, unless they are set up to ignore propagation
453    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
454    ///
455    /// Readable | Writeable
456    ///
457    ///
458    /// #### `margin-bottom`
459    ///  Margin on bottom side of widget.
460    ///
461    /// This property adds margin outside of the widget's normal size
462    /// request, the margin will be added in addition to the size from
463    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
464    ///
465    /// Readable | Writeable
466    ///
467    ///
468    /// #### `margin-end`
469    ///  Margin on end of widget, horizontally.
470    ///
471    /// This property supports left-to-right and right-to-left text
472    /// directions.
473    ///
474    /// This property adds margin outside of the widget's normal size
475    /// request, the margin will be added in addition to the size from
476    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
477    ///
478    /// Readable | Writeable
479    ///
480    ///
481    /// #### `margin-start`
482    ///  Margin on start of widget, horizontally.
483    ///
484    /// This property supports left-to-right and right-to-left text
485    /// directions.
486    ///
487    /// This property adds margin outside of the widget's normal size
488    /// request, the margin will be added in addition to the size from
489    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
490    ///
491    /// Readable | Writeable
492    ///
493    ///
494    /// #### `margin-top`
495    ///  Margin on top side of widget.
496    ///
497    /// This property adds margin outside of the widget's normal size
498    /// request, the margin will be added in addition to the size from
499    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
500    ///
501    /// Readable | Writeable
502    ///
503    ///
504    /// #### `name`
505    ///  The name of the widget.
506    ///
507    /// Readable | Writeable
508    ///
509    ///
510    /// #### `opacity`
511    ///  The requested opacity of the widget.
512    ///
513    /// Readable | Writeable
514    ///
515    ///
516    /// #### `overflow`
517    ///  How content outside the widget's content area is treated.
518    ///
519    /// This property is meant to be set by widget implementations,
520    /// typically in their instance init function.
521    ///
522    /// Readable | Writeable
523    ///
524    ///
525    /// #### `parent`
526    ///  The parent widget of this widget.
527    ///
528    /// Readable
529    ///
530    ///
531    /// #### `receives-default`
532    ///  Whether the widget will receive the default action when it is focused.
533    ///
534    /// Readable | Writeable
535    ///
536    ///
537    /// #### `root`
538    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
539    ///
540    /// This will be `NULL` if the widget is not contained in a root widget.
541    ///
542    /// Readable
543    ///
544    ///
545    /// #### `scale-factor`
546    ///  The scale factor of the widget.
547    ///
548    /// Readable
549    ///
550    ///
551    /// #### `sensitive`
552    ///  Whether the widget responds to input.
553    ///
554    /// Readable | Writeable
555    ///
556    ///
557    /// #### `tooltip-markup`
558    ///  Sets the text of tooltip to be the given string, which is marked up
559    /// with Pango markup.
560    ///
561    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
562    ///
563    /// This is a convenience property which will take care of getting the
564    /// tooltip shown if the given string is not `NULL`:
565    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
566    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
567    /// the default signal handler.
568    ///
569    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
570    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
571    ///
572    /// Readable | Writeable
573    ///
574    ///
575    /// #### `tooltip-text`
576    ///  Sets the text of tooltip to be the given string.
577    ///
578    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
579    ///
580    /// This is a convenience property which will take care of getting the
581    /// tooltip shown if the given string is not `NULL`:
582    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
583    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
584    /// the default signal handler.
585    ///
586    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
587    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
588    ///
589    /// Readable | Writeable
590    ///
591    ///
592    /// #### `valign`
593    ///  How to distribute vertical space if widget gets extra space.
594    ///
595    /// Readable | Writeable
596    ///
597    ///
598    /// #### `vexpand`
599    ///  Whether to expand vertically.
600    ///
601    /// Readable | Writeable
602    ///
603    ///
604    /// #### `vexpand-set`
605    ///  Whether to use the `vexpand` property.
606    ///
607    /// Readable | Writeable
608    ///
609    ///
610    /// #### `visible`
611    ///  Whether the widget is visible.
612    ///
613    /// Readable | Writeable
614    ///
615    ///
616    /// #### `width-request`
617    ///  Overrides for width request of the widget.
618    ///
619    /// If this is -1, the natural request will be used.
620    ///
621    /// Readable | Writeable
622    /// </details>
623    /// <details><summary><h4>Accessible</h4></summary>
624    ///
625    ///
626    /// #### `accessible-role`
627    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
628    ///
629    /// The accessible role cannot be changed once set.
630    ///
631    /// Readable | Writeable
632    /// </details>
633    ///
634    /// # Implements
635    ///
636    /// [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`NativeExt`][trait@crate::prelude::NativeExt], [`RootExt`][trait@crate::prelude::RootExt], [`ShortcutManagerExt`][trait@crate::prelude::ShortcutManagerExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
637    #[doc(alias = "GtkPrintUnixDialog")]
638    pub struct PrintUnixDialog(Object<ffi::GtkPrintUnixDialog>) @extends Dialog, Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager;
639
640    match fn {
641        type_ => || ffi::gtk_print_unix_dialog_get_type(),
642    }
643}
644
645impl PrintUnixDialog {
646    /// Creates a new [`PrintUnixDialog`][crate::PrintUnixDialog].
647    /// ## `title`
648    /// Title of the dialog
649    /// ## `parent`
650    /// Transient parent of the dialog
651    ///
652    /// # Returns
653    ///
654    /// a new [`PrintUnixDialog`][crate::PrintUnixDialog]
655    #[doc(alias = "gtk_print_unix_dialog_new")]
656    pub fn new(title: Option<&str>, parent: Option<&impl IsA<Window>>) -> PrintUnixDialog {
657        assert_initialized_main_thread!();
658        unsafe {
659            Widget::from_glib_none(ffi::gtk_print_unix_dialog_new(
660                title.to_glib_none().0,
661                parent.map(|p| p.as_ref()).to_glib_none().0,
662            ))
663            .unsafe_cast()
664        }
665    }
666
667    // rustdoc-stripper-ignore-next
668    /// Creates a new builder-pattern struct instance to construct [`PrintUnixDialog`] objects.
669    ///
670    /// This method returns an instance of [`PrintUnixDialogBuilder`](crate::builders::PrintUnixDialogBuilder) which can be used to create [`PrintUnixDialog`] objects.
671    pub fn builder() -> PrintUnixDialogBuilder {
672        PrintUnixDialogBuilder::new()
673    }
674
675    /// Adds a custom tab to the print dialog.
676    /// ## `child`
677    /// the widget to put in the custom tab
678    /// ## `tab_label`
679    /// the widget to use as tab label
680    #[doc(alias = "gtk_print_unix_dialog_add_custom_tab")]
681    pub fn add_custom_tab(&self, child: &impl IsA<Widget>, tab_label: &impl IsA<Widget>) {
682        unsafe {
683            ffi::gtk_print_unix_dialog_add_custom_tab(
684                self.to_glib_none().0,
685                child.as_ref().to_glib_none().0,
686                tab_label.as_ref().to_glib_none().0,
687            );
688        }
689    }
690
691    /// Gets the current page of the [`PrintUnixDialog`][crate::PrintUnixDialog].
692    ///
693    /// # Returns
694    ///
695    /// the current page of @self
696    #[doc(alias = "gtk_print_unix_dialog_get_current_page")]
697    #[doc(alias = "get_current_page")]
698    #[doc(alias = "current-page")]
699    pub fn current_page(&self) -> i32 {
700        unsafe { ffi::gtk_print_unix_dialog_get_current_page(self.to_glib_none().0) }
701    }
702
703    /// Gets whether to embed the page setup.
704    ///
705    /// # Returns
706    ///
707    /// whether to embed the page setup
708    #[doc(alias = "gtk_print_unix_dialog_get_embed_page_setup")]
709    #[doc(alias = "get_embed_page_setup")]
710    #[doc(alias = "embed-page-setup")]
711    pub fn embeds_page_setup(&self) -> bool {
712        unsafe {
713            from_glib(ffi::gtk_print_unix_dialog_get_embed_page_setup(
714                self.to_glib_none().0,
715            ))
716        }
717    }
718
719    /// Gets whether there is a selection.
720    ///
721    /// # Returns
722    ///
723    /// whether there is a selection
724    #[doc(alias = "gtk_print_unix_dialog_get_has_selection")]
725    #[doc(alias = "get_has_selection")]
726    #[doc(alias = "has-selection")]
727    pub fn has_selection(&self) -> bool {
728        unsafe {
729            from_glib(ffi::gtk_print_unix_dialog_get_has_selection(
730                self.to_glib_none().0,
731            ))
732        }
733    }
734
735    /// Gets the capabilities that have been set on this [`PrintUnixDialog`][crate::PrintUnixDialog].
736    ///
737    /// # Returns
738    ///
739    /// the printing capabilities
740    #[doc(alias = "gtk_print_unix_dialog_get_manual_capabilities")]
741    #[doc(alias = "get_manual_capabilities")]
742    #[doc(alias = "manual-capabilities")]
743    pub fn manual_capabilities(&self) -> PrintCapabilities {
744        unsafe {
745            from_glib(ffi::gtk_print_unix_dialog_get_manual_capabilities(
746                self.to_glib_none().0,
747            ))
748        }
749    }
750
751    /// Gets the page setup that is used by the [`PrintUnixDialog`][crate::PrintUnixDialog].
752    ///
753    /// # Returns
754    ///
755    /// the page setup of @self.
756    #[doc(alias = "gtk_print_unix_dialog_get_page_setup")]
757    #[doc(alias = "get_page_setup")]
758    #[doc(alias = "page-setup")]
759    pub fn page_setup(&self) -> PageSetup {
760        unsafe {
761            from_glib_none(ffi::gtk_print_unix_dialog_get_page_setup(
762                self.to_glib_none().0,
763            ))
764        }
765    }
766
767    /// Gets whether a page setup was set by the user.
768    ///
769    /// # Returns
770    ///
771    /// whether a page setup was set by user.
772    #[doc(alias = "gtk_print_unix_dialog_get_page_setup_set")]
773    #[doc(alias = "get_page_setup_set")]
774    pub fn is_page_setup_set(&self) -> bool {
775        unsafe {
776            from_glib(ffi::gtk_print_unix_dialog_get_page_setup_set(
777                self.to_glib_none().0,
778            ))
779        }
780    }
781
782    /// Gets the currently selected printer.
783    ///
784    /// # Returns
785    ///
786    /// the currently selected printer
787    #[doc(alias = "gtk_print_unix_dialog_get_selected_printer")]
788    #[doc(alias = "get_selected_printer")]
789    #[doc(alias = "selected-printer")]
790    pub fn selected_printer(&self) -> Option<Printer> {
791        unsafe {
792            from_glib_none(ffi::gtk_print_unix_dialog_get_selected_printer(
793                self.to_glib_none().0,
794            ))
795        }
796    }
797
798    /// Gets a new [`PrintSettings`][crate::PrintSettings] object that represents the
799    /// current values in the print dialog.
800    ///
801    /// Note that this creates a new object, and you need to unref
802    /// it if don’t want to keep it.
803    ///
804    /// # Returns
805    ///
806    /// a new [`PrintSettings`][crate::PrintSettings] object with the values from @self
807    #[doc(alias = "gtk_print_unix_dialog_get_settings")]
808    #[doc(alias = "get_settings")]
809    #[doc(alias = "print-settings")]
810    pub fn settings(&self) -> PrintSettings {
811        unsafe {
812            from_glib_full(ffi::gtk_print_unix_dialog_get_settings(
813                self.to_glib_none().0,
814            ))
815        }
816    }
817
818    /// Gets whether the print dialog allows user to print a selection.
819    ///
820    /// # Returns
821    ///
822    /// whether the application supports print of selection
823    #[doc(alias = "gtk_print_unix_dialog_get_support_selection")]
824    #[doc(alias = "get_support_selection")]
825    #[doc(alias = "support-selection")]
826    pub fn supports_selection(&self) -> bool {
827        unsafe {
828            from_glib(ffi::gtk_print_unix_dialog_get_support_selection(
829                self.to_glib_none().0,
830            ))
831        }
832    }
833
834    /// Sets the current page number.
835    ///
836    /// If @current_page is not -1, this enables the current page choice
837    /// for the range of pages to print.
838    /// ## `current_page`
839    /// the current page number.
840    #[doc(alias = "gtk_print_unix_dialog_set_current_page")]
841    #[doc(alias = "current-page")]
842    pub fn set_current_page(&self, current_page: i32) {
843        unsafe {
844            ffi::gtk_print_unix_dialog_set_current_page(self.to_glib_none().0, current_page);
845        }
846    }
847
848    /// Embed page size combo box and orientation combo box into page setup page.
849    /// ## `embed`
850    /// embed page setup selection
851    #[doc(alias = "gtk_print_unix_dialog_set_embed_page_setup")]
852    #[doc(alias = "embed-page-setup")]
853    pub fn set_embed_page_setup(&self, embed: bool) {
854        unsafe {
855            ffi::gtk_print_unix_dialog_set_embed_page_setup(
856                self.to_glib_none().0,
857                embed.into_glib(),
858            );
859        }
860    }
861
862    /// Sets whether a selection exists.
863    /// ## `has_selection`
864    /// [`true`] indicates that a selection exists
865    #[doc(alias = "gtk_print_unix_dialog_set_has_selection")]
866    #[doc(alias = "has-selection")]
867    pub fn set_has_selection(&self, has_selection: bool) {
868        unsafe {
869            ffi::gtk_print_unix_dialog_set_has_selection(
870                self.to_glib_none().0,
871                has_selection.into_glib(),
872            );
873        }
874    }
875
876    /// This lets you specify the printing capabilities your application
877    /// supports.
878    ///
879    /// For instance, if you can handle scaling the output then you pass
880    /// [`PrintCapabilities::SCALE`][crate::PrintCapabilities::SCALE]. If you don’t pass that, then the dialog
881    /// will only let you select the scale if the printing system automatically
882    /// handles scaling.
883    /// ## `capabilities`
884    /// the printing capabilities of your application
885    #[doc(alias = "gtk_print_unix_dialog_set_manual_capabilities")]
886    #[doc(alias = "manual-capabilities")]
887    pub fn set_manual_capabilities(&self, capabilities: PrintCapabilities) {
888        unsafe {
889            ffi::gtk_print_unix_dialog_set_manual_capabilities(
890                self.to_glib_none().0,
891                capabilities.into_glib(),
892            );
893        }
894    }
895
896    /// Sets the page setup of the [`PrintUnixDialog`][crate::PrintUnixDialog].
897    /// ## `page_setup`
898    /// a [`PageSetup`][crate::PageSetup]
899    #[doc(alias = "gtk_print_unix_dialog_set_page_setup")]
900    #[doc(alias = "page-setup")]
901    pub fn set_page_setup(&self, page_setup: &PageSetup) {
902        unsafe {
903            ffi::gtk_print_unix_dialog_set_page_setup(
904                self.to_glib_none().0,
905                page_setup.to_glib_none().0,
906            );
907        }
908    }
909
910    /// Sets the [`PrintSettings`][crate::PrintSettings] for the [`PrintUnixDialog`][crate::PrintUnixDialog].
911    ///
912    /// Typically, this is used to restore saved print settings
913    /// from a previous print operation before the print dialog
914    /// is shown.
915    /// ## `settings`
916    /// a [`PrintSettings`][crate::PrintSettings]
917    #[doc(alias = "gtk_print_unix_dialog_set_settings")]
918    #[doc(alias = "print-settings")]
919    pub fn set_settings(&self, settings: Option<&PrintSettings>) {
920        unsafe {
921            ffi::gtk_print_unix_dialog_set_settings(
922                self.to_glib_none().0,
923                settings.to_glib_none().0,
924            );
925        }
926    }
927
928    /// Sets whether the print dialog allows user to print a selection.
929    /// ## `support_selection`
930    /// [`true`] to allow print selection
931    #[doc(alias = "gtk_print_unix_dialog_set_support_selection")]
932    #[doc(alias = "support-selection")]
933    pub fn set_support_selection(&self, support_selection: bool) {
934        unsafe {
935            ffi::gtk_print_unix_dialog_set_support_selection(
936                self.to_glib_none().0,
937                support_selection.into_glib(),
938            );
939        }
940    }
941
942    #[doc(alias = "current-page")]
943    pub fn connect_current_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
944        unsafe extern "C" fn notify_current_page_trampoline<F: Fn(&PrintUnixDialog) + 'static>(
945            this: *mut ffi::GtkPrintUnixDialog,
946            _param_spec: glib::ffi::gpointer,
947            f: glib::ffi::gpointer,
948        ) {
949            let f: &F = &*(f as *const F);
950            f(&from_glib_borrow(this))
951        }
952        unsafe {
953            let f: Box_<F> = Box_::new(f);
954            connect_raw(
955                self.as_ptr() as *mut _,
956                b"notify::current-page\0".as_ptr() as *const _,
957                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
958                    notify_current_page_trampoline::<F> as *const (),
959                )),
960                Box_::into_raw(f),
961            )
962        }
963    }
964
965    #[doc(alias = "embed-page-setup")]
966    pub fn connect_embed_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
967        unsafe extern "C" fn notify_embed_page_setup_trampoline<
968            F: Fn(&PrintUnixDialog) + 'static,
969        >(
970            this: *mut ffi::GtkPrintUnixDialog,
971            _param_spec: glib::ffi::gpointer,
972            f: glib::ffi::gpointer,
973        ) {
974            let f: &F = &*(f as *const F);
975            f(&from_glib_borrow(this))
976        }
977        unsafe {
978            let f: Box_<F> = Box_::new(f);
979            connect_raw(
980                self.as_ptr() as *mut _,
981                b"notify::embed-page-setup\0".as_ptr() as *const _,
982                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
983                    notify_embed_page_setup_trampoline::<F> as *const (),
984                )),
985                Box_::into_raw(f),
986            )
987        }
988    }
989
990    #[doc(alias = "has-selection")]
991    pub fn connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
992        unsafe extern "C" fn notify_has_selection_trampoline<F: Fn(&PrintUnixDialog) + 'static>(
993            this: *mut ffi::GtkPrintUnixDialog,
994            _param_spec: glib::ffi::gpointer,
995            f: glib::ffi::gpointer,
996        ) {
997            let f: &F = &*(f as *const F);
998            f(&from_glib_borrow(this))
999        }
1000        unsafe {
1001            let f: Box_<F> = Box_::new(f);
1002            connect_raw(
1003                self.as_ptr() as *mut _,
1004                b"notify::has-selection\0".as_ptr() as *const _,
1005                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1006                    notify_has_selection_trampoline::<F> as *const (),
1007                )),
1008                Box_::into_raw(f),
1009            )
1010        }
1011    }
1012
1013    #[doc(alias = "manual-capabilities")]
1014    pub fn connect_manual_capabilities_notify<F: Fn(&Self) + 'static>(
1015        &self,
1016        f: F,
1017    ) -> SignalHandlerId {
1018        unsafe extern "C" fn notify_manual_capabilities_trampoline<
1019            F: Fn(&PrintUnixDialog) + 'static,
1020        >(
1021            this: *mut ffi::GtkPrintUnixDialog,
1022            _param_spec: glib::ffi::gpointer,
1023            f: glib::ffi::gpointer,
1024        ) {
1025            let f: &F = &*(f as *const F);
1026            f(&from_glib_borrow(this))
1027        }
1028        unsafe {
1029            let f: Box_<F> = Box_::new(f);
1030            connect_raw(
1031                self.as_ptr() as *mut _,
1032                b"notify::manual-capabilities\0".as_ptr() as *const _,
1033                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1034                    notify_manual_capabilities_trampoline::<F> as *const (),
1035                )),
1036                Box_::into_raw(f),
1037            )
1038        }
1039    }
1040
1041    #[doc(alias = "page-setup")]
1042    pub fn connect_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1043        unsafe extern "C" fn notify_page_setup_trampoline<F: Fn(&PrintUnixDialog) + 'static>(
1044            this: *mut ffi::GtkPrintUnixDialog,
1045            _param_spec: glib::ffi::gpointer,
1046            f: glib::ffi::gpointer,
1047        ) {
1048            let f: &F = &*(f as *const F);
1049            f(&from_glib_borrow(this))
1050        }
1051        unsafe {
1052            let f: Box_<F> = Box_::new(f);
1053            connect_raw(
1054                self.as_ptr() as *mut _,
1055                b"notify::page-setup\0".as_ptr() as *const _,
1056                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1057                    notify_page_setup_trampoline::<F> as *const (),
1058                )),
1059                Box_::into_raw(f),
1060            )
1061        }
1062    }
1063
1064    #[doc(alias = "print-settings")]
1065    pub fn connect_print_settings_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1066        unsafe extern "C" fn notify_print_settings_trampoline<F: Fn(&PrintUnixDialog) + 'static>(
1067            this: *mut ffi::GtkPrintUnixDialog,
1068            _param_spec: glib::ffi::gpointer,
1069            f: glib::ffi::gpointer,
1070        ) {
1071            let f: &F = &*(f as *const F);
1072            f(&from_glib_borrow(this))
1073        }
1074        unsafe {
1075            let f: Box_<F> = Box_::new(f);
1076            connect_raw(
1077                self.as_ptr() as *mut _,
1078                b"notify::print-settings\0".as_ptr() as *const _,
1079                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1080                    notify_print_settings_trampoline::<F> as *const (),
1081                )),
1082                Box_::into_raw(f),
1083            )
1084        }
1085    }
1086
1087    #[doc(alias = "selected-printer")]
1088    pub fn connect_selected_printer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1089        unsafe extern "C" fn notify_selected_printer_trampoline<
1090            F: Fn(&PrintUnixDialog) + 'static,
1091        >(
1092            this: *mut ffi::GtkPrintUnixDialog,
1093            _param_spec: glib::ffi::gpointer,
1094            f: glib::ffi::gpointer,
1095        ) {
1096            let f: &F = &*(f as *const F);
1097            f(&from_glib_borrow(this))
1098        }
1099        unsafe {
1100            let f: Box_<F> = Box_::new(f);
1101            connect_raw(
1102                self.as_ptr() as *mut _,
1103                b"notify::selected-printer\0".as_ptr() as *const _,
1104                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1105                    notify_selected_printer_trampoline::<F> as *const (),
1106                )),
1107                Box_::into_raw(f),
1108            )
1109        }
1110    }
1111
1112    #[doc(alias = "support-selection")]
1113    pub fn connect_support_selection_notify<F: Fn(&Self) + 'static>(
1114        &self,
1115        f: F,
1116    ) -> SignalHandlerId {
1117        unsafe extern "C" fn notify_support_selection_trampoline<
1118            F: Fn(&PrintUnixDialog) + 'static,
1119        >(
1120            this: *mut ffi::GtkPrintUnixDialog,
1121            _param_spec: glib::ffi::gpointer,
1122            f: glib::ffi::gpointer,
1123        ) {
1124            let f: &F = &*(f as *const F);
1125            f(&from_glib_borrow(this))
1126        }
1127        unsafe {
1128            let f: Box_<F> = Box_::new(f);
1129            connect_raw(
1130                self.as_ptr() as *mut _,
1131                b"notify::support-selection\0".as_ptr() as *const _,
1132                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1133                    notify_support_selection_trampoline::<F> as *const (),
1134                )),
1135                Box_::into_raw(f),
1136            )
1137        }
1138    }
1139}
1140
1141impl Default for PrintUnixDialog {
1142    fn default() -> Self {
1143        glib::object::Object::new::<Self>()
1144    }
1145}
1146
1147// rustdoc-stripper-ignore-next
1148/// A [builder-pattern] type to construct [`PrintUnixDialog`] objects.
1149///
1150/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1151#[must_use = "The builder must be built to be used"]
1152pub struct PrintUnixDialogBuilder {
1153    builder: glib::object::ObjectBuilder<'static, PrintUnixDialog>,
1154}
1155
1156impl PrintUnixDialogBuilder {
1157    fn new() -> Self {
1158        Self {
1159            builder: glib::object::Object::builder(),
1160        }
1161    }
1162
1163    /// The current page in the document.
1164    pub fn current_page(self, current_page: i32) -> Self {
1165        Self {
1166            builder: self.builder.property("current-page", current_page),
1167        }
1168    }
1169
1170    /// [`true`] if the page setup controls are embedded.
1171    pub fn embed_page_setup(self, embed_page_setup: bool) -> Self {
1172        Self {
1173            builder: self.builder.property("embed-page-setup", embed_page_setup),
1174        }
1175    }
1176
1177    /// Whether the application has a selection.
1178    pub fn has_selection(self, has_selection: bool) -> Self {
1179        Self {
1180            builder: self.builder.property("has-selection", has_selection),
1181        }
1182    }
1183
1184    /// Capabilities the application can handle.
1185    pub fn manual_capabilities(self, manual_capabilities: PrintCapabilities) -> Self {
1186        Self {
1187            builder: self
1188                .builder
1189                .property("manual-capabilities", manual_capabilities),
1190        }
1191    }
1192
1193    /// The [`PageSetup`][crate::PageSetup] object to use.
1194    pub fn page_setup(self, page_setup: &PageSetup) -> Self {
1195        Self {
1196            builder: self.builder.property("page-setup", page_setup.clone()),
1197        }
1198    }
1199
1200    /// The [`PrintSettings`][crate::PrintSettings] object used for this dialog.
1201    pub fn print_settings(self, print_settings: &PrintSettings) -> Self {
1202        Self {
1203            builder: self
1204                .builder
1205                .property("print-settings", print_settings.clone()),
1206        }
1207    }
1208
1209    /// Whether the dialog supports selection.
1210    pub fn support_selection(self, support_selection: bool) -> Self {
1211        Self {
1212            builder: self
1213                .builder
1214                .property("support-selection", support_selection),
1215        }
1216    }
1217
1218    /// [`true`] if the dialog uses a headerbar for action buttons
1219    /// instead of the action-area.
1220    ///
1221    /// For technical reasons, this property is declared as an integer
1222    /// property, but you should only set it to [`true`] or [`false`].
1223    ///
1224    /// ## Creating a dialog with headerbar
1225    ///
1226    /// Builtin [`Dialog`][crate::Dialog] subclasses such as [`ColorChooserDialog`][crate::ColorChooserDialog]
1227    /// set this property according to platform conventions (using the
1228    /// [`gtk-dialogs-use-header`][struct@crate::Settings#gtk-dialogs-use-header] setting).
1229    ///
1230    /// Here is how you can achieve the same:
1231    ///
1232    /// **⚠️ The following code is in c ⚠️**
1233    ///
1234    /// ```c
1235    /// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
1236    /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
1237    /// ```
1238    /// Use [`Window`][crate::Window] instead
1239    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1240    pub fn use_header_bar(self, use_header_bar: i32) -> Self {
1241        Self {
1242            builder: self.builder.property("use-header-bar", use_header_bar),
1243        }
1244    }
1245
1246    /// The [`Application`][crate::Application] associated with the window.
1247    ///
1248    /// The application will be kept alive for at least as long as it
1249    /// has any windows associated with it (see g_application_hold()
1250    /// for a way to keep it alive without windows).
1251    ///
1252    /// Normally, the connection between the application and the window
1253    /// will remain until the window is destroyed, but you can explicitly
1254    /// remove it by setting the this property to `NULL`.
1255    pub fn application(self, application: &impl IsA<Application>) -> Self {
1256        Self {
1257            builder: self
1258                .builder
1259                .property("application", application.clone().upcast()),
1260        }
1261    }
1262
1263    /// The child widget.
1264    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1265        Self {
1266            builder: self.builder.property("child", child.clone().upcast()),
1267        }
1268    }
1269
1270    /// Whether the window should have a frame (also known as *decorations*).
1271    pub fn decorated(self, decorated: bool) -> Self {
1272        Self {
1273            builder: self.builder.property("decorated", decorated),
1274        }
1275    }
1276
1277    /// The default height of the window.
1278    pub fn default_height(self, default_height: i32) -> Self {
1279        Self {
1280            builder: self.builder.property("default-height", default_height),
1281        }
1282    }
1283
1284    /// The default widget.
1285    pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
1286        Self {
1287            builder: self
1288                .builder
1289                .property("default-widget", default_widget.clone().upcast()),
1290        }
1291    }
1292
1293    /// The default width of the window.
1294    pub fn default_width(self, default_width: i32) -> Self {
1295        Self {
1296            builder: self.builder.property("default-width", default_width),
1297        }
1298    }
1299
1300    /// Whether the window frame should have a close button.
1301    pub fn deletable(self, deletable: bool) -> Self {
1302        Self {
1303            builder: self.builder.property("deletable", deletable),
1304        }
1305    }
1306
1307    /// If this window should be destroyed when the parent is destroyed.
1308    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1309        Self {
1310            builder: self
1311                .builder
1312                .property("destroy-with-parent", destroy_with_parent),
1313        }
1314    }
1315
1316    /// The display that will display this window.
1317    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
1318        Self {
1319            builder: self.builder.property("display", display.clone().upcast()),
1320        }
1321    }
1322
1323    /// Whether 'focus rectangles' are currently visible in this window.
1324    ///
1325    /// This property is maintained by GTK based on user input
1326    /// and should not be set by applications.
1327    pub fn focus_visible(self, focus_visible: bool) -> Self {
1328        Self {
1329            builder: self.builder.property("focus-visible", focus_visible),
1330        }
1331    }
1332
1333    /// The focus widget.
1334    pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1335        Self {
1336            builder: self
1337                .builder
1338                .property("focus-widget", focus_widget.clone().upcast()),
1339        }
1340    }
1341
1342    /// Whether the window is fullscreen.
1343    ///
1344    /// Setting this property is the equivalent of calling
1345    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1346    /// either operation is asynchronous, which means you will need to
1347    /// connect to the ::notify signal in order to know whether the
1348    /// operation was successful.
1349    pub fn fullscreened(self, fullscreened: bool) -> Self {
1350        Self {
1351            builder: self.builder.property("fullscreened", fullscreened),
1352        }
1353    }
1354
1355    /// Whether the window frame should handle <kbd>F10</kbd> for activating
1356    /// menubars.
1357    #[cfg(feature = "v4_2")]
1358    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1359    pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1360        Self {
1361            builder: self
1362                .builder
1363                .property("handle-menubar-accel", handle_menubar_accel),
1364        }
1365    }
1366
1367    /// If this window should be hidden when the users clicks the close button.
1368    pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1369        Self {
1370            builder: self.builder.property("hide-on-close", hide_on_close),
1371        }
1372    }
1373
1374    /// Specifies the name of the themed icon to use as the window icon.
1375    ///
1376    /// See [`IconTheme`][crate::IconTheme] for more details.
1377    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1378        Self {
1379            builder: self.builder.property("icon-name", icon_name.into()),
1380        }
1381    }
1382
1383    /// Whether the window is maximized.
1384    ///
1385    /// Setting this property is the equivalent of calling
1386    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1387    /// either operation is asynchronous, which means you will need to
1388    /// connect to the ::notify signal in order to know whether the
1389    /// operation was successful.
1390    pub fn maximized(self, maximized: bool) -> Self {
1391        Self {
1392            builder: self.builder.property("maximized", maximized),
1393        }
1394    }
1395
1396    /// Whether mnemonics are currently visible in this window.
1397    ///
1398    /// This property is maintained by GTK based on user input,
1399    /// and should not be set by applications.
1400    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1401        Self {
1402            builder: self
1403                .builder
1404                .property("mnemonics-visible", mnemonics_visible),
1405        }
1406    }
1407
1408    /// If true, the window is modal.
1409    pub fn modal(self, modal: bool) -> Self {
1410        Self {
1411            builder: self.builder.property("modal", modal),
1412        }
1413    }
1414
1415    /// If true, users can resize the window.
1416    pub fn resizable(self, resizable: bool) -> Self {
1417        Self {
1418            builder: self.builder.property("resizable", resizable),
1419        }
1420    }
1421
1422    /// A write-only property for setting window's startup notification identifier.
1423    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1424        Self {
1425            builder: self.builder.property("startup-id", startup_id.into()),
1426        }
1427    }
1428
1429    /// The title of the window.
1430    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1431        Self {
1432            builder: self.builder.property("title", title.into()),
1433        }
1434    }
1435
1436    /// The titlebar widget.
1437    #[cfg(feature = "v4_6")]
1438    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1439    pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1440        Self {
1441            builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1442        }
1443    }
1444
1445    /// The transient parent of the window.
1446    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1447        Self {
1448            builder: self
1449                .builder
1450                .property("transient-for", transient_for.clone().upcast()),
1451        }
1452    }
1453
1454    /// Whether the widget or any of its descendents can accept
1455    /// the input focus.
1456    ///
1457    /// This property is meant to be set by widget implementations,
1458    /// typically in their instance init function.
1459    pub fn can_focus(self, can_focus: bool) -> Self {
1460        Self {
1461            builder: self.builder.property("can-focus", can_focus),
1462        }
1463    }
1464
1465    /// Whether the widget can receive pointer events.
1466    pub fn can_target(self, can_target: bool) -> Self {
1467        Self {
1468            builder: self.builder.property("can-target", can_target),
1469        }
1470    }
1471
1472    /// A list of css classes applied to this widget.
1473    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1474        Self {
1475            builder: self.builder.property("css-classes", css_classes.into()),
1476        }
1477    }
1478
1479    /// The name of this widget in the CSS tree.
1480    ///
1481    /// This property is meant to be set by widget implementations,
1482    /// typically in their instance init function.
1483    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1484        Self {
1485            builder: self.builder.property("css-name", css_name.into()),
1486        }
1487    }
1488
1489    /// The cursor used by @widget.
1490    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1491        Self {
1492            builder: self.builder.property("cursor", cursor.clone()),
1493        }
1494    }
1495
1496    /// Whether the widget should grab focus when it is clicked with the mouse.
1497    ///
1498    /// This property is only relevant for widgets that can take focus.
1499    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1500        Self {
1501            builder: self.builder.property("focus-on-click", focus_on_click),
1502        }
1503    }
1504
1505    /// Whether this widget itself will accept the input focus.
1506    pub fn focusable(self, focusable: bool) -> Self {
1507        Self {
1508            builder: self.builder.property("focusable", focusable),
1509        }
1510    }
1511
1512    /// How to distribute horizontal space if widget gets extra space.
1513    pub fn halign(self, halign: Align) -> Self {
1514        Self {
1515            builder: self.builder.property("halign", halign),
1516        }
1517    }
1518
1519    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1520    /// signal on @widget.
1521    ///
1522    /// A true value indicates that @widget can have a tooltip, in this case
1523    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1524    /// determine whether it will provide a tooltip or not.
1525    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1526        Self {
1527            builder: self.builder.property("has-tooltip", has_tooltip),
1528        }
1529    }
1530
1531    /// Overrides for height request of the widget.
1532    ///
1533    /// If this is -1, the natural request will be used.
1534    pub fn height_request(self, height_request: i32) -> Self {
1535        Self {
1536            builder: self.builder.property("height-request", height_request),
1537        }
1538    }
1539
1540    /// Whether to expand horizontally.
1541    pub fn hexpand(self, hexpand: bool) -> Self {
1542        Self {
1543            builder: self.builder.property("hexpand", hexpand),
1544        }
1545    }
1546
1547    /// Whether to use the `hexpand` property.
1548    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1549        Self {
1550            builder: self.builder.property("hexpand-set", hexpand_set),
1551        }
1552    }
1553
1554    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1555    /// the preferred size of the widget, and allocate its children.
1556    ///
1557    /// This property is meant to be set by widget implementations,
1558    /// typically in their instance init function.
1559    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1560        Self {
1561            builder: self
1562                .builder
1563                .property("layout-manager", layout_manager.clone().upcast()),
1564        }
1565    }
1566
1567    /// Makes this widget act like a modal dialog, with respect to
1568    /// event delivery.
1569    ///
1570    /// Global event controllers will not handle events with targets
1571    /// inside the widget, unless they are set up to ignore propagation
1572    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1573    #[cfg(feature = "v4_18")]
1574    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1575    pub fn limit_events(self, limit_events: bool) -> Self {
1576        Self {
1577            builder: self.builder.property("limit-events", limit_events),
1578        }
1579    }
1580
1581    /// Margin on bottom side of widget.
1582    ///
1583    /// This property adds margin outside of the widget's normal size
1584    /// request, the margin will be added in addition to the size from
1585    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1586    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1587        Self {
1588            builder: self.builder.property("margin-bottom", margin_bottom),
1589        }
1590    }
1591
1592    /// Margin on end of widget, horizontally.
1593    ///
1594    /// This property supports left-to-right and right-to-left text
1595    /// directions.
1596    ///
1597    /// This property adds margin outside of the widget's normal size
1598    /// request, the margin will be added in addition to the size from
1599    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1600    pub fn margin_end(self, margin_end: i32) -> Self {
1601        Self {
1602            builder: self.builder.property("margin-end", margin_end),
1603        }
1604    }
1605
1606    /// Margin on start of widget, horizontally.
1607    ///
1608    /// This property supports left-to-right and right-to-left text
1609    /// directions.
1610    ///
1611    /// This property adds margin outside of the widget's normal size
1612    /// request, the margin will be added in addition to the size from
1613    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1614    pub fn margin_start(self, margin_start: i32) -> Self {
1615        Self {
1616            builder: self.builder.property("margin-start", margin_start),
1617        }
1618    }
1619
1620    /// Margin on top side of widget.
1621    ///
1622    /// This property adds margin outside of the widget's normal size
1623    /// request, the margin will be added in addition to the size from
1624    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1625    pub fn margin_top(self, margin_top: i32) -> Self {
1626        Self {
1627            builder: self.builder.property("margin-top", margin_top),
1628        }
1629    }
1630
1631    /// The name of the widget.
1632    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1633        Self {
1634            builder: self.builder.property("name", name.into()),
1635        }
1636    }
1637
1638    /// The requested opacity of the widget.
1639    pub fn opacity(self, opacity: f64) -> Self {
1640        Self {
1641            builder: self.builder.property("opacity", opacity),
1642        }
1643    }
1644
1645    /// How content outside the widget's content area is treated.
1646    ///
1647    /// This property is meant to be set by widget implementations,
1648    /// typically in their instance init function.
1649    pub fn overflow(self, overflow: Overflow) -> Self {
1650        Self {
1651            builder: self.builder.property("overflow", overflow),
1652        }
1653    }
1654
1655    /// Whether the widget will receive the default action when it is focused.
1656    pub fn receives_default(self, receives_default: bool) -> Self {
1657        Self {
1658            builder: self.builder.property("receives-default", receives_default),
1659        }
1660    }
1661
1662    /// Whether the widget responds to input.
1663    pub fn sensitive(self, sensitive: bool) -> Self {
1664        Self {
1665            builder: self.builder.property("sensitive", sensitive),
1666        }
1667    }
1668
1669    /// Sets the text of tooltip to be the given string, which is marked up
1670    /// with Pango markup.
1671    ///
1672    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1673    ///
1674    /// This is a convenience property which will take care of getting the
1675    /// tooltip shown if the given string is not `NULL`:
1676    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1677    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1678    /// the default signal handler.
1679    ///
1680    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1681    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1682    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1683        Self {
1684            builder: self
1685                .builder
1686                .property("tooltip-markup", tooltip_markup.into()),
1687        }
1688    }
1689
1690    /// Sets the text of tooltip to be the given string.
1691    ///
1692    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1693    ///
1694    /// This is a convenience property which will take care of getting the
1695    /// tooltip shown if the given string is not `NULL`:
1696    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1697    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1698    /// the default signal handler.
1699    ///
1700    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1701    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1702    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1703        Self {
1704            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1705        }
1706    }
1707
1708    /// How to distribute vertical space if widget gets extra space.
1709    pub fn valign(self, valign: Align) -> Self {
1710        Self {
1711            builder: self.builder.property("valign", valign),
1712        }
1713    }
1714
1715    /// Whether to expand vertically.
1716    pub fn vexpand(self, vexpand: bool) -> Self {
1717        Self {
1718            builder: self.builder.property("vexpand", vexpand),
1719        }
1720    }
1721
1722    /// Whether to use the `vexpand` property.
1723    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1724        Self {
1725            builder: self.builder.property("vexpand-set", vexpand_set),
1726        }
1727    }
1728
1729    /// Whether the widget is visible.
1730    pub fn visible(self, visible: bool) -> Self {
1731        Self {
1732            builder: self.builder.property("visible", visible),
1733        }
1734    }
1735
1736    /// Overrides for width request of the widget.
1737    ///
1738    /// If this is -1, the natural request will be used.
1739    pub fn width_request(self, width_request: i32) -> Self {
1740        Self {
1741            builder: self.builder.property("width-request", width_request),
1742        }
1743    }
1744
1745    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1746    ///
1747    /// The accessible role cannot be changed once set.
1748    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1749        Self {
1750            builder: self.builder.property("accessible-role", accessible_role),
1751        }
1752    }
1753
1754    // rustdoc-stripper-ignore-next
1755    /// Build the [`PrintUnixDialog`].
1756    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1757    pub fn build(self) -> PrintUnixDialog {
1758        assert_initialized_main_thread!();
1759        self.builder.build()
1760    }
1761}