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 Accessible, AccessibleRole, Align, Application, Buildable, ConstraintTarget, Dialog,
10 LayoutManager, Native, Overflow, PageSetup, PrintCapabilities, PrintSettings, Printer, Root,
11 ShortcutManager, Widget, Window, ffi,
12};
13use glib::{
14 prelude::*,
15 signal::{SignalHandlerId, connect_raw},
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 unsafe {
968 let f: &F = &*(f as *const F);
969 f(&from_glib_borrow(this))
970 }
971 }
972 unsafe {
973 let f: Box_<F> = Box_::new(f);
974 connect_raw(
975 self.as_ptr() as *mut _,
976 c"notify::current-page".as_ptr() as *const _,
977 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
978 notify_current_page_trampoline::<F> as *const (),
979 )),
980 Box_::into_raw(f),
981 )
982 }
983 }
984
985 #[doc(alias = "embed-page-setup")]
986 pub fn connect_embed_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
987 unsafe extern "C" fn notify_embed_page_setup_trampoline<
988 F: Fn(&PrintUnixDialog) + 'static,
989 >(
990 this: *mut ffi::GtkPrintUnixDialog,
991 _param_spec: glib::ffi::gpointer,
992 f: glib::ffi::gpointer,
993 ) {
994 unsafe {
995 let f: &F = &*(f as *const F);
996 f(&from_glib_borrow(this))
997 }
998 }
999 unsafe {
1000 let f: Box_<F> = Box_::new(f);
1001 connect_raw(
1002 self.as_ptr() as *mut _,
1003 c"notify::embed-page-setup".as_ptr() as *const _,
1004 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1005 notify_embed_page_setup_trampoline::<F> as *const (),
1006 )),
1007 Box_::into_raw(f),
1008 )
1009 }
1010 }
1011
1012 #[doc(alias = "has-selection")]
1013 pub fn connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1014 unsafe extern "C" fn notify_has_selection_trampoline<F: Fn(&PrintUnixDialog) + 'static>(
1015 this: *mut ffi::GtkPrintUnixDialog,
1016 _param_spec: glib::ffi::gpointer,
1017 f: glib::ffi::gpointer,
1018 ) {
1019 unsafe {
1020 let f: &F = &*(f as *const F);
1021 f(&from_glib_borrow(this))
1022 }
1023 }
1024 unsafe {
1025 let f: Box_<F> = Box_::new(f);
1026 connect_raw(
1027 self.as_ptr() as *mut _,
1028 c"notify::has-selection".as_ptr() as *const _,
1029 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1030 notify_has_selection_trampoline::<F> as *const (),
1031 )),
1032 Box_::into_raw(f),
1033 )
1034 }
1035 }
1036
1037 #[doc(alias = "manual-capabilities")]
1038 pub fn connect_manual_capabilities_notify<F: Fn(&Self) + 'static>(
1039 &self,
1040 f: F,
1041 ) -> SignalHandlerId {
1042 unsafe extern "C" fn notify_manual_capabilities_trampoline<
1043 F: Fn(&PrintUnixDialog) + 'static,
1044 >(
1045 this: *mut ffi::GtkPrintUnixDialog,
1046 _param_spec: glib::ffi::gpointer,
1047 f: glib::ffi::gpointer,
1048 ) {
1049 unsafe {
1050 let f: &F = &*(f as *const F);
1051 f(&from_glib_borrow(this))
1052 }
1053 }
1054 unsafe {
1055 let f: Box_<F> = Box_::new(f);
1056 connect_raw(
1057 self.as_ptr() as *mut _,
1058 c"notify::manual-capabilities".as_ptr() as *const _,
1059 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1060 notify_manual_capabilities_trampoline::<F> as *const (),
1061 )),
1062 Box_::into_raw(f),
1063 )
1064 }
1065 }
1066
1067 #[doc(alias = "page-setup")]
1068 pub fn connect_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1069 unsafe extern "C" fn notify_page_setup_trampoline<F: Fn(&PrintUnixDialog) + 'static>(
1070 this: *mut ffi::GtkPrintUnixDialog,
1071 _param_spec: glib::ffi::gpointer,
1072 f: glib::ffi::gpointer,
1073 ) {
1074 unsafe {
1075 let f: &F = &*(f as *const F);
1076 f(&from_glib_borrow(this))
1077 }
1078 }
1079 unsafe {
1080 let f: Box_<F> = Box_::new(f);
1081 connect_raw(
1082 self.as_ptr() as *mut _,
1083 c"notify::page-setup".as_ptr() as *const _,
1084 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1085 notify_page_setup_trampoline::<F> as *const (),
1086 )),
1087 Box_::into_raw(f),
1088 )
1089 }
1090 }
1091
1092 #[doc(alias = "print-settings")]
1093 pub fn connect_print_settings_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1094 unsafe extern "C" fn notify_print_settings_trampoline<F: Fn(&PrintUnixDialog) + 'static>(
1095 this: *mut ffi::GtkPrintUnixDialog,
1096 _param_spec: glib::ffi::gpointer,
1097 f: glib::ffi::gpointer,
1098 ) {
1099 unsafe {
1100 let f: &F = &*(f as *const F);
1101 f(&from_glib_borrow(this))
1102 }
1103 }
1104 unsafe {
1105 let f: Box_<F> = Box_::new(f);
1106 connect_raw(
1107 self.as_ptr() as *mut _,
1108 c"notify::print-settings".as_ptr() as *const _,
1109 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1110 notify_print_settings_trampoline::<F> as *const (),
1111 )),
1112 Box_::into_raw(f),
1113 )
1114 }
1115 }
1116
1117 #[doc(alias = "selected-printer")]
1118 pub fn connect_selected_printer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1119 unsafe extern "C" fn notify_selected_printer_trampoline<
1120 F: Fn(&PrintUnixDialog) + 'static,
1121 >(
1122 this: *mut ffi::GtkPrintUnixDialog,
1123 _param_spec: glib::ffi::gpointer,
1124 f: glib::ffi::gpointer,
1125 ) {
1126 unsafe {
1127 let f: &F = &*(f as *const F);
1128 f(&from_glib_borrow(this))
1129 }
1130 }
1131 unsafe {
1132 let f: Box_<F> = Box_::new(f);
1133 connect_raw(
1134 self.as_ptr() as *mut _,
1135 c"notify::selected-printer".as_ptr() as *const _,
1136 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1137 notify_selected_printer_trampoline::<F> as *const (),
1138 )),
1139 Box_::into_raw(f),
1140 )
1141 }
1142 }
1143
1144 #[doc(alias = "support-selection")]
1145 pub fn connect_support_selection_notify<F: Fn(&Self) + 'static>(
1146 &self,
1147 f: F,
1148 ) -> SignalHandlerId {
1149 unsafe extern "C" fn notify_support_selection_trampoline<
1150 F: Fn(&PrintUnixDialog) + 'static,
1151 >(
1152 this: *mut ffi::GtkPrintUnixDialog,
1153 _param_spec: glib::ffi::gpointer,
1154 f: glib::ffi::gpointer,
1155 ) {
1156 unsafe {
1157 let f: &F = &*(f as *const F);
1158 f(&from_glib_borrow(this))
1159 }
1160 }
1161 unsafe {
1162 let f: Box_<F> = Box_::new(f);
1163 connect_raw(
1164 self.as_ptr() as *mut _,
1165 c"notify::support-selection".as_ptr() as *const _,
1166 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1167 notify_support_selection_trampoline::<F> as *const (),
1168 )),
1169 Box_::into_raw(f),
1170 )
1171 }
1172 }
1173}
1174
1175impl Default for PrintUnixDialog {
1176 fn default() -> Self {
1177 glib::object::Object::new::<Self>()
1178 }
1179}
1180
1181// rustdoc-stripper-ignore-next
1182/// A [builder-pattern] type to construct [`PrintUnixDialog`] objects.
1183///
1184/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1185#[must_use = "The builder must be built to be used"]
1186pub struct PrintUnixDialogBuilder {
1187 builder: glib::object::ObjectBuilder<'static, PrintUnixDialog>,
1188}
1189
1190impl PrintUnixDialogBuilder {
1191 fn new() -> Self {
1192 Self {
1193 builder: glib::object::Object::builder(),
1194 }
1195 }
1196
1197 /// The current page in the document.
1198 pub fn current_page(self, current_page: i32) -> Self {
1199 Self {
1200 builder: self.builder.property("current-page", current_page),
1201 }
1202 }
1203
1204 /// [`true`] if the page setup controls are embedded.
1205 pub fn embed_page_setup(self, embed_page_setup: bool) -> Self {
1206 Self {
1207 builder: self.builder.property("embed-page-setup", embed_page_setup),
1208 }
1209 }
1210
1211 /// Whether the application has a selection.
1212 pub fn has_selection(self, has_selection: bool) -> Self {
1213 Self {
1214 builder: self.builder.property("has-selection", has_selection),
1215 }
1216 }
1217
1218 /// Capabilities the application can handle.
1219 pub fn manual_capabilities(self, manual_capabilities: PrintCapabilities) -> Self {
1220 Self {
1221 builder: self
1222 .builder
1223 .property("manual-capabilities", manual_capabilities),
1224 }
1225 }
1226
1227 /// The [`PageSetup`][crate::PageSetup] object to use.
1228 pub fn page_setup(self, page_setup: &PageSetup) -> Self {
1229 Self {
1230 builder: self.builder.property("page-setup", page_setup.clone()),
1231 }
1232 }
1233
1234 /// The [`PrintSettings`][crate::PrintSettings] object used for this dialog.
1235 pub fn print_settings(self, print_settings: &PrintSettings) -> Self {
1236 Self {
1237 builder: self
1238 .builder
1239 .property("print-settings", print_settings.clone()),
1240 }
1241 }
1242
1243 /// Whether the dialog supports selection.
1244 pub fn support_selection(self, support_selection: bool) -> Self {
1245 Self {
1246 builder: self
1247 .builder
1248 .property("support-selection", support_selection),
1249 }
1250 }
1251
1252 /// [`true`] if the dialog uses a headerbar for action buttons
1253 /// instead of the action-area.
1254 ///
1255 /// For technical reasons, this property is declared as an integer
1256 /// property, but you should only set it to [`true`] or [`false`].
1257 ///
1258 /// ## Creating a dialog with headerbar
1259 ///
1260 /// Builtin [`Dialog`][crate::Dialog] subclasses such as [`ColorChooserDialog`][crate::ColorChooserDialog]
1261 /// set this property according to platform conventions (using the
1262 /// [`gtk-dialogs-use-header`][struct@crate::Settings#gtk-dialogs-use-header] setting).
1263 ///
1264 /// Here is how you can achieve the same:
1265 ///
1266 /// **⚠️ The following code is in c ⚠️**
1267 ///
1268 /// ```c
1269 /// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
1270 /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
1271 /// ```
1272 /// Use [`Window`][crate::Window] instead
1273 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1274 pub fn use_header_bar(self, use_header_bar: i32) -> Self {
1275 Self {
1276 builder: self.builder.property("use-header-bar", use_header_bar),
1277 }
1278 }
1279
1280 /// The [`Application`][crate::Application] associated with the window.
1281 ///
1282 /// The application will be kept alive for at least as long as it
1283 /// has any windows associated with it (see g_application_hold()
1284 /// for a way to keep it alive without windows).
1285 ///
1286 /// Normally, the connection between the application and the window
1287 /// will remain until the window is destroyed, but you can explicitly
1288 /// remove it by setting the this property to `NULL`.
1289 pub fn application(self, application: &impl IsA<Application>) -> Self {
1290 Self {
1291 builder: self
1292 .builder
1293 .property("application", application.clone().upcast()),
1294 }
1295 }
1296
1297 /// The child widget.
1298 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1299 Self {
1300 builder: self.builder.property("child", child.clone().upcast()),
1301 }
1302 }
1303
1304 /// Whether the window should have a frame (also known as *decorations*).
1305 pub fn decorated(self, decorated: bool) -> Self {
1306 Self {
1307 builder: self.builder.property("decorated", decorated),
1308 }
1309 }
1310
1311 /// The default height of the window.
1312 pub fn default_height(self, default_height: i32) -> Self {
1313 Self {
1314 builder: self.builder.property("default-height", default_height),
1315 }
1316 }
1317
1318 /// The default widget.
1319 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
1320 Self {
1321 builder: self
1322 .builder
1323 .property("default-widget", default_widget.clone().upcast()),
1324 }
1325 }
1326
1327 /// The default width of the window.
1328 pub fn default_width(self, default_width: i32) -> Self {
1329 Self {
1330 builder: self.builder.property("default-width", default_width),
1331 }
1332 }
1333
1334 /// Whether the window frame should have a close button.
1335 pub fn deletable(self, deletable: bool) -> Self {
1336 Self {
1337 builder: self.builder.property("deletable", deletable),
1338 }
1339 }
1340
1341 /// If this window should be destroyed when the parent is destroyed.
1342 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1343 Self {
1344 builder: self
1345 .builder
1346 .property("destroy-with-parent", destroy_with_parent),
1347 }
1348 }
1349
1350 /// The display that will display this window.
1351 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
1352 Self {
1353 builder: self.builder.property("display", display.clone().upcast()),
1354 }
1355 }
1356
1357 /// Whether 'focus rectangles' are currently visible in this window.
1358 ///
1359 /// This property is maintained by GTK based on user input
1360 /// and should not be set by applications.
1361 pub fn focus_visible(self, focus_visible: bool) -> Self {
1362 Self {
1363 builder: self.builder.property("focus-visible", focus_visible),
1364 }
1365 }
1366
1367 /// The focus widget.
1368 pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1369 Self {
1370 builder: self
1371 .builder
1372 .property("focus-widget", focus_widget.clone().upcast()),
1373 }
1374 }
1375
1376 /// Whether the window is fullscreen.
1377 ///
1378 /// Setting this property is the equivalent of calling
1379 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1380 /// either operation is asynchronous, which means you will need to
1381 /// connect to the ::notify signal in order to know whether the
1382 /// operation was successful.
1383 pub fn fullscreened(self, fullscreened: bool) -> Self {
1384 Self {
1385 builder: self.builder.property("fullscreened", fullscreened),
1386 }
1387 }
1388
1389 /// The gravity to use when resizing the window programmatically.
1390 ///
1391 /// Gravity describes which point of the window we want to keep
1392 /// fixed (meaning that the window will grow in the opposite direction).
1393 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
1394 /// want the to fix top right corner of the window.
1395 #[cfg(feature = "v4_20")]
1396 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1397 pub fn gravity(self, gravity: WindowGravity) -> Self {
1398 Self {
1399 builder: self.builder.property("gravity", gravity),
1400 }
1401 }
1402
1403 /// Whether the window frame should handle <kbd>F10</kbd> for activating
1404 /// menubars.
1405 #[cfg(feature = "v4_2")]
1406 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1407 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1408 Self {
1409 builder: self
1410 .builder
1411 .property("handle-menubar-accel", handle_menubar_accel),
1412 }
1413 }
1414
1415 /// If this window should be hidden instead of destroyed when the user clicks
1416 /// the close button.
1417 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1418 Self {
1419 builder: self.builder.property("hide-on-close", hide_on_close),
1420 }
1421 }
1422
1423 /// Specifies the name of the themed icon to use as the window icon.
1424 ///
1425 /// See [`IconTheme`][crate::IconTheme] for more details.
1426 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1427 Self {
1428 builder: self.builder.property("icon-name", icon_name.into()),
1429 }
1430 }
1431
1432 /// Whether the window is maximized.
1433 ///
1434 /// Setting this property is the equivalent of calling
1435 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1436 /// either operation is asynchronous, which means you will need to
1437 /// connect to the ::notify signal in order to know whether the
1438 /// operation was successful.
1439 pub fn maximized(self, maximized: bool) -> Self {
1440 Self {
1441 builder: self.builder.property("maximized", maximized),
1442 }
1443 }
1444
1445 /// Whether mnemonics are currently visible in this window.
1446 ///
1447 /// This property is maintained by GTK based on user input,
1448 /// and should not be set by applications.
1449 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1450 Self {
1451 builder: self
1452 .builder
1453 .property("mnemonics-visible", mnemonics_visible),
1454 }
1455 }
1456
1457 /// If true, the window is modal.
1458 pub fn modal(self, modal: bool) -> Self {
1459 Self {
1460 builder: self.builder.property("modal", modal),
1461 }
1462 }
1463
1464 /// If true, users can resize the window.
1465 pub fn resizable(self, resizable: bool) -> Self {
1466 Self {
1467 builder: self.builder.property("resizable", resizable),
1468 }
1469 }
1470
1471 /// A write-only property for setting window's startup notification identifier.
1472 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1473 Self {
1474 builder: self.builder.property("startup-id", startup_id.into()),
1475 }
1476 }
1477
1478 /// The title of the window.
1479 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1480 Self {
1481 builder: self.builder.property("title", title.into()),
1482 }
1483 }
1484
1485 /// The titlebar widget.
1486 #[cfg(feature = "v4_6")]
1487 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1488 pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1489 Self {
1490 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1491 }
1492 }
1493
1494 /// The transient parent of the window.
1495 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1496 Self {
1497 builder: self
1498 .builder
1499 .property("transient-for", transient_for.clone().upcast()),
1500 }
1501 }
1502
1503 /// Whether the widget or any of its descendents can accept
1504 /// the input focus.
1505 ///
1506 /// This property is meant to be set by widget implementations,
1507 /// typically in their instance init function.
1508 pub fn can_focus(self, can_focus: bool) -> Self {
1509 Self {
1510 builder: self.builder.property("can-focus", can_focus),
1511 }
1512 }
1513
1514 /// Whether the widget can receive pointer events.
1515 pub fn can_target(self, can_target: bool) -> Self {
1516 Self {
1517 builder: self.builder.property("can-target", can_target),
1518 }
1519 }
1520
1521 /// A list of css classes applied to this widget.
1522 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1523 Self {
1524 builder: self.builder.property("css-classes", css_classes.into()),
1525 }
1526 }
1527
1528 /// The name of this widget in the CSS tree.
1529 ///
1530 /// This property is meant to be set by widget implementations,
1531 /// typically in their instance init function.
1532 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1533 Self {
1534 builder: self.builder.property("css-name", css_name.into()),
1535 }
1536 }
1537
1538 /// The cursor used by @widget.
1539 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1540 Self {
1541 builder: self.builder.property("cursor", cursor.clone()),
1542 }
1543 }
1544
1545 /// Whether the widget should grab focus when it is clicked with the mouse.
1546 ///
1547 /// This property is only relevant for widgets that can take focus.
1548 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1549 Self {
1550 builder: self.builder.property("focus-on-click", focus_on_click),
1551 }
1552 }
1553
1554 /// Whether this widget itself will accept the input focus.
1555 pub fn focusable(self, focusable: bool) -> Self {
1556 Self {
1557 builder: self.builder.property("focusable", focusable),
1558 }
1559 }
1560
1561 /// How to distribute horizontal space if widget gets extra space.
1562 pub fn halign(self, halign: Align) -> Self {
1563 Self {
1564 builder: self.builder.property("halign", halign),
1565 }
1566 }
1567
1568 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1569 /// signal on @widget.
1570 ///
1571 /// A true value indicates that @widget can have a tooltip, in this case
1572 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1573 /// determine whether it will provide a tooltip or not.
1574 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1575 Self {
1576 builder: self.builder.property("has-tooltip", has_tooltip),
1577 }
1578 }
1579
1580 /// Overrides for height request of the widget.
1581 ///
1582 /// If this is -1, the natural request will be used.
1583 pub fn height_request(self, height_request: i32) -> Self {
1584 Self {
1585 builder: self.builder.property("height-request", height_request),
1586 }
1587 }
1588
1589 /// Whether to expand horizontally.
1590 pub fn hexpand(self, hexpand: bool) -> Self {
1591 Self {
1592 builder: self.builder.property("hexpand", hexpand),
1593 }
1594 }
1595
1596 /// Whether to use the `hexpand` property.
1597 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1598 Self {
1599 builder: self.builder.property("hexpand-set", hexpand_set),
1600 }
1601 }
1602
1603 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1604 /// the preferred size of the widget, and allocate its children.
1605 ///
1606 /// This property is meant to be set by widget implementations,
1607 /// typically in their instance init function.
1608 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1609 Self {
1610 builder: self
1611 .builder
1612 .property("layout-manager", layout_manager.clone().upcast()),
1613 }
1614 }
1615
1616 /// Makes this widget act like a modal dialog, with respect to
1617 /// event delivery.
1618 ///
1619 /// Global event controllers will not handle events with targets
1620 /// inside the widget, unless they are set up to ignore propagation
1621 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1622 #[cfg(feature = "v4_18")]
1623 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1624 pub fn limit_events(self, limit_events: bool) -> Self {
1625 Self {
1626 builder: self.builder.property("limit-events", limit_events),
1627 }
1628 }
1629
1630 /// Margin on bottom side of widget.
1631 ///
1632 /// This property adds margin outside of the widget's normal size
1633 /// request, the margin will be added in addition to the size from
1634 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1635 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1636 Self {
1637 builder: self.builder.property("margin-bottom", margin_bottom),
1638 }
1639 }
1640
1641 /// Margin on end of widget, horizontally.
1642 ///
1643 /// This property supports left-to-right and right-to-left text
1644 /// directions.
1645 ///
1646 /// This property adds margin outside of the widget's normal size
1647 /// request, the margin will be added in addition to the size from
1648 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1649 pub fn margin_end(self, margin_end: i32) -> Self {
1650 Self {
1651 builder: self.builder.property("margin-end", margin_end),
1652 }
1653 }
1654
1655 /// Margin on start of widget, horizontally.
1656 ///
1657 /// This property supports left-to-right and right-to-left text
1658 /// directions.
1659 ///
1660 /// This property adds margin outside of the widget's normal size
1661 /// request, the margin will be added in addition to the size from
1662 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1663 pub fn margin_start(self, margin_start: i32) -> Self {
1664 Self {
1665 builder: self.builder.property("margin-start", margin_start),
1666 }
1667 }
1668
1669 /// Margin on top side of widget.
1670 ///
1671 /// This property adds margin outside of the widget's normal size
1672 /// request, the margin will be added in addition to the size from
1673 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1674 pub fn margin_top(self, margin_top: i32) -> Self {
1675 Self {
1676 builder: self.builder.property("margin-top", margin_top),
1677 }
1678 }
1679
1680 /// The name of the widget.
1681 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1682 Self {
1683 builder: self.builder.property("name", name.into()),
1684 }
1685 }
1686
1687 /// The requested opacity of the widget.
1688 pub fn opacity(self, opacity: f64) -> Self {
1689 Self {
1690 builder: self.builder.property("opacity", opacity),
1691 }
1692 }
1693
1694 /// How content outside the widget's content area is treated.
1695 ///
1696 /// This property is meant to be set by widget implementations,
1697 /// typically in their instance init function.
1698 pub fn overflow(self, overflow: Overflow) -> Self {
1699 Self {
1700 builder: self.builder.property("overflow", overflow),
1701 }
1702 }
1703
1704 /// Whether the widget will receive the default action when it is focused.
1705 pub fn receives_default(self, receives_default: bool) -> Self {
1706 Self {
1707 builder: self.builder.property("receives-default", receives_default),
1708 }
1709 }
1710
1711 /// Whether the widget responds to input.
1712 pub fn sensitive(self, sensitive: bool) -> Self {
1713 Self {
1714 builder: self.builder.property("sensitive", sensitive),
1715 }
1716 }
1717
1718 /// Sets the text of tooltip to be the given string, which is marked up
1719 /// with Pango markup.
1720 ///
1721 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1722 ///
1723 /// This is a convenience property which will take care of getting the
1724 /// tooltip shown if the given string is not `NULL`:
1725 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1726 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1727 /// the default signal handler.
1728 ///
1729 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1730 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1731 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1732 Self {
1733 builder: self
1734 .builder
1735 .property("tooltip-markup", tooltip_markup.into()),
1736 }
1737 }
1738
1739 /// Sets the text of tooltip to be the given string.
1740 ///
1741 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1742 ///
1743 /// This is a convenience property which will take care of getting the
1744 /// tooltip shown if the given string is not `NULL`:
1745 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1746 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1747 /// the default signal handler.
1748 ///
1749 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1750 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1751 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1752 Self {
1753 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1754 }
1755 }
1756
1757 /// How to distribute vertical space if widget gets extra space.
1758 pub fn valign(self, valign: Align) -> Self {
1759 Self {
1760 builder: self.builder.property("valign", valign),
1761 }
1762 }
1763
1764 /// Whether to expand vertically.
1765 pub fn vexpand(self, vexpand: bool) -> Self {
1766 Self {
1767 builder: self.builder.property("vexpand", vexpand),
1768 }
1769 }
1770
1771 /// Whether to use the `vexpand` property.
1772 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1773 Self {
1774 builder: self.builder.property("vexpand-set", vexpand_set),
1775 }
1776 }
1777
1778 /// Whether the widget is visible.
1779 pub fn visible(self, visible: bool) -> Self {
1780 Self {
1781 builder: self.builder.property("visible", visible),
1782 }
1783 }
1784
1785 /// Overrides for width request of the widget.
1786 ///
1787 /// If this is -1, the natural request will be used.
1788 pub fn width_request(self, width_request: i32) -> Self {
1789 Self {
1790 builder: self.builder.property("width-request", width_request),
1791 }
1792 }
1793
1794 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1795 ///
1796 /// The accessible role cannot be changed once set.
1797 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1798 Self {
1799 builder: self.builder.property("accessible-role", accessible_role),
1800 }
1801 }
1802
1803 // rustdoc-stripper-ignore-next
1804 /// Build the [`PrintUnixDialog`].
1805 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1806 pub fn build(self) -> PrintUnixDialog {
1807 assert_initialized_main_thread!();
1808 self.builder.build()
1809 }
1810}