![]() |
![]() |
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.
It's 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.
Public Types | |
typedef sigc::slot< void, const Glib::ustring &, const Glib::ustring& > | SlotForeach |
For example, void on_foreach_setting(const Glib::ustring& key, const Glib::ustring& value);. | |
Public Member Functions | |
Glib::ustring | get (const Glib::ustring& key) const |
Looks up the string value associated with key . | |
bool | get_bool (const Glib::ustring& key) const |
Return value: true , if key maps to a true value. | |
bool | get_collate () const |
Gets the value of Gtk::PRINT_SETTINGS_COLLATE. | |
Glib::ustring | get_default_source () const |
Gets the value of Gtk::PRINT_SETTINGS_DEFAULT_SOURCE. | |
Glib::ustring | get_dither () const |
Gets the value of Gtk::PRINT_SETTINGS_DITHER. | |
double | get_double (const Glib::ustring& key) const |
Return value: the double value of key. | |
double | get_double_with_default (const Glib::ustring& key, double def) const |
Return value: the floating point number associated with key. | |
PrintDuplex | get_duplex () const |
Gets the value of Gtk::PRINT_SETTINGS_DUPLEX. | |
Glib::ustring | get_finishings () const |
Gets the value of Gtk::PRINT_SETTINGS_FINISHINGS. | |
int | get_int (const Glib::ustring& key) const |
Return value: the integer value of key. | |
int | get_int_with_default (const Glib::ustring& key, int def) const |
Return value: the integer value of key. | |
double | get_length (const Glib::ustring& key, Unit unit) const |
Return value: the length value of key , converted to unit. | |
Glib::ustring | get_media_type () const |
Gets the value of Gtk::PRINT_SETTINGS_MEDIA_TYPE. | |
int | get_n_copies () const |
Gets the value of Gtk::PRINT_SETTINGS_N_COPIES. | |
int | get_number_up () const |
Gets the value of Gtk::PRINT_SETTINGS_NUMBER_UP. | |
PageOrientation | get_orientation () const |
Get the value of Gtk::PRINT_SETTINGS_ORIENTATION, converted to a Gtk::PageOrientation. | |
Glib::ustring | get_output_bin () const |
Gets the value of Gtk::PRINT_SETTINGS_OUTPUT_BIN. | |
Glib::ArrayHandle<PageRange> | get_page_ranges () const |
PageSet | get_page_set () const |
Gets the value of Gtk::PRINT_SETTINGS_PAGE_SET. | |
double | get_paper_height (Unit unit) const |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_HEIGHT, converted to unit . | |
const PaperSize | get_paper_size () const |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize. | |
PaperSize | get_paper_size () |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize. | |
double | get_paper_width (Unit unit) const |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_WIDTH, converted to unit . | |
PrintPages | get_print_pages () const |
Gets the value of Gtk::PRINT_SETTINGS_PRINT_PAGES. | |
Glib::ustring | get_printer () const |
Convenience function to obtain the value of Gtk::PRINT_SETTINGS_PRINTER. | |
PrintQuality | get_quality () const |
Gets the value of Gtk::PRINT_SETTINGS_QUALITY. | |
int | get_resolution () const |
Gets the value of Gtk::PRINT_SETTINGS_RESOLUTION. | |
bool | get_reverse () const |
Gets the value of Gtk::PRINT_SETTINGS_REVERSE. | |
double | get_scale () const |
Gets the value of Gtk::PRINT_SETTINGS_SCALE. | |
bool | get_use_color () const |
Gets the value of Gtk::PRINT_SETTINGS_USE_COLOR. | |
const GtkPrintSettings* | gobj () const |
Provides access to the underlying C GObject. | |
GtkPrintSettings* | gobj () |
Provides access to the underlying C GObject. | |
GtkPrintSettings* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
bool | has_key (const Glib::ustring& key) const |
Return value: true , if key has a value. | |
bool | save_to_file (const std::string& file_name) const |
This function saves the print settings from settings to file_name . | |
void | save_to_key_file (Glib::KeyFile& key_file) |
This function adds the print settings from settings to key_file, in the "Print Settings" group. | |
void | save_to_key_file (Glib::KeyFile& key_file, const Glib::ustring& group_name) const |
This function adds the print settings from settings to key_file . | |
void | set (const Glib::ustring& key, const Glib::ustring& value) |
Associates value with key . | |
void | set_bool (const Glib::ustring& key, bool value=true) |
Sets key to a boolean value. | |
void | set_collate (bool collate=true) |
Sets the value of Gtk::PRINT_SETTINGS_COLLATE. | |
void | set_default_source (const Glib::ustring& default_source) |
Sets the value of Gtk::PRINT_SETTINGS_DEFAULT_SOURCE. | |
void | set_dither (const Glib::ustring& dither) |
Sets the value of Gtk::PRINT_SETTINGS_DITHER. | |
void | set_double (const Glib::ustring& key, double value) |
Sets key to a double value. | |
void | set_duplex (PrintDuplex duplex) |
Sets the value of Gtk::PRINT_SETTINGS_DUPLEX. | |
void | set_finishings (const Glib::ustring& finishings) |
Sets the value of Gtk::PRINT_SETTINGS_FINISHINGS. | |
void | set_int (const Glib::ustring& key, int value) |
Sets key to an integer value. | |
void | set_length (const Glib::ustring& key, double value, Unit unit) |
Associates a length in units of unit with key . | |
void | set_media_type (const Glib::ustring& media_type) |
Sets the value of Gtk::PRINT_SETTINGS_MEDIA_TYPE. | |
void | set_n_copies (int num_copies) |
Sets the value of Gtk::PRINT_SETTINGS_N_COPIES. | |
void | set_number_up (int number_up) |
Sets the value of Gtk::PRINT_SETTINGS_NUMBER_UP. | |
void | set_orientation (PageOrientation orientation) |
Sets the value of Gtk::PRINT_SETTINGS_ORIENTATION. | |
void | set_output_bin (const Glib::ustring& output_bin) |
Sets the value of Gtk::PRINT_SETTINGS_OUTPUT_BIN. | |
void | set_page_ranges (const Glib::ArrayHandle<PageRange>& page_ranges) |
void | set_page_set (PageSet page_set) |
Sets the value of Gtk::PRINT_SETTINGS_PAGE_SET. | |
void | set_paper_height (double height, Unit unit) |
Sets the value of Gtk::PRINT_SETTINGS_PAPER_HEIGHT. | |
void | set_paper_size (const PaperSize& paper_size) |
Sets the value of Gtk::PRINT_SETTINGS_PAPER_FORMAT, Gtk::PRINT_SETTINGS_PAPER_WIDTH and Gtk::PRINT_SETTINGS_PAPER_HEIGHT. | |
void | set_paper_width (double width, Unit unit) |
Sets the value of Gtk::PRINT_SETTINGS_PAPER_WIDTH. | |
void | set_print_pages (PrintPages print_pages) |
Sets the value of Gtk::PRINT_SETTINGS_PRINT_PAGES. | |
void | set_printer (const Glib::ustring& name) |
Convenience function to set Gtk::PRINT_SETTINGS_PRINTER to printer . | |
void | set_quality (PrintQuality quality) |
Sets the value of Gtk::PRINT_SETTINGS_QUALITY. | |
void | set_resolution (int resolution) |
Sets the value of Gtk::PRINT_SETTINGS_RESOLUTION. | |
void | set_reverse (bool reverse=true) |
Sets the value of Gtk::PRINT_SETTINGS_REVERSE. | |
void | set_scale (double scale) |
Sets the value of Gtk::PRINT_SETTINGS_SCALE. | |
void | set_use_color (bool use_color=true) |
Sets the value of Gtk::PRINT_SETTINGS_USE_COLOR. | |
void | setting_foreach (const SlotForeach& slot) |
Calls a function for each print setting. | |
void | unset (const Glib::ustring& key) |
Removes any value associated with key . | |
virtual | ~PrintSettings () |
Static Public Member Functions | |
static Glib::RefPtr<PrintSettings> | create () |
Protected Member Functions | |
PrintSettings () | |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr<Gtk::PrintSettings> | wrap (GtkPrintSettings* object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Classes | |
class | Keys |
Print settings keys. More... | |
class | PageRange |
typedef sigc::slot<void, const Glib::ustring&, const Glib::ustring&> Gtk::PrintSettings::SlotForeach |
For example, void on_foreach_setting(const Glib::ustring& key, const Glib::ustring& value);.
virtual Gtk::PrintSettings::~PrintSettings | ( | ) | [virtual] |
Gtk::PrintSettings::PrintSettings | ( | ) | [protected] |
static Glib::RefPtr<PrintSettings> Gtk::PrintSettings::create | ( | ) | [static] |
Glib::ustring Gtk::PrintSettings::get | ( | const Glib::ustring & | key | ) | const |
Looks up the string value associated with key .
key | A key. |
bool Gtk::PrintSettings::get_bool | ( | const Glib::ustring & | key | ) | const |
Return value: true
, if key maps to a true value.
key | A key. |
true
, if key maps to a true value.bool Gtk::PrintSettings::get_collate | ( | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_COLLATE.
Glib::ustring Gtk::PrintSettings::get_default_source | ( | ) | const |
Glib::ustring Gtk::PrintSettings::get_dither | ( | ) | const |
double Gtk::PrintSettings::get_double | ( | const Glib::ustring & | key | ) | const |
Return value: the double value of key.
key | A key. |
double Gtk::PrintSettings::get_double_with_default | ( | const Glib::ustring & | key, | |
double | def | |||
) | const |
Return value: the floating point number associated with key.
key | A key. | |
def | The default value. |
PrintDuplex Gtk::PrintSettings::get_duplex | ( | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_DUPLEX.
Glib::ustring Gtk::PrintSettings::get_finishings | ( | ) | const |
int Gtk::PrintSettings::get_int | ( | const Glib::ustring & | key | ) | const |
Return value: the integer value of key.
key | A key. |
int Gtk::PrintSettings::get_int_with_default | ( | const Glib::ustring & | key, | |
int | def | |||
) | const |
Return value: the integer value of key.
key | A key. | |
def | The default value. |
double Gtk::PrintSettings::get_length | ( | const Glib::ustring & | key, | |
Unit | unit | |||
) | const |
Return value: the length value of key , converted to unit.
key | A key. | |
unit | The unit of the return value. |
Glib::ustring Gtk::PrintSettings::get_media_type | ( | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_MEDIA_TYPE.
The set of media types is defined in PWG 5101.1-2002 PWG. <!-- FIXME link here -->
int Gtk::PrintSettings::get_n_copies | ( | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_N_COPIES.
int Gtk::PrintSettings::get_number_up | ( | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_NUMBER_UP.
PageOrientation Gtk::PrintSettings::get_orientation | ( | ) | const |
Get the value of Gtk::PRINT_SETTINGS_ORIENTATION, converted to a Gtk::PageOrientation.
Glib::ustring Gtk::PrintSettings::get_output_bin | ( | ) | const |
Glib::ArrayHandle<PageRange> Gtk::PrintSettings::get_page_ranges | ( | ) | const |
PageSet Gtk::PrintSettings::get_page_set | ( | ) | const |
double Gtk::PrintSettings::get_paper_height | ( | Unit | unit | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_HEIGHT, converted to unit .
unit | The unit for the return value. |
const PaperSize Gtk::PrintSettings::get_paper_size | ( | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize.
PaperSize Gtk::PrintSettings::get_paper_size | ( | ) |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize.
double Gtk::PrintSettings::get_paper_width | ( | Unit | unit | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_PAPER_WIDTH, converted to unit .
unit | The unit for the return value. |
PrintPages Gtk::PrintSettings::get_print_pages | ( | ) | const |
Glib::ustring Gtk::PrintSettings::get_printer | ( | ) | const |
Convenience function to obtain the value of Gtk::PRINT_SETTINGS_PRINTER.
PrintQuality Gtk::PrintSettings::get_quality | ( | ) | const |
int Gtk::PrintSettings::get_resolution | ( | ) | const |
bool Gtk::PrintSettings::get_reverse | ( | ) | const |
Gets the value of Gtk::PRINT_SETTINGS_REVERSE.
double Gtk::PrintSettings::get_scale | ( | ) | const |
bool Gtk::PrintSettings::get_use_color | ( | ) | const |
const GtkPrintSettings* Gtk::PrintSettings::gobj | ( | ) | const [inline] |
GtkPrintSettings* Gtk::PrintSettings::gobj | ( | ) | [inline] |
GtkPrintSettings* Gtk::PrintSettings::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool Gtk::PrintSettings::has_key | ( | const Glib::ustring & | key | ) | const |
Return value: true
, if key has a value.
key | A key. |
true
, if key has a valuebool Gtk::PrintSettings::save_to_file | ( | const std::string & | file_name | ) | const |
This function saves the print settings from settings to file_name .
throws FileError
file_name | The file to save to. |
true
on successvoid Gtk::PrintSettings::save_to_key_file | ( | Glib::KeyFile & | key_file | ) |
This function adds the print settings from settings to key_file, in the "Print Settings" group.
key_file | The Glib::KeyFile to save the print settings to. |
void Gtk::PrintSettings::save_to_key_file | ( | Glib::KeyFile & | key_file, | |
const Glib::ustring & | group_name | |||
) | const |
This function adds the print settings from settings to key_file .
key_file | The Glib::KeyFile to save the print settings to. | |
group_name | The group to add the settings to in key_file . |
void Gtk::PrintSettings::set | ( | const Glib::ustring & | key, | |
const Glib::ustring & | value | |||
) |
void Gtk::PrintSettings::set_bool | ( | const Glib::ustring & | key, | |
bool | value = true | |||
) |
void Gtk::PrintSettings::set_collate | ( | bool | collate = true |
) |
Sets the value of Gtk::PRINT_SETTINGS_COLLATE.
collate | Whether to collate the output. |
void Gtk::PrintSettings::set_default_source | ( | const Glib::ustring & | default_source | ) |
Sets the value of Gtk::PRINT_SETTINGS_DEFAULT_SOURCE.
default_source | The default source. |
void Gtk::PrintSettings::set_dither | ( | const Glib::ustring & | dither | ) |
Sets the value of Gtk::PRINT_SETTINGS_DITHER.
dither | The dithering that is used. |
void Gtk::PrintSettings::set_double | ( | const Glib::ustring & | key, | |
double | value | |||
) |
void Gtk::PrintSettings::set_duplex | ( | PrintDuplex | duplex | ) |
void Gtk::PrintSettings::set_finishings | ( | const Glib::ustring & | finishings | ) |
Sets the value of Gtk::PRINT_SETTINGS_FINISHINGS.
finishings | The finishings. |
void Gtk::PrintSettings::set_int | ( | const Glib::ustring & | key, | |
int | value | |||
) |
void Gtk::PrintSettings::set_length | ( | const Glib::ustring & | key, | |
double | value, | |||
Unit | unit | |||
) |
Associates a length in units of unit with key .
key | A key. | |
value | A length. | |
unit | The unit of length . |
void Gtk::PrintSettings::set_media_type | ( | const Glib::ustring & | media_type | ) |
Sets the value of Gtk::PRINT_SETTINGS_MEDIA_TYPE.
The set of media types is defined in PWG 5101.1-2002 PWG. <!-- FIXME link here -->
media_type | The media type. |
void Gtk::PrintSettings::set_n_copies | ( | int | num_copies | ) |
Sets the value of Gtk::PRINT_SETTINGS_N_COPIES.
num_copies | The number of copies. |
void Gtk::PrintSettings::set_number_up | ( | int | number_up | ) |
Sets the value of Gtk::PRINT_SETTINGS_NUMBER_UP.
number_up | The number of pages per sheet. |
void Gtk::PrintSettings::set_orientation | ( | PageOrientation | orientation | ) |
Sets the value of Gtk::PRINT_SETTINGS_ORIENTATION.
orientation | A page orientation. |
void Gtk::PrintSettings::set_output_bin | ( | const Glib::ustring & | output_bin | ) |
Sets the value of Gtk::PRINT_SETTINGS_OUTPUT_BIN.
output_bin | The output bin. |
void Gtk::PrintSettings::set_page_ranges | ( | const Glib::ArrayHandle<PageRange>& | page_ranges | ) |
void Gtk::PrintSettings::set_page_set | ( | PageSet | page_set | ) |
void Gtk::PrintSettings::set_paper_height | ( | double | height, | |
Unit | unit | |||
) |
Sets the value of Gtk::PRINT_SETTINGS_PAPER_HEIGHT.
height | The paper height. | |
unit | The units of height . |
void Gtk::PrintSettings::set_paper_size | ( | const PaperSize& | paper_size | ) |
Sets the value of Gtk::PRINT_SETTINGS_PAPER_FORMAT, Gtk::PRINT_SETTINGS_PAPER_WIDTH and Gtk::PRINT_SETTINGS_PAPER_HEIGHT.
paper_size | A paper size. |
void Gtk::PrintSettings::set_paper_width | ( | double | width, | |
Unit | unit | |||
) |
Sets the value of Gtk::PRINT_SETTINGS_PAPER_WIDTH.
width | The paper width. | |
unit | The units of width . |
void Gtk::PrintSettings::set_print_pages | ( | PrintPages | print_pages | ) |
void Gtk::PrintSettings::set_printer | ( | const Glib::ustring & | name | ) |
Convenience function to set Gtk::PRINT_SETTINGS_PRINTER to printer .
printer | The printer name. |
void Gtk::PrintSettings::set_quality | ( | PrintQuality | quality | ) |
void Gtk::PrintSettings::set_resolution | ( | int | resolution | ) |
Sets the value of Gtk::PRINT_SETTINGS_RESOLUTION.
resolution | The resolution in dpi. |
void Gtk::PrintSettings::set_reverse | ( | bool | reverse = true |
) |
Sets the value of Gtk::PRINT_SETTINGS_REVERSE.
reverse | Whether to reverse the output. |
void Gtk::PrintSettings::set_scale | ( | double | scale | ) |
Sets the value of Gtk::PRINT_SETTINGS_SCALE.
scale | The scale in percent. |
void Gtk::PrintSettings::set_use_color | ( | bool | use_color = true |
) |
Sets the value of Gtk::PRINT_SETTINGS_USE_COLOR.
use_color | Whether to use color. |
void Gtk::PrintSettings::setting_foreach | ( | const SlotForeach& | slot | ) |
Calls a function for each print setting.
slot | The callback to call for each print setting. |
void Gtk::PrintSettings::unset | ( | const Glib::ustring & | key | ) |
Removes any value associated with key .
This has the same effect as setting the value to 0
.
key | A key. |
Glib::RefPtr<Gtk::PrintSettings> wrap | ( | GtkPrintSettings * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
object | The C instance. | |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |