[]Struct gtk::PageSetup

pub struct PageSetup(_, _);

A PageSetup object stores the page size, orientation and margins. The idea is that you can get one of these from the page setup dialog and then pass it to the PrintOperation when printing. The benefit of splitting this out of the PrintSettings is that these affect the actual layout of the page, and thus need to be set long before user prints.

Margins ## {print-margins}

The margins specified in this object are the “print margins”, i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.

To obtain a PageSetup use PageSetup::new to get the defaults, or use gtk_print_run_page_setup_dialog to show the page setup dialog and receive the resulting page setup.

A page setup dialog

static GtkPrintSettings *settings = NULL;
static GtkPageSetup *page_setup = NULL;

static void
do_page_setup (void)
{
  GtkPageSetup *new_page_setup;

  if (settings == NULL)
    settings = gtk_print_settings_new ();

  new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window),
                                                    page_setup, settings);

  if (page_setup)
    g_object_unref (page_setup);

  page_setup = new_page_setup;
}

Printing support was added in GTK+ 2.10.

Implements

glib::object::ObjectExt

Implementations

impl PageSetup[src]

pub fn new() -> PageSetup[src]

Creates a new PageSetup.

Returns

a new PageSetup.

pub fn from_file<P: AsRef<Path>>(file_name: P) -> Result<PageSetup, Error>[src]

pub fn from_gvariant(variant: &Variant) -> PageSetup[src]

pub fn from_key_file(
    key_file: &KeyFile,
    group_name: Option<&str>
) -> Result<PageSetup, Error>
[src]

pub fn copy(&self) -> Option<PageSetup>[src]

Copies a PageSetup.

Returns

a copy of self

pub fn get_bottom_margin(&self, unit: Unit) -> f64[src]

Gets the bottom margin in units of unit.

unit

the unit for the return value

Returns

the bottom margin

pub fn get_left_margin(&self, unit: Unit) -> f64[src]

Gets the left margin in units of unit.

unit

the unit for the return value

Returns

the left margin

pub fn get_orientation(&self) -> PageOrientation[src]

Gets the page orientation of the PageSetup.

Returns

the page orientation

pub fn get_page_height(&self, unit: Unit) -> f64[src]

Returns the page height in units of unit.

Note that this function takes orientation and margins into consideration. See PageSetup::get_paper_height.

unit

the unit for the return value

Returns

the page height.

pub fn get_page_width(&self, unit: Unit) -> f64[src]

Returns the page width in units of unit.

Note that this function takes orientation and margins into consideration. See PageSetup::get_paper_width.

unit

the unit for the return value

Returns

the page width.

pub fn get_paper_height(&self, unit: Unit) -> f64[src]

Returns the paper height in units of unit.

Note that this function takes orientation, but not margins into consideration. See PageSetup::get_page_height.

unit

the unit for the return value

Returns

the paper height.

pub fn get_paper_size(&self) -> PaperSize[src]

Gets the paper size of the PageSetup.

Returns

the paper size

pub fn get_paper_width(&self, unit: Unit) -> f64[src]

Returns the paper width in units of unit.

Note that this function takes orientation, but not margins into consideration. See PageSetup::get_page_width.

unit

the unit for the return value

Returns

the paper width.

pub fn get_right_margin(&self, unit: Unit) -> f64[src]

Gets the right margin in units of unit.

unit

the unit for the return value

Returns

the right margin

pub fn get_top_margin(&self, unit: Unit) -> f64[src]

Gets the top margin in units of unit.

unit

the unit for the return value

Returns

the top margin

pub fn load_file<P: AsRef<Path>>(&self, file_name: P) -> Result<(), Error>[src]

Reads the page setup from the file file_name. See PageSetup::to_file.

file_name

the filename to read the page setup from

Returns

true on success

pub fn load_key_file(
    &self,
    key_file: &KeyFile,
    group_name: Option<&str>
) -> Result<(), Error>
[src]

Reads the page setup from the group group_name in the key file key_file.

key_file

the glib::KeyFile to retrieve the page_setup from

group_name

the name of the group in the key_file to read, or None to use the default name “Page Setup”

Returns

true on success

pub fn set_bottom_margin(&self, margin: f64, unit: Unit)[src]

Sets the bottom margin of the PageSetup.

margin

the new bottom margin in units of unit

unit

the units for margin

pub fn set_left_margin(&self, margin: f64, unit: Unit)[src]

Sets the left margin of the PageSetup.

margin

the new left margin in units of unit

unit

the units for margin

pub fn set_orientation(&self, orientation: PageOrientation)[src]

Sets the page orientation of the PageSetup.

orientation

a PageOrientation value

pub fn set_paper_size(&self, size: &PaperSize)[src]

Sets the paper size of the PageSetup without changing the margins. See PageSetup::set_paper_size_and_default_margins.

size

a PaperSize

pub fn set_paper_size_and_default_margins(&self, size: &PaperSize)[src]

Sets the paper size of the PageSetup and modifies the margins according to the new paper size.

size

a PaperSize

pub fn set_right_margin(&self, margin: f64, unit: Unit)[src]

Sets the right margin of the PageSetup.

margin

the new right margin in units of unit

unit

the units for margin

pub fn set_top_margin(&self, margin: f64, unit: Unit)[src]

Sets the top margin of the PageSetup.

margin

the new top margin in units of unit

unit

the units for margin

pub fn to_file<P: AsRef<Path>>(&self, file_name: P) -> Result<(), Error>[src]

This function saves the information from self to file_name.

file_name

the file to save to

Returns

true on success

pub fn to_gvariant(&self) -> Option<Variant>[src]

Serialize page setup to an a{sv} variant.

Feature: v3_22

Returns

a new, floating, glib::Variant

pub fn to_key_file(&self, key_file: &KeyFile, group_name: Option<&str>)[src]

This function adds the page setup from self to key_file.

key_file

the glib::KeyFile to save the page setup to

group_name

the group to add the settings to in key_file, or None to use the default name “Page Setup”

Trait Implementations

impl Clone for PageSetup

impl Debug for PageSetup

impl Default for PageSetup[src]

impl Display for PageSetup[src]

impl Eq for PageSetup

impl Hash for PageSetup

impl Ord for PageSetup

impl<T: ObjectType> PartialEq<T> for PageSetup

impl<T: ObjectType> PartialOrd<T> for PageSetup

impl StaticType for PageSetup

Auto Trait Implementations

impl RefUnwindSafe for PageSetup

impl !Send for PageSetup

impl !Sync for PageSetup

impl Unpin for PageSetup

impl UnwindSafe for PageSetup

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.