Struct gtk::PageSetup [−][src]
pub struct PageSetup(_);
Expand description
A GtkPageSetup 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 new()
to get the defaults,
or use print_run_page_setup_dialog()
to show the page setup dialog
and receive the resulting page setup.
A page setup dialog
⚠️ The following code is in C ⚠️
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
Implementations
This is supported on crate feature v3_22
only.
v3_22
only.Desrialize a page setup from an a{sv} variant in
the format produced by to_gvariant()
.
variant
an a{sv} glib::Variant
Returns
a new PageSetup
object
Reads the page setup from the group group_name
in the key file
key_file
. Returns a new PageSetup
object with the restored
page setup, or None
if an error occurred.
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
the restored PageSetup
Returns the page height in units of unit
.
Note that this function takes orientation and
margins into consideration.
See paper_height()
.
unit
the unit for the return value
Returns
the page height.
Returns the page width in units of unit
.
Note that this function takes orientation and
margins into consideration.
See paper_width()
.
unit
the unit for the return value
Returns
the page width.
Returns the paper height in units of unit
.
Note that this function takes orientation, but
not margins into consideration.
See page_height()
.
unit
the unit for the return value
Returns
the paper height.
Returns the paper width in units of unit
.
Note that this function takes orientation, but
not margins into consideration.
See page_width()
.
unit
the unit for the return value
Returns
the paper width.
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
Sets the paper size of the PageSetup
without
changing the margins. See
set_paper_size_and_default_margins()
.
size
This is supported on crate feature v3_22
only.
v3_22
only.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
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for PageSetup
impl UnwindSafe for PageSetup
Blanket Implementations
Mutably borrows from an owned value. Read more
Upcasts an object to a superclass or interface T
. Read more
Upcasts an object to a reference of its superclass or interface T
. Read more
Tries to downcast to a subclass or interface implementor T
. Read more
Tries to downcast to a reference of its subclass or interface implementor T
. Read more
Tries to cast to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Tries to cast to reference to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Casts to T
unconditionally. Read more
Casts to &T
unconditionally. Read more
Returns true
if the object is an instance of (can be cast to) T
.
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
V: ToValue,
N: Into<&'a str>,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,
N: Into<&'a str>,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + 'static,
N: Into<&'a str>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
N: Into<&'a str>,
Same as connect_unsafe
but takes a SignalId
instead of a signal name.
Emit signal by signal id.
Emit signal with details by signal id.
Emit signal by it’s name.
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
N: Into<&'a str>,
M: Into<&'a str>,
Same as emit
but takes Value
for the arguments.
Same as emit_by_name
but takes Value
for the arguments.
Returns a SendValue
clone of self
.
impl<'a, T, C> FromValueOptional<'a> for T where
C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError>,
T: FromValue<'a, Checker = C>,