class Gtk::PageSetup
- Gtk::PageSetup
- GObject::Object
- Reference
- Object
Overview
A Gtk::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 Gtk::PrintOperation
when printing.
The benefit of splitting this out of the Gtk::PrintSettings
is that
these affect the actual layout of the page, and thus need to be set
long before user prints.
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 Gtk::PageSetup
use Gtk::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
WARNING ⚠️ The following code is in c ⚠️
static Gtk::PrintSettings *settings = NULL;
static Gtk::PageSetup *page_setup = NULL;
static void
do_page_setup (void)
{
Gtk::PageSetup *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;
}
Defined in:
lib/gi-crystal/src/auto/gtk-4.0/page_setup.crConstructors
-
.new : self
Creates a new
Gtk::PageSetup
. -
.new_from_file(file_name : String) : self
Reads the page setup from the file file_name.
-
.new_from_gvariant(variant : _) : self
Desrialize a page setup from an a{sv} variant.
-
.new_from_key_file(key_file : GLib::KeyFile, group_name : String | Nil) : self
Reads the page setup from the group group_name in the key file key_file.
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#bottom_margin(unit : Gtk::Unit) : Float64
Gets the bottom margin in units of unit.
-
#copy : Gtk::PageSetup
Copies a
Gtk::PageSetup
. -
#hash(hasher)
See
Object#hash(hasher)
-
#left_margin(unit : Gtk::Unit) : Float64
Gets the left margin in units of unit.
-
#load_file(file_name : String) : Bool
Reads the page setup from the file file_name.
-
#load_key_file(key_file : GLib::KeyFile, group_name : String | Nil) : Bool
Reads the page setup from the group group_name in the key file key_file.
-
#orientation : Gtk::PageOrientation
Gets the page orientation of the
Gtk::PageSetup
. -
#orientation=(orientation : Gtk::PageOrientation) : Nil
Sets the page orientation of the
Gtk::PageSetup
. -
#page_height(unit : Gtk::Unit) : Float64
Returns the page height in units of unit.
-
#page_width(unit : Gtk::Unit) : Float64
Returns the page width in units of unit.
-
#paper_height(unit : Gtk::Unit) : Float64
Returns the paper height in units of unit.
-
#paper_size : Gtk::PaperSize
Gets the paper size of the
Gtk::PageSetup
. -
#paper_size=(size : Gtk::PaperSize) : Nil
Sets the paper size of the
Gtk::PageSetup
without changing the margins. -
#paper_size_and_default_margins=(size : Gtk::PaperSize) : Nil
Sets the paper size of the
Gtk::PageSetup
and modifies the margins according to the new paper size. -
#paper_width(unit : Gtk::Unit) : Float64
Returns the paper width in units of unit.
-
#right_margin(unit : Gtk::Unit) : Float64
Gets the right margin in units of unit.
-
#set_bottom_margin(margin : Float64, unit : Gtk::Unit) : Nil
Sets the bottom margin of the
Gtk::PageSetup
. -
#set_left_margin(margin : Float64, unit : Gtk::Unit) : Nil
Sets the left margin of the
Gtk::PageSetup
. -
#set_right_margin(margin : Float64, unit : Gtk::Unit) : Nil
Sets the right margin of the
Gtk::PageSetup
. -
#set_top_margin(margin : Float64, unit : Gtk::Unit) : Nil
Sets the top margin of the
Gtk::PageSetup
. -
#to_file(file_name : String) : Bool
This function saves the information from setup to file_name.
-
#to_gvariant : GLib::Variant
Serialize page setup to an a{sv} variant.
-
#to_key_file(key_file : GLib::KeyFile, group_name : String | Nil) : Nil
This function adds the page setup from setup to key_file.
-
#top_margin(unit : Gtk::Unit) : Float64
Gets the top margin in units of unit.
Instance methods inherited from class GObject::Object
==(other : self)
==,
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void) | Nil
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
hash(hasher)
hash,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void) | Nil
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void) | Nil) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void) | Nil
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void) | Nil
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
cast?(obj : GObject::Object) : self | Nil
cast?,
compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Macros inherited from class GObject::Object
previous_vfunc(*args)
previous_vfunc,
previous_vfunc!(*args)
previous_vfunc!,
signal(signature)
signal
Constructor Detail
Reads the page setup from the file file_name.
Returns a new Gtk::PageSetup
object with the restored
page setup, or nil
if an error occurred.
See Gtk::PageSetup#to_file
.
Desrialize a page setup from an a{sv} variant.
The variant must be in the format produced by
Gtk::PageSetup#to_gvariant
.
Reads the page setup from the group group_name in the key file key_file.
Returns a new Gtk::PageSetup
object with the restored
page setup, or nil
if an error occurred.
Class Method Detail
Returns the type id (GType) registered in GLib type system.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Gets the bottom margin in units of unit.
Reads the page setup from the file file_name.
Reads the page setup from the group group_name in the key file key_file.
Sets the page orientation of the Gtk::PageSetup
.
Returns the page height in units of unit.
Note that this function takes orientation
and margins into consideration.
See Gtk::PageSetup#paper_height
.
Returns the page width in units of unit.
Note that this function takes orientation
and margins into consideration.
See Gtk::PageSetup#paper_width
.
Returns the paper height in units of unit.
Note that this function takes orientation,
but not margins into consideration.
See Gtk::PageSetup#page_height
.
Sets the paper size of the Gtk::PageSetup
without
changing the margins.
Sets the paper size of the Gtk::PageSetup
and modifies
the margins according to the new paper size.
Returns the paper width in units of unit.
Note that this function takes orientation,
but not margins into consideration.
See Gtk::PageSetup#page_width
.
Gets the right margin in units of unit.
Sets the bottom margin of the Gtk::PageSetup
.
Sets the left margin of the Gtk::PageSetup
.
Sets the right margin of the Gtk::PageSetup
.
Sets the top margin of the Gtk::PageSetup
.
This function saves the information from setup to file_name.
This function adds the page setup from setup to key_file.