class Gtk::PrintSettings

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.cr

Constructors

Class Method Summary

Instance Method Summary

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

def self.new : self #

Creates a new Gtk::PrintSettings object.


[View source]
def self.new_from_file(file_name : String) : self #

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.

See Gtk::PrintSettings#to_file.


[View source]
def self.new_from_gvariant(variant : _) : self #

Deserialize print settings from an a{sv} variant.

The variant must be in the format produced by Gtk::PrintSettings#to_gvariant.


[View source]
def self.new_from_key_file(key_file : GLib::KeyFile, group_name : String | Nil) : self #

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.


[View source]

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def bool(key : String) : Bool #

Returns the boolean represented by the value that is associated with key.

The string “true” represents true, any other string false.


[View source]
def collate : Bool #

Gets the value of %GTK_PRINT_SETTINGS_COLLATE.


[View source]
def collate=(collate : Bool) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_COLLATE.


[View source]
def copy : Gtk::PrintSettings #

Copies a Gtk::PrintSettings object.


[View source]
def default_source : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.


[View source]
def default_source=(default_source : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.


[View source]
def dither : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_DITHER.


[View source]
def dither=(dither : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_DITHER.


[View source]
def double(key : String) : Float64 #

Returns the double value associated with key, or 0.


[View source]
def 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.

Floating point numbers are parsed with g_ascii_strtod().


[View source]
def duplex : Gtk::PrintDuplex #

Gets the value of %GTK_PRINT_SETTINGS_DUPLEX.


[View source]
def duplex=(duplex : Gtk::PrintDuplex) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_DUPLEX.


[View source]
def finishings : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_FINISHINGS.


[View source]
def finishings=(finishings : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_FINISHINGS.


[View source]
def foreach(func : Gtk::PrintSettingsFunc, user_data : Pointer(Void) | Nil) : Nil #

Calls func for each key-value pair of settings.


[View source]
def get(key : String) : String | Nil #

Looks up the string value associated with key.


[View source]
def has_key(key : String) : Bool #

Returns true, if a value is associated with key.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def int(key : String) : Int32 #

Returns the integer value of key, or 0.


[View source]
def int_with_default(key : String, def _def : Int32) : Int32 #

Returns the value of key, interpreted as an integer, or the default value.


[View source]
def length(key : String, unit : Gtk::Unit) : Float64 #

Returns the value associated with key, interpreted as a length.

The returned value is converted to units.


[View source]
def load_file(file_name : String) : Bool #

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 Gtk::PrintSettings#to_file.


[View source]
def load_key_file(key_file : GLib::KeyFile, group_name : String | Nil) : Bool #

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.


[View source]
def media_type : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.

The set of media types is defined in PWG 5101.1-2002 PWG.


[View source]
def media_type=(media_type : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.

The set of media types is defined in PWG 5101.1-2002 PWG.


[View source]
def n_copies : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_N_COPIES.


[View source]
def n_copies=(num_copies : Int32) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_N_COPIES.


[View source]
def number_up : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.


[View source]
def number_up=(number_up : Int32) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.


[View source]
def number_up_layout : Gtk::NumberUpLayout #

Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.


[View source]
def number_up_layout=(number_up_layout : Gtk::NumberUpLayout) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.


[View source]
def orientation : Gtk::PageOrientation #

Get the value of %GTK_PRINT_SETTINGS_ORIENTATION, converted to a Gtk::PageOrientation.


[View source]
def orientation=(orientation : Gtk::PageOrientation) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_ORIENTATION.


[View source]
def output_bin : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.


[View source]
def output_bin=(output_bin : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.


[View source]
def page_ranges : Enumerable(Gtk::PageRange) #

Gets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.


[View source]
def page_ranges=(page_ranges : Enumerable(Gtk::PageRange)) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.


[View source]
def page_set : Gtk::PageSet #

Gets the value of %GTK_PRINT_SETTINGS_PAGE_SET.


[View source]
def page_set=(page_set : Gtk::PageSet) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAGE_SET.


[View source]
def paper_height(unit : Gtk::Unit) : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to unit.


[View source]
def paper_size : Gtk::PaperSize | Nil #

Gets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize.


[View source]
def 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.


[View source]
def paper_width(unit : Gtk::Unit) : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to unit.


[View source]
def print_pages : Gtk::PrintPages #

Gets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.


[View source]
def print_pages=(pages : Gtk::PrintPages) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.


[View source]
def printer : String | Nil #

Convenience function to obtain the value of %GTK_PRINT_SETTINGS_PRINTER.


[View source]
def printer=(printer : String) : Nil #

Convenience function to set %GTK_PRINT_SETTINGS_PRINTER to printer.


[View source]
def printer_lpi : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.


[View source]
def printer_lpi=(lpi : Float64) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.


[View source]
def quality : Gtk::PrintQuality #

Gets the value of %GTK_PRINT_SETTINGS_QUALITY.


[View source]
def quality=(quality : Gtk::PrintQuality) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_QUALITY.


[View source]
def resolution : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION.


[View source]
def resolution=(resolution : Int32) : Nil #

Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION, %GTK_PRINT_SETTINGS_RESOLUTION_X and %GTK_PRINT_SETTINGS_RESOLUTION_Y.


[View source]
def resolution_x : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_X.


[View source]
def resolution_y : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_Y.


[View source]
def reverse : Bool #

Gets the value of %GTK_PRINT_SETTINGS_REVERSE.


[View source]
def reverse=(reverse : Bool) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_REVERSE.


[View source]
def scale : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_SCALE.


[View source]
def scale=(scale : Float64) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_SCALE.


[View source]
def set(key : String, value : String | Nil) : Nil #

Associates value with key.


[View source]
def set_bool(key : String, value : Bool) : Nil #

Sets key to a boolean value.


[View source]
def set_double(key : String, value : Float64) : Nil #

Sets key to a double value.


[View source]
def set_int(key : String, value : Int32) : Nil #

Sets key to an integer value.


[View source]
def set_length(key : String, value : Float64, unit : Gtk::Unit) : Nil #

Associates a length in units of unit with key.


[View source]
def set_paper_height(height : Float64, unit : Gtk::Unit) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT.


[View source]
def set_paper_width(width : Float64, unit : Gtk::Unit) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH.


[View source]
def 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.


[View source]
def to_file(file_name : String) : Bool #

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.


[View source]
def to_gvariant : GLib::Variant #

Serialize print settings to an a{sv} variant.


[View source]
def to_key_file(key_file : GLib::KeyFile, group_name : String | Nil) : Nil #

This function adds the print settings from settings to key_file.


[View source]
def unset(key : String) : Nil #

Removes any value associated with key.

This has the same effect as setting the value to nil.


[View source]
def use_color : Bool #

Gets the value of %GTK_PRINT_SETTINGS_USE_COLOR.


[View source]
def use_color=(use_color : Bool) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_USE_COLOR.


[View source]