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