Crea  Modifica  FrontPage  Indici  Cerca  Ultime modifiche  History  RSS  Login

Gtk::PrintSettings

class Gtk::PrintSettings

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.

Included Modules

  • Enumerable

Class Methods

Gtk::PrintSettings.new
Creates a new Gtk::PrintSettings object.

Instance Methods

[key, type = nil, unit_or_default = nil]
dispatches get_XXX by type.
  • key: a key as String
  • type: returned value type. All avilable types are nil, :string, :bool, :double, :length or :integer.
  • unit_or_deafult: a Gtk::PaperSize#Unit if type is :length or a default value if type is :double or :integer.
  • Returns:
    • nil or :string: the value as String
    • :bool: the value as true or false
    • :dobule: the value as Float
    • :length: the value as Float
    • :integer: the value as Intger
get(key)
Same as #[].
get_bool(key)

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

The string "true" represents true, any other string false.

  • key: a key as String
  • Returns: true, if key maps to a true value.
get_double(key, default = nil)
Returns the floating point number represented by the value that is associated with key, default or 0 (if deafult is nil) if the value does not represent a floating point number.
  • key: a key
  • default: the default value or nil
  • Returns: the floating point number associated with key
get_int(key, default = nil)
Returns the value of key, interpreted as an integer, the default value or 0.
  • key: a key as String
  • default: the default value or nil
  • Returns: self
get_length(key, unit)
Gets the value of Gtk::PrintSettings::PAPER_WIDTH, converted to unit.
  • unit: the unit for the return value
  • Returns: the paper width, in units of unit
[key, unit = nil] = value
Associates value with key.
  • key: a key as String
  • value: a value as String, true, false, Fixnum, Float or nil
  • unit: a Gtk::PaperSize#Unit or nil. unit is used if value is Float
  • Returns: value
set(key, value, unit = nil)
Same as #[]=.
  • key: a key as String
  • value: a value as String, true, false, Fixnum, Float or nil
  • unit: a Gtk::PaperSize#Unit or nil. unit is used if value is Float
  • Returns: self
delete(key)
Removes any value associated with key. This has the same effect as setting the value to nil.
  • key: key to remove the value
  • Returns: self
unset(key)
Same as #delete.
  • key: key to remove the value
  • Returns: self
has_key?(key)
Returns true, if a value is associated with key.
  • Returns: true if key has a value
dup
Duplicates a Gtk::PrintSettings object.
  • Returns: a newly allocated duplication of self
each{|key, value| ... }
Iterates block for each key-value pair of self.
  • {|key, value| ... }
    • key: a key.
    • value: a value of the key.
  • Returns: self
collate?
Gets the value of Gtk::PrintSettings::COLLATE.
  • Returns: whether to collate the printed pages
collate=(collate)
Sets the value of Gtk::PrintSettings::COLLATE.
  • collate: whether to collate the output
  • Returns: collate
set_collate(collate)
Same as collate=.
  • collate: whether to collate the output
  • Returns: self
default_source
Gets the value of Gtk::PrintSettings::DEFAULT_SOURCE.
  • Return value: the default source
default_source=(default_source)
Sets the value of Gtk::PrintSettings::DEFAULT_SOURCE.
  • default_source: the default source
  • Returns: default_source
set_default_source(default_source)
Same as #default_source=.
  • default_source: the default source
  • Returns: self
dither
Gets the value of Gtk::PrintSettings::DITHER.
  • Returns: the dithering that is used
dither=(dither)
Sets the value of Gtk::PrintSettings::DITHER.
  • dither: the dithering that is used
  • Returns: dither
set_dither(dither)
Same as #dither=.
  • dither: the dithering that is used
  • Returns: self
duplex
Gets the value of Gtk::PrintSettings::DUPLEX.
  • Returns: whether to print the output in duplex.
duplex=(duplex)
Sets the value of Gtk::PrintSettings::DUPLEX.
set_duplex(duplex)
Same as #duplex=.
finishings
Gets the value of Gtk::PrintSettings::FINISHINGS.
  • Returns: the finishings
finishings=(finishings)
Sets the value of Gtk::PrintSettings::FINISHINGS.
  • finishings: the finishings
  • Returns: finishings
set_finishings(finishings)
Same as #finishings=.
  • finishings: the finishings
  • Returns: self
media_type

Gets the value of Gtk::PrintSettings::MEDIA_TYPE.

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

  • Returns: the media type
media_type=(media_type)

Sets the value of Gtk::PrintSettings::MEDIA_TYPE.

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

  • media_type: the media type
  • Returns: media_type
set_media_type(media_type)
Same as #media_type=.
  • media_type: the media type
  • Returns: self
n_copies
Gets the value of Gtk::PrintSettings::N_COPIES.
  • Return: the number of copies to print
n_copies=(n_copies)
Sets the value of Gtk::PrintSettings::N_COPIES.
  • n_copies: the number of copies
  • Returns: n_copies
set_n_copies(n_copies)
Same as #n_copies=.
  • n_copies: the number of copies
  • Returns: self
number_up
Gets the value of Gtk::PrintSettings::NUMBER_UP.
  • Return value: the number of pages per sheet
number_up=(number_up)
Sets the value of Gtk::PrintSettings::NUMBER_UP.
  • number_up: the number of pages per sheet
  • Returns: number_up
