Stores page size, orientation and margins for printing.
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
*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; } ```
function Copy
(Self : not null access Gtk_Page_Setup_Record) return Gtk_Page_Setup
Copies a GtkPageSetup.
a copy of Other. Has transfer-ownership='full'.
function Get_Bottom_Margin
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Gets the bottom margin in units of Unit.
the unit for the return value
the bottom margin
function Get_Left_Margin
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Gets the left margin in units of Unit.
the unit for the return value
the left margin
function Get_Orientation
(Self : not null access Gtk_Page_Setup_Record)
return Gtk.Enums.Gtk_Page_Orientation
Gets the page orientation of the GtkPageSetup.
the page orientation
function Get_Page_Height
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Returns the page height in units of Unit. Note that this function takes orientation and margins into consideration. See [methodGtk.PageSetup.get_paper_height].
the unit for the return value
the page height.
function Get_Page_Width
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Returns the page width in units of Unit. Note that this function takes orientation and margins into consideration. See [methodGtk.PageSetup.get_paper_width].
the unit for the return value
the page width.
function Get_Paper_Height
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
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].
the unit for the return value
the paper height.
function Get_Paper_Size
(Self : not null access Gtk_Page_Setup_Record)
return Gtk.Paper_Size.Gtk_Paper_Size
Gets the paper size of the GtkPageSetup.
the paper size. Has transfer-ownership='none'.
function Get_Paper_Width
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
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].
the unit for the return value
the paper width.
function Get_Right_Margin
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Gets the right margin in units of Unit.
the unit for the return value
the right margin
function Get_Top_Margin
(Self : not null access Gtk_Page_Setup_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Gets the top margin in units of Unit.
the unit for the return value
the top margin
function Get_Type return Glib.GType
procedure Gtk_New (Self : out Gtk_Page_Setup)
Creates a new GtkPageSetup. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Gtk_New_From_File
(Self : out Gtk_Page_Setup;
File_Name : UTF8_String;
Error : out Glib.Error.GError)
Reads the page setup from the file File_Name. Returns a new GtkPageSetup object with the restored page setup, or null if an error occurred. See [methodGtk.PageSetup.to_file]. Initialize_From_File does nothing if the object was already created with another call to Initialize* or G_New.
the filename to read the page setup from
the return location for a recoverable error
procedure Gtk_New_From_Gvariant
(Self : out Gtk_Page_Setup;
Variant : Glib.Variant.Gvariant)
Desrialize a page setup from an a{sv} variant. The variant must be in the format produced by [methodGtk.PageSetup.to_gvariant]. Initialize_From_Gvariant does nothing if the object was already created with another call to Initialize* or G_New.
an a{sv} GVariant
procedure Gtk_New_From_Key_File
(Self : out Gtk_Page_Setup;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError)
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 null if an error occurred. Initialize_From_Key_File does nothing if the object was already created with another call to Initialize* or G_New.
the GKeyFile to retrieve the page_setup from
the name of the group in the key_file to read to use the default name "Page Setup"
the return location for a recoverable error
type Gtk_Page_Setup is access all Gtk_Page_Setup_Record'Class;
function Gtk_Page_Setup_New return Gtk_Page_Setup
Creates a new GtkPageSetup.
function Gtk_Page_Setup_New_From_File
(File_Name : UTF8_String;
Error : out Glib.Error.GError) return Gtk_Page_Setup
Reads the page setup from the file File_Name. Returns a new GtkPageSetup object with the restored page setup, or null if an error occurred. See [methodGtk.PageSetup.to_file].
the filename to read the page setup from
the return location for a recoverable error
function Gtk_Page_Setup_New_From_Gvariant
(Variant : Glib.Variant.Gvariant) return Gtk_Page_Setup
Desrialize a page setup from an a{sv} variant. The variant must be in the format produced by [methodGtk.PageSetup.to_gvariant].
an a{sv} GVariant
function Gtk_Page_Setup_New_From_Key_File
(Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError) return Gtk_Page_Setup
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 null if an error occurred.
the GKeyFile to retrieve the page_setup from
the name of the group in the key_file to read to use the default name "Page Setup"
the return location for a recoverable error
type Gtk_Page_Setup_Record is new GObject_Record with null record;
procedure Initialize (Self : not null access Gtk_Page_Setup_Record'Class)
Creates a new GtkPageSetup. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Initialize_From_File
(Self : not null access Gtk_Page_Setup_Record'Class;
File_Name : UTF8_String;
Error : out Glib.Error.GError)
Reads the page setup from the file File_Name. Returns a new GtkPageSetup object with the restored page setup, or null if an error occurred. See [methodGtk.PageSetup.to_file]. Initialize_From_File does nothing if the object was already created with another call to Initialize* or G_New.
the filename to read the page setup from
the return location for a recoverable error
procedure Initialize_From_Gvariant
(Self : not null access Gtk_Page_Setup_Record'Class;
Variant : Glib.Variant.Gvariant)
Desrialize a page setup from an a{sv} variant. The variant must be in the format produced by [methodGtk.PageSetup.to_gvariant]. Initialize_From_Gvariant does nothing if the object was already created with another call to Initialize* or G_New.
an a{sv} GVariant
procedure Initialize_From_Key_File
(Self : not null access Gtk_Page_Setup_Record'Class;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError)
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 null if an error occurred. Initialize_From_Key_File does nothing if the object was already created with another call to Initialize* or G_New.
the GKeyFile to retrieve the page_setup from
the name of the group in the key_file to read to use the default name "Page Setup"
the return location for a recoverable error
function Load_File
(Self : not null access Gtk_Page_Setup_Record;
File_Name : UTF8_String;
Error : out Glib.Error.GError) return Boolean
Reads the page setup from the file File_Name. See [methodGtk.PageSetup.to_file].
the filename to read the page setup from
the return location for a recoverable error
True on success
function Load_Key_File
(Self : not null access Gtk_Page_Setup_Record;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError) return Boolean
Reads the page setup from the group Group_Name in the key file Key_File.
the GKeyFile to retrieve the page_setup from
the name of the group in the key_file to read to use the default name "Page Setup"
the return location for a recoverable error
True on success
procedure Set_Bottom_Margin
(Self : not null access Gtk_Page_Setup_Record;
Margin : Gdouble;
Unit : Gtk.Enums.Gtk_Unit)
Sets the bottom margin of the GtkPageSetup.
the new bottom margin in units of Unit
the units for Margin
procedure Set_Left_Margin
(Self : not null access Gtk_Page_Setup_Record;
Margin : Gdouble;
Unit : Gtk.Enums.Gtk_Unit)
Sets the left margin of the GtkPageSetup.
the new left margin in units of Unit
the units for Margin
procedure Set_Orientation
(Self : not null access Gtk_Page_Setup_Record;
Orientation : Gtk.Enums.Gtk_Page_Orientation)
Sets the page orientation of the GtkPageSetup.
a GtkPageOrientation value
procedure Set_Paper_Size
(Self : not null access Gtk_Page_Setup_Record;
Size : Gtk.Paper_Size.Gtk_Paper_Size)
Sets the paper size of the GtkPageSetup without changing the margins. See [methodGtk.PageSetup.set_paper_size_and_default_margins].
a GtkPaperSize
procedure Set_Paper_Size_And_Default_Margins
(Self : not null access Gtk_Page_Setup_Record;
Size : Gtk.Paper_Size.Gtk_Paper_Size)
Sets the paper size of the GtkPageSetup and modifies the margins according to the new paper size.
a GtkPaperSize
procedure Set_Right_Margin
(Self : not null access Gtk_Page_Setup_Record;
Margin : Gdouble;
Unit : Gtk.Enums.Gtk_Unit)
Sets the right margin of the GtkPageSetup.
the new right margin in units of Unit
the units for Margin
procedure Set_Top_Margin
(Self : not null access Gtk_Page_Setup_Record;
Margin : Gdouble;
Unit : Gtk.Enums.Gtk_Unit)
Sets the top margin of the GtkPageSetup.
the new top margin in units of Unit
the units for Margin
function To_File
(Self : not null access Gtk_Page_Setup_Record;
File_Name : UTF8_String;
Error : out Glib.Error.GError) return Boolean
This function saves the information from Setup to File_Name.
the file to save to
the return location for a recoverable error
True on success
function To_Gvariant
(Self : not null access Gtk_Page_Setup_Record)
return Glib.Variant.Gvariant
Serialize page setup to an a{sv} variant.
a new, floating, GVariant. Has transfer-ownership='none'.
procedure To_Key_File
(Self : not null access Gtk_Page_Setup_Record;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "")
This function adds the page setup from Setup to Key_File.
the GKeyFile to save the page setup to
the group to add the settings to in Key_File, or null to use the default name "Page Setup"