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