set_number_up(number_up)
Same as #number_up=.
  • number_up: the number of pages per sheet
  • Returns: self
orientation
Get the value of Gtk::PrintSettings::ORIENTATION, converted to a Gtk::PrintSettings#PageOrientation.
  • Return: the orientation
orientation=(orientation)
Sets the value of Gtk::PrintSettings::ORIENTATION.
  • orientation: a page orientation
  • Returns: orientation
set_orientation(orientation)
Same as #orientation=.
  • orientation: a page orientation
  • Returns: self
output_bin
Gets the value of Gtk::PrintSettings::OUTPUT_BIN.
  • Returns: the output bin
output_bin=(output_bin)
Sets the value of Gtk::PrintSettings::OUTPUT_BIN.
  • output_bin: the oubput bin
  • Returns: output_bin
set_output_bin(output_bin)
Same as #output_bin=.
  • output_bin: the oubput bin
  • Returns: self
page_ranges
Gets the value of Gtk::PrintSettings::PAGE_RANGES.
  • Returns: an array of [start as Integer, end as Integer]
page_ranges=(page_ranges)
Sets the value of Gtk::PrintSettings::PAGE_RANGES.
  • page_ranges: an array of [start as Integer, end as Integer]
  • Returns: page_ranges
set_page_ranges(page_ranges)
Same as #page_ranges=.
  • page_ranges: an array of [start as Integer, end as Integer]
  • Returns: self
page_set
Gets the value of Gtk::PrintSettings::PAGE_SET.
  • Returns: the set of pages to print
page_set=(page_set)
Sets the value of Gtk::PrintSettings::PAGE_SET.
set_page_set(page_set)
Same as #page_set=.
paper_size
Gets the value of Gtk::PrintSettings::PAPER_FORMAT, converted to a Gtk:PaperSize.
  • Returns: the paper size
paper_size=(paper_size)
Sets the value of Gtk::PrintSettings::PAPER_FORMAT, Gtk::PrintSettings::PAPER_WIDTH and Gtk::PrintSettings::PAPER_HEIGHT.
  • paper_size: a paper size
  • Returns: paper_size
set_paper_size(paper_size)
Same as #paper_size=.
  • paper_size: a paper size
  • Returns: self
paper_height(unit)
Gets the value of Gtk::PrintSettings::PAPER_HEIGHT, converted to unit.
  • unit: the unit for the return value as Gtk::PaperSize#Unit
  • Returns: the paper height, in units of unit
set_paper_height(height, unit)
Sets the value of Gtk::PrintSettings::PAPER_HEIGHT.
paper_width(unit)
Gets the value of Gtk::PrintSettings::PAPER_WIDTH, converted to unit.
  • unit: the unit for the return value as Gtk::PaperSize#Unit
  • Returns: the paper width, in units of unit
set_paper_width(width, unit)
Sets the value of Gtk::PrintSettings::PAPER_WIDTH.
print_pages
Gets the value of Gtk::PrintSettings::PRINT_PAGES.
  • Returns: which pages to print
print_pages=(pages)
Sets the value of Gtk::PrintSettings::PRINT_PAGES.
set_print_pages(print_pages)
Same as #print_pages=.
printer
Convenience function to obtain the value of Gtk::PrintSettings::PRINTER.
  • Returns: the printer name
printer=(printer)
Convenience function to set Gtk::PrintSettings::PRINTER to printer.
  • printer: the printer name as String
  • Returns: printer
set_printer(printer)
Same as #printer=.
  • printer: the printer name as String
  • Returns: self
quality
Gets the value of Gtk::PrintSettings::QUALITY.
quality=(quality)
Sets the value of Gtk::PrintSettings::QUALITY.
set_quality(quality)
Same as #quality=.
resolution
Gets the value of Gtk::PrintSettings::RESOLUTION.
  • Returns: the resolution in dpi
resolution=(resolution)
Sets the value of Gtk::PrintSettings::RESOLUTION.
  • resolution: the resolution in dpi
  • Returns: resolution
set_resolution(resolution)
Same as #resolution=.
  • resolution: the resolution in dpi
  • Returns: self
reverse?
Gets the value of Gtk::PrintSettings::REVERSE.
  • Returns: whether to reverse the order of the printed pages
reverse=(reverse)
Sets the value of Gtk::PrintSettings::REVERSE.
  • reverse: whether to reverse the output
  • Returns: reverse
set_reverse(reverse)
Same as #reverse=.
  • reverse: whether to reverse the output
  • Returns: self
scale
Gets the value of Gtk::PrintSettings::SCALE.
  • Returns: the scale in percent
scale=(scale)
Sets the value of Gtk::PrintSettings::SCALE.
  • scale: the scale in percent
  • Returns: scale
set_scale(scale)
Same as #scale=.
  • scale: the scale in percent
  • Returns: self
use_color?
Gets the value of Gtk::PrintSettings::USE_COLOR.
  • Returns: whether to use color
use_color=(use_color)
Sets the value of Gtk::PrintSettings::USE_COLOR.
  • use_color: whether to use color
  • Returns: use_color
set_use_color(use_color)
Same as #use_color=.
  • Returns: self

ChangeLog

  • 2006-11-03: Modified. - Masao
  • 2006-07-09: updated for 2.10. - kou?

- kou?