1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{PageSetup, PrintSettings};
use glib::translate::*;

glib::wrapper! {
    /// A [`PrintSetup`][crate::PrintSetup] is an auxiliary object for printing that allows decoupling
    /// the setup from the printing.
    ///
    /// A print setup is obtained by calling [`PrintDialog::setup()`][crate::PrintDialog::setup()],
    /// and can later be passed to print functions such as [`PrintDialog::print()`][crate::PrintDialog::print()].
    ///
    /// Print setups can be reused for multiple print calls.
    ///
    /// Applications may wish to store the page_setup and print_settings from the print setup
    /// and copy them to the PrintDialog if they want to keep using them.
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct PrintSetup(Shared<ffi::GtkPrintSetup>);

    match fn {
        ref => |ptr| ffi::gtk_print_setup_ref(ptr),
        unref => |ptr| ffi::gtk_print_setup_unref(ptr),
        type_ => || ffi::gtk_print_setup_get_type(),
    }
}

impl PrintSetup {
    /// Returns the page setup of @self.
    ///
    /// It may be different from the [`PrintDialog`][crate::PrintDialog]'s page setup
    /// if the user changed it during the setup process.
    ///
    /// # Returns
    ///
    /// the page setup, or `NULL`
    #[doc(alias = "gtk_print_setup_get_page_setup")]
    #[doc(alias = "get_page_setup")]
    pub fn page_setup(&self) -> Option<PageSetup> {
        unsafe { from_glib_none(ffi::gtk_print_setup_get_page_setup(self.to_glib_none().0)) }
    }

    /// Returns the print settings of @self.
    ///
    /// They may be different from the [`PrintDialog`][crate::PrintDialog]'s settings
    /// if the user changed them during the setup process.
    ///
    /// # Returns
    ///
    /// the print settings, or `NULL`
    #[doc(alias = "gtk_print_setup_get_print_settings")]
    #[doc(alias = "get_print_settings")]
    pub fn print_settings(&self) -> Option<PrintSettings> {
        unsafe {
            from_glib_none(ffi::gtk_print_setup_get_print_settings(
                self.to_glib_none().0,
            ))
        }
    }
}