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