Class: Gtk::PageSetup
- Inherits:
-
Object
- Object
- Gtk::PageSetup
- Defined in:
- (unknown)
Overview
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 GtkPrintOperation when printing.
The benefit of splitting this out of the GtkPrintSettings 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 GtkPageSetup use [ctorGtk.PageSetup.new] to get the defaults,
or use [funcGtk.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;
}
Instance Method Summary collapse
-
#copy ⇒ Gtk::PageSetup
Copies a
GtkPageSetup. -
#get_bottom_margin(unit) ⇒ Float
Gets the bottom margin in units of unit.
-
#get_left_margin(unit) ⇒ Float
Gets the left margin in units of unit.
-
#get_page_height(unit) ⇒ Float
Returns the page height in units of unit.
-
#get_page_width(unit) ⇒ Float
Returns the page width in units of unit.
-
#get_paper_height(unit) ⇒ Float
Returns the paper height in units of unit.
-
#get_paper_width(unit) ⇒ Float
Returns the paper width in units of unit.
-
#get_right_margin(unit) ⇒ Float
Gets the right margin in units of unit.
-
#get_top_margin(unit) ⇒ Float
Gets the top margin in units of unit.
-
#initialize(key_file, group_name) ⇒ Gtk::PageSetup
constructor
Reads the page setup from the group group_name in the key file key_file.
-
#load_file(file_name) ⇒ Boolean
Reads the page setup from the file file_name.
-
#load_key_file(key_file, group_name) ⇒ Boolean
Reads the page setup from the group group_name in the key file key_file.
-
#orientation ⇒ Gtk::PageOrientation
Gets the page orientation of the
GtkPageSetup. -
#orientation=(orientation) ⇒ nil
Sets the page orientation of the
GtkPageSetup. -
#paper_size ⇒ Gtk::PaperSize
Gets the paper size of the
GtkPageSetup. -
#paper_size=(size) ⇒ nil
Sets the paper size of the
GtkPageSetupwithout changing the margins. -
#paper_size_and_default_margins=(size) ⇒ nil
Sets the paper size of the
GtkPageSetupand modifies the margins according to the new paper size. -
#set_bottom_margin(margin, unit) ⇒ nil
Sets the bottom margin of the
GtkPageSetup. -
#set_left_margin(margin, unit) ⇒ nil
Sets the left margin of the
GtkPageSetup. -
#set_right_margin(margin, unit) ⇒ nil
Sets the right margin of the
GtkPageSetup. -
#set_top_margin(margin, unit) ⇒ nil
Sets the top margin of the
GtkPageSetup. -
#to_file(file_name) ⇒ Boolean
This function saves the information from setup to file_name.
-
#to_gvariant ⇒ GLib::Variant
Serialize page setup to an asv variant.
-
#to_key_file(key_file, group_name) ⇒ nil
This function adds the page setup from setup to key_file.
Constructor Details
#initialize(key_file, group_name) ⇒ Gtk::PageSetup
Reads the page setup from the group group_name in the key file key_file.
Returns a new GtkPageSetup object with the restored
page setup, or nil if an error occurred.
Instance Method Details
#copy ⇒ Gtk::PageSetup
Copies a GtkPageSetup.
#get_bottom_margin(unit) ⇒ Float
Gets the bottom margin in units of unit.
#get_left_margin(unit) ⇒ Float
Gets the left margin in units of unit.
#get_page_height(unit) ⇒ Float
Returns the page height in units of unit.
Note that this function takes orientation and margins into consideration. See [methodGtk.PageSetup.get_paper_height].
#get_page_width(unit) ⇒ Float
Returns the page width in units of unit.
Note that this function takes orientation and margins into consideration. See [methodGtk.PageSetup.get_paper_width].
#get_paper_height(unit) ⇒ Float
Returns the paper height in units of unit.
Note that this function takes orientation, but not margins into consideration. See [methodGtk.PageSetup.get_page_height].
#get_paper_width(unit) ⇒ Float
Returns the paper width in units of unit.
Note that this function takes orientation, but not margins into consideration. See [methodGtk.PageSetup.get_page_width].
#get_right_margin(unit) ⇒ Float
Gets the right margin in units of unit.
#get_top_margin(unit) ⇒ Float
Gets the top margin in units of unit.
#load_file(file_name) ⇒ Boolean
Reads the page setup from the file file_name.
See [methodGtk.PageSetup.to_file].
#load_key_file(key_file, group_name) ⇒ Boolean
Reads the page setup from the group group_name in the key file key_file.
#orientation ⇒ Gtk::PageOrientation
Gets the page orientation of the GtkPageSetup.
#orientation=(orientation) ⇒ nil
Sets the page orientation of the GtkPageSetup.
#paper_size ⇒ Gtk::PaperSize
Gets the paper size of the GtkPageSetup.
#paper_size=(size) ⇒ nil
Sets the paper size of the GtkPageSetup without
changing the margins.
See [methodGtk.PageSetup.set_paper_size_and_default_margins].
#paper_size_and_default_margins=(size) ⇒ nil
Sets the paper size of the GtkPageSetup and modifies
the margins according to the new paper size.
#set_bottom_margin(margin, unit) ⇒ nil
Sets the bottom margin of the GtkPageSetup.
#set_left_margin(margin, unit) ⇒ nil
Sets the left margin of the GtkPageSetup.
#set_right_margin(margin, unit) ⇒ nil
Sets the right margin of the GtkPageSetup.
#set_top_margin(margin, unit) ⇒ nil
Sets the top margin of the GtkPageSetup.
#to_file(file_name) ⇒ Boolean
This function saves the information from setup to file_name.
#to_gvariant ⇒ GLib::Variant
Serialize page setup to an asv variant.
#to_key_file(key_file, group_name) ⇒ nil
This function adds the page setup from setup to key_file.