[]Struct gtk::PaperSize

pub struct PaperSize(_);

PaperSize handles paper sizes. It uses the standard called PWG 5101.1-2002 PWG: Standard for Media Standardized Names to name the paper sizes (and to get the data for the page sizes). In addition to standard paper sizes, PaperSize allows to construct custom paper sizes with arbitrary dimensions.

The PaperSize object stores not only the dimensions (width and height) of a paper size and its name, it also provides default [print margins][print-margins].

Printing support has been added in GTK+ 2.10.

Implementations

impl PaperSize[src]

pub fn new(name: Option<&str>) -> PaperSize[src]

Creates a new PaperSize object by parsing a PWG 5101.1-2002 paper name.

If name is None, the default paper size is returned, see PaperSize::get_default.

name

a paper size name, or None

Returns

a new PaperSize, use PaperSize::free to free it

pub fn new_custom(
    name: &str,
    display_name: &str,
    width: f64,
    height: f64,
    unit: Unit
) -> PaperSize
[src]

Creates a new PaperSize object with the given parameters.

name

the paper name

display_name

the human-readable name

width

the paper width, in units of unit

height

the paper height, in units of unit

unit

the unit for width and height. not Unit::None.

Returns

a new PaperSize object, use PaperSize::free to free it

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

pub fn from_ipp(ipp_name: &str, width: f64, height: f64) -> PaperSize[src]

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

pub fn from_ppd(
    ppd_name: &str,
    ppd_display_name: &str,
    width: f64,
    height: f64
) -> PaperSize
[src]

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

Gets the default bottom margin for the PaperSize.

unit

the unit for the return value, not Unit::None

Returns

the default bottom margin

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

Gets the default left margin for the PaperSize.

unit

the unit for the return value, not Unit::None

Returns

the default left margin

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

Gets the default right margin for the PaperSize.

unit

the unit for the return value, not Unit::None

Returns

the default right margin

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

Gets the default top margin for the PaperSize.

unit

the unit for the return value, not Unit::None

Returns

the default top margin

pub fn get_display_name(&self) -> Option<GString>[src]

Gets the human-readable name of the PaperSize.

Returns

the human-readable name of self

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

Gets the paper height of the PaperSize, in units of unit.

unit

the unit for the return value, not Unit::None

Returns

the paper height

pub fn get_name(&self) -> Option<GString>[src]

Gets the name of the PaperSize.

Returns

the name of self

pub fn get_ppd_name(&self) -> Option<GString>[src]

Gets the PPD name of the PaperSize, which may be None.

Returns

the PPD name of self

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

Gets the paper width of the PaperSize, in units of unit.

unit

the unit for the return value, not Unit::None

Returns

the paper width

pub fn is_custom(&self) -> bool[src]

Returns true if self is not a standard paper size.

Returns

whether self is a custom paper size.

pub fn is_ipp(&self) -> bool[src]

Returns true if self is an IPP standard paper size.

Returns

whether self is not an IPP custom paper size.

pub fn set_size(&mut self, width: f64, height: f64, unit: Unit)[src]

Changes the dimensions of a self to width x height.

width

the new width in units of unit

height

the new height in units of unit

unit

the unit for width and height

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

Serialize a paper size to an a{sv} variant.

Feature: v3_22

Returns

a new, floating, glib::Variant

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

This function adds the paper size from self to key_file.

key_file

the glib::KeyFile to save the paper size to

group_name

the group to add the settings to in key_file

pub fn get_default() -> Option<GString>[src]

Returns the name of the default paper size, which depends on the current locale.

Returns

the name of the default paper size. The string is owned by GTK+ and should not be modified.

pub fn get_paper_sizes(include_custom: bool) -> Vec<PaperSize>[src]

Creates a list of known paper sizes.

include_custom

whether to include custom paper sizes as defined in the page setup dialog

Returns

a newly allocated list of newly allocated PaperSize objects

Trait Implementations

impl Clone for PaperSize

impl Debug for PaperSize[src]

impl Eq for PaperSize[src]

impl Hash for PaperSize[src]

impl Ord for PaperSize[src]

impl PartialEq<PaperSize> for PaperSize[src]

impl PartialOrd<PaperSize> for PaperSize[src]

impl StaticType for PaperSize

Auto Trait Implementations

impl RefUnwindSafe for PaperSize

impl !Send for PaperSize

impl !Sync for PaperSize

impl Unpin for PaperSize

impl UnwindSafe for PaperSize

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<T> From<T> for T[src]

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

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> 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.