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