Collects the settings of a print dialog in a system-independent way.
The main use for this object is that once you've printed you can get a settings object that represents the settings the user chose, and the next time you print you can pass that object in so that the user doesn't have to re-set all his settings.
Its also possible to enumerate the settings so that you can easily save the settings for the next time your app runs, or even store them in a document. The predefined keys try to use shared values as much as possible so that moving such a document between systems still works.
function Copy
(Self : not null access Gtk_Print_Settings_Record)
return Gtk_Print_Settings
Copies a GtkPrintSettings object.
a newly allocated copy of Other. Has transfer-ownership='full'.
procedure Foreach
(Self : not null access Gtk_Print_Settings_Record;
Func : Gtk_Print_Settings_Func)
Calls Func for each key-value pair of Settings.
the function to call
function Get
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String) return UTF8_String
Looks up the string value associated with Key.
a key
the string value for Key
function Get_Bool
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String) return Boolean
Returns the boolean represented by the value that is associated with Key. The string "true" represents True, any other string False.
a key
True, if Key maps to a true value.
function Get_Collate
(Self : not null access Gtk_Print_Settings_Record) return Boolean
Gets the value of GTK_PRINT_SETTINGS_COLLATE.
whether to collate the printed pages
function Get_Default_Source
(Self : not null access Gtk_Print_Settings_Record) return UTF8_String
Gets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
the default source
function Get_Dither
(Self : not null access Gtk_Print_Settings_Record) return UTF8_String
Gets the value of GTK_PRINT_SETTINGS_DITHER.
the dithering that is used
function Get_Double
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String) return Gdouble
Returns the double value associated with Key, or 0.
a key
the double value of Key
function Get_Double_With_Default
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Def : Gdouble) return Gdouble
Returns the floating point number represented by the value that is associated with Key, or Default_Val if the value does not represent a floating point number. Floating point numbers are parsed with g_ascii_strtod.
a key
the default value
the floating point number associated with Key
function Get_Duplex
(Self : not null access Gtk_Print_Settings_Record)
return Gtk.Enums.Gtk_Print_Duplex
Gets the value of GTK_PRINT_SETTINGS_DUPLEX.
whether to print the output in duplex.
function Get_Finishings
(Self : not null access Gtk_Print_Settings_Record) return UTF8_String
Gets the value of GTK_PRINT_SETTINGS_FINISHINGS.
the finishings
function Get_Int
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String) return Glib.Gint
Returns the integer value of Key, or 0.
a key
the integer value of Key
function Get_Int_With_Default
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Def : Glib.Gint) return Glib.Gint
Returns the value of Key, interpreted as an integer, or the default value.
a key
the default value
the integer value of Key
function Get_Length
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Returns the value associated with Key, interpreted as a length. The returned value is converted to Units.
a key
the unit of the return value
the length value of Key, converted to Unit
function Get_Media_Type
(Self : not null access Gtk_Print_Settings_Record) return UTF8_String
Gets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. The set of media types is defined in PWG 5101.1-2002 PWG.
the media type
function Get_N_Copies
(Self : not null access Gtk_Print_Settings_Record) return Glib.Gint
Gets the value of GTK_PRINT_SETTINGS_N_COPIES.
the number of copies to print
function Get_Number_Up
(Self : not null access Gtk_Print_Settings_Record) return Glib.Gint
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP.
the number of pages per sheet
function Get_Number_Up_Layout
(Self : not null access Gtk_Print_Settings_Record)
return Gtk.Enums.Gtk_Number_Up_Layout
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
layout of page in number-up mode
function Get_Orientation
(Self : not null access Gtk_Print_Settings_Record)
return Gtk.Enums.Gtk_Page_Orientation
Get the value of GTK_PRINT_SETTINGS_ORIENTATION, converted to a GtkPageOrientation.
the orientation
function Get_Output_Bin
(Self : not null access Gtk_Print_Settings_Record) return UTF8_String
Gets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.
the output bin
function Get_Page_Ranges
(Self : not null access Gtk_Print_Settings_Record)
return Page_Range_Array
Gets the value of GTK_PRINT_SETTINGS_PAGE_RANGES.
the page ranges, or an empty array if none is set
function Get_Page_Set
(Self : not null access Gtk_Print_Settings_Record)
return Gtk.Enums.Gtk_Page_Set
Gets the value of GTK_PRINT_SETTINGS_PAGE_SET.
the set of pages to print
function Get_Paper_Height
(Self : not null access Gtk_Print_Settings_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Gets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to Unit.
the unit for the return value
the paper height, in units of Unit
function Get_Paper_Size
(Self : not null access Gtk_Print_Settings_Record)
return Gtk.Paper_Size.Gtk_Paper_Size
Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a GtkPaperSize.
the paper size. Has transfer-ownership='full'.
function Get_Paper_Width
(Self : not null access Gtk_Print_Settings_Record;
Unit : Gtk.Enums.Gtk_Unit) return Gdouble
Gets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to Unit.
the unit for the return value
the paper width, in units of Unit
function Get_Print_Pages
(Self : not null access Gtk_Print_Settings_Record)
return Gtk.Enums.Gtk_Print_Pages
Gets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.
which pages to print
function Get_Printer
(Self : not null access Gtk_Print_Settings_Record) return UTF8_String
Convenience function to obtain the value of GTK_PRINT_SETTINGS_PRINTER.
the printer name
function Get_Printer_Lpi
(Self : not null access Gtk_Print_Settings_Record) return Gdouble
Gets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.
the resolution in lpi (lines per inch)
function Get_Quality
(Self : not null access Gtk_Print_Settings_Record)
return Gtk.Enums.Gtk_Print_Quality
Gets the value of GTK_PRINT_SETTINGS_QUALITY.
the print quality
function Get_Resolution
(Self : not null access Gtk_Print_Settings_Record) return Glib.Gint
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION.
the resolution in dpi
function Get_Resolution_X
(Self : not null access Gtk_Print_Settings_Record) return Glib.Gint
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_X.
the horizontal resolution in dpi
function Get_Resolution_Y
(Self : not null access Gtk_Print_Settings_Record) return Glib.Gint
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_Y.
the vertical resolution in dpi
function Get_Reverse
(Self : not null access Gtk_Print_Settings_Record) return Boolean
Gets the value of GTK_PRINT_SETTINGS_REVERSE.
whether to reverse the order of the printed pages
function Get_Scale
(Self : not null access Gtk_Print_Settings_Record) return Gdouble
Gets the value of GTK_PRINT_SETTINGS_SCALE.
the scale in percent
function Get_Type return Glib.GType
function Get_Use_Color
(Self : not null access Gtk_Print_Settings_Record) return Boolean
Gets the value of GTK_PRINT_SETTINGS_USE_COLOR.
whether to use color
procedure Gtk_New (Self : out Gtk_Print_Settings)
Creates a new GtkPrintSettings object. 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_Print_Settings;
File_Name : UTF8_String;
Error : out Glib.Error.GError)
Reads the print settings from File_Name. Returns a new GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either a GFileError or GKeyFileError. See [methodGtk.PrintSettings.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 settings from
the return location for a recoverable error
procedure Gtk_New_From_Gvariant
(Self : out Gtk_Print_Settings;
Variant : Glib.Variant.Gvariant)
Deserialize print settings from an a{sv} variant. The variant must be in the format produced by [methodGtk.PrintSettings.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_Print_Settings;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError)
Reads the print settings from the group Group_Name in Key_File. Returns a new GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either GFileError or GKeyFileError. 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 settings from
the name of the group to use, or null to use the default "Print Settings"
the return location for a recoverable error
type Gtk_Print_Settings is access all Gtk_Print_Settings_Record'Class;
type Gtk_Print_Settings_Func is access procedure (Key : UTF8_String; Value : UTF8_String);
Function called by [methodGtk.PrintSettings.foreach] on every key/value pair inside a [classGtk.PrintSettings].
the setting key
the setting value
function Gtk_Print_Settings_New return Gtk_Print_Settings
Creates a new GtkPrintSettings object.
function Gtk_Print_Settings_New_From_File
(File_Name : UTF8_String;
Error : out Glib.Error.GError) return Gtk_Print_Settings
Reads the print settings from File_Name. Returns a new GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either a GFileError or GKeyFileError. See [methodGtk.PrintSettings.to_file].
the filename to read the settings from
the return location for a recoverable error
function Gtk_Print_Settings_New_From_Gvariant
(Variant : Glib.Variant.Gvariant) return Gtk_Print_Settings
Deserialize print settings from an a{sv} variant. The variant must be in the format produced by [methodGtk.PrintSettings.to_gvariant].
an a{sv} GVariant
function Gtk_Print_Settings_New_From_Key_File
(Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError) return Gtk_Print_Settings
Reads the print settings from the group Group_Name in Key_File. Returns a new GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either GFileError or GKeyFileError.
the GKeyFile to retrieve the settings from
the name of the group to use, or null to use the default "Print Settings"
the return location for a recoverable error
type Gtk_Print_Settings_Record is new GObject_Record with null record;
function Has_Key
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String) return Boolean
Returns True, if a value is associated with Key.
a key
True, if Key has a value
procedure Initialize
(Self : not null access Gtk_Print_Settings_Record'Class)
Creates a new GtkPrintSettings object. 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_Print_Settings_Record'Class;
File_Name : UTF8_String;
Error : out Glib.Error.GError)
Reads the print settings from File_Name. Returns a new GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either a GFileError or GKeyFileError. See [methodGtk.PrintSettings.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 settings from
the return location for a recoverable error
procedure Initialize_From_Gvariant
(Self : not null access Gtk_Print_Settings_Record'Class;
Variant : Glib.Variant.Gvariant)
Deserialize print settings from an a{sv} variant. The variant must be in the format produced by [methodGtk.PrintSettings.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_Print_Settings_Record'Class;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError)
Reads the print settings from the group Group_Name in Key_File. Returns a new GtkPrintSettings object with the restored settings, or null if an error occurred. If the file could not be loaded then error is set to either GFileError or GKeyFileError. 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 settings from
the name of the group to use, or null to use the default "Print Settings"
the return location for a recoverable error
function Load_File
(Self : not null access Gtk_Print_Settings_Record;
File_Name : UTF8_String;
Error : out Glib.Error.GError) return Boolean
Reads the print settings from File_Name. If the file could not be loaded then error is set to either a GFileError or GKeyFileError. See [methodGtk.PrintSettings.to_file].
the filename to read the settings from
the return location for a recoverable error
True on success
function Load_Key_File
(Self : not null access Gtk_Print_Settings_Record;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "";
Error : out Glib.Error.GError) return Boolean
Reads the print settings from the group Group_Name in Key_File. If the file could not be loaded then error is set to either a GFileError or GKeyFileError.
the GKeyFile to retrieve the settings from
the name of the group to use, or null to use the default "Print Settings"
the return location for a recoverable error
True on success
type Page_Range is record
First, Last : Glib.gint;
end record;
type Page_Range_Array is array (Natural range <>) of Page_Range;
procedure Set
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Value : UTF8_String := "")
Associates Value with Key.
a key
a string value
procedure Set_Bool
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Value : Boolean)
Sets Key to a boolean value.
a key
a boolean
procedure Set_Collate
(Self : not null access Gtk_Print_Settings_Record;
Collate : Boolean)
Sets the value of GTK_PRINT_SETTINGS_COLLATE.
whether to collate the output
procedure Set_Default_Source
(Self : not null access Gtk_Print_Settings_Record;
Default_Source : UTF8_String)
Sets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
the default source
procedure Set_Dither
(Self : not null access Gtk_Print_Settings_Record;
Dither : UTF8_String)
Sets the value of GTK_PRINT_SETTINGS_DITHER.
the dithering that is used
procedure Set_Double
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Value : Gdouble)
Sets Key to a double value.
a key
a double value
procedure Set_Duplex
(Self : not null access Gtk_Print_Settings_Record;
Duplex : Gtk.Enums.Gtk_Print_Duplex)
Sets the value of GTK_PRINT_SETTINGS_DUPLEX.
a GtkPrintDuplex value
procedure Set_Finishings
(Self : not null access Gtk_Print_Settings_Record;
Finishings : UTF8_String)
Sets the value of GTK_PRINT_SETTINGS_FINISHINGS.
the finishings
procedure Set_Int
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Value : Glib.Gint)
Sets Key to an integer value.
a key
an integer
procedure Set_Length
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String;
Value : Gdouble;
Unit : Gtk.Enums.Gtk_Unit)
Associates a length in units of Unit with Key.
a key
a length
the unit of Length
procedure Set_Media_Type
(Self : not null access Gtk_Print_Settings_Record;
Media_Type : UTF8_String)
Sets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. The set of media types is defined in PWG 5101.1-2002 PWG.
the media type
procedure Set_N_Copies
(Self : not null access Gtk_Print_Settings_Record;
Num_Copies : Glib.Gint)
Sets the value of GTK_PRINT_SETTINGS_N_COPIES.
the number of copies
procedure Set_Number_Up
(Self : not null access Gtk_Print_Settings_Record;
Number_Up : Glib.Gint)
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP.
the number of pages per sheet
procedure Set_Number_Up_Layout
(Self : not null access Gtk_Print_Settings_Record;
Number_Up_Layout : Gtk.Enums.Gtk_Number_Up_Layout)
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
a GtkNumberUpLayout value
procedure Set_Orientation
(Self : not null access Gtk_Print_Settings_Record;
Orientation : Gtk.Enums.Gtk_Page_Orientation)
Sets the value of GTK_PRINT_SETTINGS_ORIENTATION.
a page orientation
procedure Set_Output_Bin
(Self : not null access Gtk_Print_Settings_Record;
Output_Bin : UTF8_String)
Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.
the output bin
procedure Set_Page_Ranges
(Self : not null access Gtk_Print_Settings_Record;
Page_Ranges : Page_Range_Array)
Sets the value of GTK_PRINT_SETTINGS_PAGE_RANGES.
an array of GtkPageRanges
procedure Set_Page_Set
(Self : not null access Gtk_Print_Settings_Record;
Page_Set : Gtk.Enums.Gtk_Page_Set)
Sets the value of GTK_PRINT_SETTINGS_PAGE_SET.
a GtkPageSet value
procedure Set_Paper_Height
(Self : not null access Gtk_Print_Settings_Record;
Height : Gdouble;
Unit : Gtk.Enums.Gtk_Unit)
Sets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT.
the paper height
the units of Height
procedure Set_Paper_Size
(Self : not null access Gtk_Print_Settings_Record;
Paper_Size : Gtk.Paper_Size.Gtk_Paper_Size)
Sets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, GTK_PRINT_SETTINGS_PAPER_WIDTH and GTK_PRINT_SETTINGS_PAPER_HEIGHT.
a paper size
procedure Set_Paper_Width
(Self : not null access Gtk_Print_Settings_Record;
Width : Gdouble;
Unit : Gtk.Enums.Gtk_Unit)
Sets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH.
the paper width
the units of Width
procedure Set_Print_Pages
(Self : not null access Gtk_Print_Settings_Record;
Pages : Gtk.Enums.Gtk_Print_Pages)
Sets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.
a GtkPrintPages value
procedure Set_Printer
(Self : not null access Gtk_Print_Settings_Record;
Printer : UTF8_String)
Convenience function to set GTK_PRINT_SETTINGS_PRINTER to Printer.
the printer name
procedure Set_Printer_Lpi
(Self : not null access Gtk_Print_Settings_Record;
Lpi : Gdouble)
Sets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.
the resolution in lpi (lines per inch)
procedure Set_Quality
(Self : not null access Gtk_Print_Settings_Record;
Quality : Gtk.Enums.Gtk_Print_Quality)
Sets the value of GTK_PRINT_SETTINGS_QUALITY.
a GtkPrintQuality value
procedure Set_Resolution
(Self : not null access Gtk_Print_Settings_Record;
Resolution : Glib.Gint)
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y.
the resolution in dpi
procedure Set_Resolution_Xy
(Self : not null access Gtk_Print_Settings_Record;
Resolution_X : Glib.Gint;
Resolution_Y : Glib.Gint)
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y.
the horizontal resolution in dpi
the vertical resolution in dpi
procedure Set_Reverse
(Self : not null access Gtk_Print_Settings_Record;
Gtk_Reverse : Boolean)
Sets the value of GTK_PRINT_SETTINGS_REVERSE.
whether to reverse the output
procedure Set_Scale
(Self : not null access Gtk_Print_Settings_Record;
Scale : Gdouble)
Sets the value of GTK_PRINT_SETTINGS_SCALE.
the scale in percent
procedure Set_Use_Color
(Self : not null access Gtk_Print_Settings_Record;
Use_Color : Boolean)
Sets the value of GTK_PRINT_SETTINGS_USE_COLOR.
whether to use color
function To_File
(Self : not null access Gtk_Print_Settings_Record;
File_Name : UTF8_String;
Error : out Glib.Error.GError) return Boolean
This function saves the print settings from Settings to File_Name. If the file could not be written then error is set to either a GFileError or GKeyFileError.
the file to save to
the return location for a recoverable error
True on success
function To_Gvariant
(Self : not null access Gtk_Print_Settings_Record)
return Glib.Variant.Gvariant
Serialize print settings to an a{sv} variant.
a new, floating, GVariant. Has transfer-ownership='none'.
procedure To_Key_File
(Self : not null access Gtk_Print_Settings_Record;
Key_File : Glib.Key_File.G_Key_File;
Group_Name : UTF8_String := "")
This function adds the print settings from Settings to Key_File.
the GKeyFile to save the print settings to
the group to add the settings to in Key_File, or null to use the default "Print Settings"
procedure Unset
(Self : not null access Gtk_Print_Settings_Record;
Key : UTF8_String)
Removes any value associated with Key. This has the same effect as setting the value to null.
a key