class Gtk::PrintSettings

Overview

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.

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.


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.


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.


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.


Class Method Detail

def self.g_type : UInt64 #

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


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.


def collate : Bool #

Gets the value of %GTK_PRINT_SETTINGS_COLLATE.


def collate=(collate : Bool) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_COLLATE.


def copy : Gtk::PrintSettings #

Copies a Gtk::PrintSettings object.


def default_source : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.


def default_source=(default_source : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.


def dither : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_DITHER.


def dither=(dither : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_DITHER.


def double(key : String) : Float64 #

Returns the double value associated with key, or 0.


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().


def duplex : Gtk::PrintDuplex #

Gets the value of %GTK_PRINT_SETTINGS_DUPLEX.


def duplex=(duplex : Gtk::PrintDuplex) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_DUPLEX.


def finishings : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_FINISHINGS.


def finishings=(finishings : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_FINISHINGS.


def foreach(func : Gtk::PrintSettingsFunc, user_data : Pointer(Void) | Nil) : Nil #

Calls func for each key-value pair of settings.


def get(key : String) : String | Nil #

Looks up the string value associated with key.


def has_key(key : String) : Bool #

Returns true, if a value is associated with key.


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.


def int_with_default(key : String, def _def : Int32) : Int32 #

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


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.


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.


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.


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.


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.


def n_copies : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_N_COPIES.


def n_copies=(num_copies : Int32) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_N_COPIES.


def number_up : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.


def number_up=(number_up : Int32) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.


def number_up_layout : Gtk::NumberUpLayout #

Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.


def number_up_layout=(number_up_layout : Gtk::NumberUpLayout) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.


def orientation : Gtk::PageOrientation #

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


def orientation=(orientation : Gtk::PageOrientation) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_ORIENTATION.


def output_bin : String | Nil #

Gets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.


def output_bin=(output_bin : String) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.


def page_ranges : Enumerable(Gtk::PageRange) #

Gets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.


def page_ranges=(page_ranges : Enumerable(Gtk::PageRange)) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.


def page_set : Gtk::PageSet #

Gets the value of %GTK_PRINT_SETTINGS_PAGE_SET.


def page_set=(page_set : Gtk::PageSet) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAGE_SET.


def paper_height(unit : Gtk::Unit) : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to unit.


def paper_size : Gtk::PaperSize | Nil #

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


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.


def paper_width(unit : Gtk::Unit) : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to unit.


def print_pages : Gtk::PrintPages #

Gets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.


def print_pages=(pages : Gtk::PrintPages) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.


def printer : String | Nil #

Convenience function to obtain the value of %GTK_PRINT_SETTINGS_PRINTER.


def printer=(printer : String) : Nil #

Convenience function to set %GTK_PRINT_SETTINGS_PRINTER to printer.


def printer_lpi : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.


def printer_lpi=(lpi : Float64) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.


def quality : Gtk::PrintQuality #

Gets the value of %GTK_PRINT_SETTINGS_QUALITY.


def quality=(quality : Gtk::PrintQuality) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_QUALITY.


def resolution : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION.


def resolution=(resolution : Int32) : Nil #

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


def resolution_x : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_X.


def resolution_y : Int32 #

Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_Y.


def reverse : Bool #

Gets the value of %GTK_PRINT_SETTINGS_REVERSE.


def reverse=(reverse : Bool) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_REVERSE.


def scale : Float64 #

Gets the value of %GTK_PRINT_SETTINGS_SCALE.


def scale=(scale : Float64) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_SCALE.


def set(key : String, value : String | Nil) : Nil #

Associates value with key.


def set_bool(key : String, value : Bool) : Nil #

Sets key to a boolean value.


def set_double(key : String, value : Float64) : Nil #

Sets key to a double value.


def set_int(key : String, value : Int32) : Nil #

Sets key to an integer value.


def set_length(key : String, value : Float64, unit : Gtk::Unit) : Nil #

Associates a length in units of unit with key.


def set_paper_height(height : Float64, unit : Gtk::Unit) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT.


def set_paper_width(width : Float64, unit : Gtk::Unit) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH.


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.


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.


def to_gvariant : GLib::Variant #

Serialize print settings to an a{sv} variant.


def to_key_file(key_file : GLib::KeyFile, group_name : String | Nil) : Nil #

This function adds the print settings from settings to key_file.


def unset(key : String) : Nil #

Removes any value associated with key.

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


def use_color : Bool #

Gets the value of %GTK_PRINT_SETTINGS_USE_COLOR.


def use_color=(use_color : Bool) : Nil #

Sets the value of %GTK_PRINT_SETTINGS_USE_COLOR.