Skip to main content

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