class Gtk::PrintSettings
- Gtk::PrintSettings
- GObject::Object
- Reference
- Object
Overview
A Gtk::PrintSettings
object represents 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.
Defined in:
lib/gi-crystal/src/auto/gtk-4.0/print_settings.crConstructors
-
.new : self
Creates a new
Gtk::PrintSettings
object. -
.new_from_file(file_name : String) : self
Reads the print settings from @file_name.
-
.new_from_gvariant(variant : _) : self
Deserialize print settings from an a{sv} variant.
-
.new_from_key_file(key_file : GLib::KeyFile, group_name : String?) : self
Reads the print settings from the group @group_name in @key_file.
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#bool(key : String) : Bool
Returns the boolean represented by the value that is associated with @key.
-
#collate : Bool
Gets the value of %GTK_PRINT_SETTINGS_COLLATE.
-
#collate=(collate : Bool) : Nil
Sets the value of %GTK_PRINT_SETTINGS_COLLATE.
-
#copy : Gtk::PrintSettings
Copies a
Gtk::PrintSettings
object. -
#default_source : String?
Gets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
-
#default_source=(default_source : String) : Nil
Sets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
-
#dither : String?
Gets the value of %GTK_PRINT_SETTINGS_DITHER.
-
#dither=(dither : String) : Nil
Sets the value of %GTK_PRINT_SETTINGS_DITHER.
-
#double(key : String) : Float64
Returns the double value associated with @key, or 0.
-
#double_with_default(key : String, def _def : Float64) : Float64
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.
-
#duplex : Gtk::PrintDuplex
Gets the value of %GTK_PRINT_SETTINGS_DUPLEX.
-
#duplex=(duplex : Gtk::PrintDuplex) : Nil
Sets the value of %GTK_PRINT_SETTINGS_DUPLEX.
-
#finishings : String?
Gets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
-
#finishings=(finishings : String) : Nil
Sets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
-
#foreach(func : Gtk::PrintSettingsFunc, user_data : Pointer(Void)?) : Nil
Calls @func for each key-value pair of @settings.
-
#get(key : String) : String?
Looks up the string value associated with @key.
-
#has_key(key : String) : Bool
Returns
true
, if a value is associated with @key. -
#int(key : String) : Int32
Returns the integer value of @key, or 0.
-
#int_with_default(key : String, def _def : Int32) : Int32
Returns the value of @key, interpreted as an integer, or the default value.
-
#length(key : String, unit : Gtk::Unit) : Float64
Returns the value associated with @key, interpreted as a length.
-
#load_file(file_name : String) : Bool
Reads the print settings from @file_name.
-
#load_key_file(key_file : GLib::KeyFile, group_name : String?) : Bool
Reads the print settings from the group @group_name in @key_file.
-
#media_type : String?
Gets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
-
#media_type=(media_type : String) : Nil
Sets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
-
#n_copies : Int32
Gets the value of %GTK_PRINT_SETTINGS_N_COPIES.
-
#n_copies=(num_copies : Int32) : Nil
Sets the value of %GTK_PRINT_SETTINGS_N_COPIES.
-
#number_up : Int32
Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
-
#number_up=(number_up : Int32) : Nil
Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
-
#number_up_layout : Gtk::NumberUpLayout
Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
-
#number_up_layout=(number_up_layout : Gtk::NumberUpLayout) : Nil
Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
-
#orientation : Gtk::PageOrientation
Get the value of %GTK_PRINT_SETTINGS_ORIENTATION, converted to a
Gtk::PageOrientation
. -
#orientation=(orientation : Gtk::PageOrientation) : Nil
Sets the value of %GTK_PRINT_SETTINGS_ORIENTATION.
-
#output_bin : String?
Gets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
-
#output_bin=(output_bin : String) : Nil
Sets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
-
#page_ranges : Enumerable(Gtk::PageRange)
Gets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
-
#page_ranges=(page_ranges : Enumerable(Gtk::PageRange)) : Nil
Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
-
#page_set : Gtk::PageSet
Gets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
-
#page_set=(page_set : Gtk::PageSet) : Nil
Sets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
-
#paper_height(unit : Gtk::Unit) : Float64
Gets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to @unit.
-
#paper_size : Gtk::PaperSize?
Gets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a
Gtk::PaperSize
. -
#paper_size=(paper_size : Gtk::PaperSize) : Nil
Sets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT, %GTK_PRINT_SETTINGS_PAPER_WIDTH and %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
-
#paper_width(unit : Gtk::Unit) : Float64
Gets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to @unit.
-
#print_pages : Gtk::PrintPages
Gets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
-
#print_pages=(pages : Gtk::PrintPages) : Nil
Sets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
-
#printer : String?
Convenience function to obtain the value of %GTK_PRINT_SETTINGS_PRINTER.
-
#printer=(printer : String) : Nil
Convenience function to set %GTK_PRINT_SETTINGS_PRINTER to @printer.
-
#printer_lpi : Float64
Gets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
-
#printer_lpi=(lpi : Float64) : Nil
Sets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
-
#quality : Gtk::PrintQuality
Gets the value of %GTK_PRINT_SETTINGS_QUALITY.
-
#quality=(quality : Gtk::PrintQuality) : Nil
Sets the value of %GTK_PRINT_SETTINGS_QUALITY.
-
#resolution : Int32
Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION.
-
#resolution=(resolution : Int32) : Nil
Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION, %GTK_PRINT_SETTINGS_RESOLUTION_X and %GTK_PRINT_SETTINGS_RESOLUTION_Y.
-
#resolution_x : Int32
Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_X.
-
#resolution_y : Int32
Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_Y.
-
#reverse : Bool
Gets the value of %GTK_PRINT_SETTINGS_REVERSE.
-
#reverse=(reverse : Bool) : Nil
Sets the value of %GTK_PRINT_SETTINGS_REVERSE.
-
#scale : Float64
Gets the value of %GTK_PRINT_SETTINGS_SCALE.
-
#scale=(scale : Float64) : Nil
Sets the value of %GTK_PRINT_SETTINGS_SCALE.
-
#set(key : String, value : String?) : Nil
Associates @value with @key.
-
#set_bool(key : String, value : Bool) : Nil
Sets @key to a boolean value.
-
#set_double(key : String, value : Float64) : Nil
Sets @key to a double value.
-
#set_int(key : String, value : Int32) : Nil
Sets @key to an integer value.
-
#set_length(key : String, value : Float64, unit : Gtk::Unit) : Nil
Associates a length in units of @unit with @key.
-
#set_paper_height(height : Float64, unit : Gtk::Unit) : Nil
Sets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
-
#set_paper_width(width : Float64, unit : Gtk::Unit) : Nil
Sets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH.
-
#set_resolution_xy(resolution_x : Int32, resolution_y : Int32) : Nil
Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION, %GTK_PRINT_SETTINGS_RESOLUTION_X and %GTK_PRINT_SETTINGS_RESOLUTION_Y.
-
#to_file(file_name : String) : Bool
This function saves the print settings from @settings to @file_name.
-
#to_gvariant : GLib::Variant
Serialize print settings to an a{sv} variant.
-
#to_key_file(key_file : GLib::KeyFile, group_name : String?) : Nil
This function adds the print settings from @settings to @key_file.
-
#unset(key : String) : Nil
Removes any value associated with @key.
-
#use_color : Bool
Gets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
-
#use_color=(use_color : Bool) : Nil
Sets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
Instance methods inherited from class GObject::Object
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)?
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
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)?
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void)?) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void)?
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void)?
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,
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
compat_control(what : UInt64, data : Pointer(Void)?) : 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
Constructor Detail
Reads the print settings from @file_name.
Returns a new Gtk::PrintSettings
object with the restored settings,
or nil
if an error occurred. If the file could not be loaded then
error is set to either a GFileError
or GKeyFileError
.
Deserialize print settings from an a{sv} variant.
The variant must be in the format produced by
Gtk::PrintSettings#to_gvariant
.
Reads the print settings from the group @group_name in @key_file.
Returns a new Gtk::PrintSettings
object with the restored settings,
or nil
if an error occurred. If the file could not be loaded then
error is set to either GFileError
or GKeyFileError
.
Class Method Detail
Instance Method Detail
Returns the boolean represented by the value that is associated with @key.
The string “true” represents true
, any other
string false
.
Sets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
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().
Calls @func for each key-value pair of @settings.
Returns the value of @key, interpreted as an integer, or the default value.
Returns the value associated with @key, interpreted as a length.
The returned value is converted to @units.
Reads the print settings from @file_name.
If the file could not be loaded then error is set to either
a GFileError
or GKeyFileError
.
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
.
Gets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
The set of media types is defined in PWG 5101.1-2002 PWG.
Sets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
The set of media types is defined in PWG 5101.1-2002 PWG.
Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
Get the value of %GTK_PRINT_SETTINGS_ORIENTATION,
converted to a Gtk::PageOrientation
.
Sets the value of %GTK_PRINT_SETTINGS_ORIENTATION.
Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
Gets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to @unit.
Gets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT,
converted to a Gtk::PaperSize
.
Sets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT, %GTK_PRINT_SETTINGS_PAPER_WIDTH and %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
Gets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to @unit.
Sets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
Convenience function to set %GTK_PRINT_SETTINGS_PRINTER to @printer.
Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION, %GTK_PRINT_SETTINGS_RESOLUTION_X and %GTK_PRINT_SETTINGS_RESOLUTION_Y.
Associates a length in units of @unit with @key.
Sets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
Sets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH.
Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION, %GTK_PRINT_SETTINGS_RESOLUTION_X and %GTK_PRINT_SETTINGS_RESOLUTION_Y.
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
.
This function adds the print settings from @settings to @key_file.
Removes any value associated with @key.
This has the same effect as setting the value to nil
.