gtk4/auto/
print_setup.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, PageSetup, PrintSettings};
6use glib::translate::*;
7
8glib::wrapper! {
9    /// An auxiliary object for printing that allows decoupling the setup from the printing.
10    ///
11    /// A print setup is obtained by calling [`PrintDialog::setup()`][crate::PrintDialog::setup()],
12    /// and can later be passed to print functions such as [`PrintDialog::print()`][crate::PrintDialog::print()].
13    ///
14    /// Print setups can be reused for multiple print calls.
15    ///
16    /// Applications may wish to store the page_setup and print_settings from the print setup
17    /// and copy them to the PrintDialog if they want to keep using them.
18    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
19    pub struct PrintSetup(Shared<ffi::GtkPrintSetup>);
20
21    match fn {
22        ref => |ptr| ffi::gtk_print_setup_ref(ptr),
23        unref => |ptr| ffi::gtk_print_setup_unref(ptr),
24        type_ => || ffi::gtk_print_setup_get_type(),
25    }
26}
27
28impl PrintSetup {
29    /// Returns the page setup of @self.
30    ///
31    /// It may be different from the [`PrintDialog`][crate::PrintDialog]'s page setup
32    /// if the user changed it during the setup process.
33    ///
34    /// # Returns
35    ///
36    /// the page setup, or `NULL`
37    #[doc(alias = "gtk_print_setup_get_page_setup")]
38    #[doc(alias = "get_page_setup")]
39    pub fn page_setup(&self) -> PageSetup {
40        unsafe { from_glib_none(ffi::gtk_print_setup_get_page_setup(self.to_glib_none().0)) }
41    }
42
43    /// Returns the print settings of @self.
44    ///
45    /// They may be different from the [`PrintDialog`][crate::PrintDialog]'s settings
46    /// if the user changed them during the setup process.
47    ///
48    /// # Returns
49    ///
50    /// the print settings, or `NULL`
51    #[doc(alias = "gtk_print_setup_get_print_settings")]
52    #[doc(alias = "get_print_settings")]
53    pub fn print_settings(&self) -> PrintSettings {
54        unsafe {
55            from_glib_none(ffi::gtk_print_setup_get_print_settings(
56                self.to_glib_none().0,
57            ))
58        }
59    }
60}