[−]Struct gtk::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]
name: &str,
display_name: &str,
width: f64,
height: f64,
unit: Unit
) -> PaperSize
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]
key_file: &KeyFile,
group_name: Option<&str>
) -> Result<PaperSize, Error>
pub fn from_ppd(
ppd_name: &str,
ppd_display_name: &str,
width: f64,
height: f64
) -> PaperSize
[src]
ppd_name: &str,
ppd_display_name: &str,
width: f64,
height: f64
) -> PaperSize
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]
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]
pub fn get_ppd_name(&self) -> Option<GString>
[src]
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]
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]
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
fn clone(&self) -> PaperSize
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PaperSize
[src]
impl Eq for PaperSize
[src]
impl Hash for PaperSize
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for PaperSize
[src]
fn cmp(&self, other: &PaperSize) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<PaperSize> for PaperSize
[src]
impl PartialOrd<PaperSize> for PaperSize
[src]
fn partial_cmp(&self, other: &PaperSize) -> Option<Ordering>
[src]
fn lt(&self, other: &PaperSize) -> bool
[src]
fn le(&self, other: &PaperSize) -> bool
[src]
fn gt(&self, other: &PaperSize) -> bool
[src]
fn ge(&self, other: &PaperSize) -> bool
[src]
impl StaticType for PaperSize
fn static_type() -> Type
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToSendValue for T where
T: ToValue + SetValue + Send + ?Sized,
T: ToValue + SetValue + Send + ?Sized,
fn to_send_value(&self) -> SendValue
impl<T> ToValue for T where
T: SetValue + ?Sized,
T: SetValue + ?Sized,
fn to_value(&self) -> Value
fn to_value_type(&self) -> Type
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,