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