gtkmm: Gtk::PrintSettings Class Reference
A PrintSettings object represents the settings of a print dialog in a system-independent way. More...
#include <gtkmm/printsettings.h>
Classes | |
class | Keys |
Print settings keys. More... | |
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);. More... | |
Public Types inherited from Glib::Object | |
typedef void(*)(gpointer data | DestroyNotify) |
Public Types inherited from sigc::trackable | |
typedef internal::func_destroy_notify | func_destroy_notify |
Public Types inherited from sigc::notifiable | |
typedef internal::func_destroy_notify | func_destroy_notify |
Public Member Functions | |
PrintSettings (PrintSettings&& src) noexcept | |
PrintSettings& | operator= (PrintSettings&& src) noexcept |
~PrintSettings () noexcept override | |
GtkPrintSettings* | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkPrintSettings* | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkPrintSettings* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
Glib::RefPtr< PrintSettings > | copy () const |
Copies a Gtk::PrintSettings object. More... | |
bool | load_from_file (const std::string& file_name) |
Reads the print settings from file_name. More... | |
bool | load_from_key_file (const Glib::RefPtr< const Glib::KeyFile >& key_file, const Glib::ustring& group_name) |
Reads the print settings from the group group_name in key_file. More... | |
bool | load_from_key_file (const Glib::RefPtr< const Glib::KeyFile >& key_file) |
Reads the print settings from the key_file. More... | |
bool | save_to_file (const std::string& file_name) const |
This function saves the print settings from settings to file_name. More... | |
void | save_to_key_file (const Glib::RefPtr< Glib::KeyFile >& key_file, const Glib::ustring& group_name) const |
This function adds the print settings from settings to key_file. More... | |
void | save_to_key_file (const Glib::RefPtr< Glib::KeyFile >& key_file) const |
This function adds the print settings from settings to key_file, in the "Print Settings" group. More... | |
bool | has_key (const Glib::ustring& key) const |
Returns true , if a value is associated with key. More... | |
Glib::ustring | get (const Glib::ustring& key) const |
Looks up the string value associated with key. More... | |
void | set (const Glib::ustring& key, const Glib::ustring& value) |
Associates value with key. More... | |
void | unset (const Glib::ustring& key) |
Removes any value associated with key. More... | |
void | setting_foreach (const SlotForeach& slot) |
Calls a function for each print setting. More... | |
bool | get_bool (const Glib::ustring& key) const |
Returns the boolean represented by the value that is associated with key. More... | |
void | set_bool (const Glib::ustring& key, bool value=true) |
Sets key to a boolean value. More... | |
double | get_double (const Glib::ustring& key) const |
Returns the double value associated with key, or 0. More... | |
double | get_double_with_default (const Glib::ustring& key, double def) const |
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. More... | |
void | set_double (const Glib::ustring& key, double value) |
Sets key to a double value. More... | |
double | get_length (const Glib::ustring& key, Unit unit) const |
Returns the value associated with key, interpreted as a length. More... | |
void | set_length (const Glib::ustring& key, double value, Unit unit) |
Associates a length in units of unit with key. More... | |
int | get_int (const Glib::ustring& key) const |
Returns the integer value of key, or 0. More... | |
int | get_int_with_default (const Glib::ustring& key, int def) const |
Returns the value of key, interpreted as an integer, or the default value. More... | |
void | set_int (const Glib::ustring& key, int value) |
Sets key to an integer value. More... | |
Glib::ustring | get_printer () const |
Convenience function to obtain the value of GTK_PRINT_SETTINGS_PRINTER. More... | |
void | set_printer (const Glib::ustring& printer) |
Convenience function to set GTK_PRINT_SETTINGS_PRINTER to printer. More... | |
PageOrientation | get_orientation () const |
Get the value of GTK_PRINT_SETTINGS_ORIENTATION, converted to a Gtk::PageOrientation. More... | |
void | set_orientation (PageOrientation orientation) |
Sets the value of GTK_PRINT_SETTINGS_ORIENTATION. More... | |
PaperSize | get_paper_size () |
Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize. More... | |
const PaperSize | get_paper_size () const |
Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize. More... | |
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. More... | |
double | get_paper_width (Unit unit) const |
Gets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to unit. More... | |
void | set_paper_width (double width, Unit unit) |
Sets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH. More... | |
double | get_paper_height (Unit unit) const |
Gets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to unit. More... | |
void | set_paper_height (double height, Unit unit) |
Sets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT. More... | |
bool | get_use_color () const |
Gets the value of GTK_PRINT_SETTINGS_USE_COLOR. More... | |
void | set_use_color (bool use_color=true) |
Sets the value of GTK_PRINT_SETTINGS_USE_COLOR. More... | |
bool | get_collate () const |
Gets the value of GTK_PRINT_SETTINGS_COLLATE. More... | |
void | set_collate (bool collate=true) |
Sets the value of GTK_PRINT_SETTINGS_COLLATE. More... | |
bool | get_reverse () const |
Gets the value of GTK_PRINT_SETTINGS_REVERSE. More... | |
void | set_reverse (bool reverse=true) |
Sets the value of GTK_PRINT_SETTINGS_REVERSE. More... | |
PrintDuplex | get_duplex () const |
Gets the value of GTK_PRINT_SETTINGS_DUPLEX. More... | |
void | set_duplex (PrintDuplex duplex) |
Sets the value of GTK_PRINT_SETTINGS_DUPLEX. More... | |
PrintQuality | get_quality () const |
Gets the value of GTK_PRINT_SETTINGS_QUALITY. More... | |
void | set_quality (PrintQuality quality) |
Sets the value of GTK_PRINT_SETTINGS_QUALITY. More... | |
int | get_n_copies () const |
Gets the value of GTK_PRINT_SETTINGS_N_COPIES. More... | |
void | set_n_copies (int num_copies) |
Sets the value of GTK_PRINT_SETTINGS_N_COPIES. More... | |
int | get_number_up () const |
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP. More... | |
void | set_number_up (int number_up) |
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP. More... | |
NumberUpLayout | get_number_up_layout () const |
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT. More... | |
void | set_number_up (NumberUpLayout number_up_layout) |
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT. More... | |
int | get_resolution () const |
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION. More... | |
void | set_resolution (int resolution) |
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y. More... | |
int | get_resolution_x () const |
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_X. More... | |
int | get_resolution_y () const |
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_Y. More... | |
void | set_resolution_xy (int resolution_x, int resolution_y) |
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y. More... | |
double | get_printer_lpi () const |
Gets the value of GTK_PRINT_SETTINGS_PRINTER_LPI. More... | |
void | set_printer_lpi (double lpi) |
Sets the value of GTK_PRINT_SETTINGS_PRINTER_LPI. More... | |
double | get_scale () const |
Gets the value of GTK_PRINT_SETTINGS_SCALE. More... | |
void | set_scale (double scale) |
Sets the value of GTK_PRINT_SETTINGS_SCALE. More... | |
PrintPages | get_print_pages () const |
Gets the value of GTK_PRINT_SETTINGS_PRINT_PAGES. More... | |
void | set_print_pages (PrintPages pages) |
Sets the value of GTK_PRINT_SETTINGS_PRINT_PAGES. More... | |
std::vector< PageRange > | get_page_ranges () const |
void | set_page_ranges (const std::vector< PageRange >& page_ranges) |
PageSet | get_page_set () const |
Gets the value of GTK_PRINT_SETTINGS_PAGE_SET. More... | |
void | set_page_set (PageSet page_set) |
Sets the value of GTK_PRINT_SETTINGS_PAGE_SET. More... | |
Glib::ustring | get_default_source () const |
Gets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE. More... | |
void | set_default_source (const Glib::ustring& default_source) |
Sets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE. More... | |
Glib::ustring | get_media_type () const |
Gets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. More... | |
void | set_media_type (const Glib::ustring& media_type) |
Sets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. More... | |
Glib::ustring | get_dither () const |
Gets the value of GTK_PRINT_SETTINGS_DITHER. More... | |
void | set_dither (const Glib::ustring& dither) |
Sets the value of GTK_PRINT_SETTINGS_DITHER. More... | |
Glib::ustring | get_finishings () const |
Gets the value of GTK_PRINT_SETTINGS_FINISHINGS. More... | |
void | set_finishings (const Glib::ustring& finishings) |
Sets the value of GTK_PRINT_SETTINGS_FINISHINGS. More... | |
Glib::ustring | get_output_bin () const |
Gets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN. More... | |
void | set_output_bin (const Glib::ustring& output_bin) |
Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN. More... | |
Public Member Functions inherited from Glib::Object | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (Object &&src) noexcept |
void * | get_data (const QueryQuark &key) |
void | set_data (const Quark &key, void *data) |
void | set_data (const Quark &key, void *data, DestroyNotify notify) |
void | remove_data (const QueryQuark &quark) |
void * | steal_data (const QueryQuark &quark) |
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false) |
Public Member Functions inherited from Glib::ObjectBase | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value) |
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const |
void | set_property (const Glib::ustring &property_name, const PropertyType &value) |
void | get_property (const Glib::ustring &property_name, PropertyType &value) const |
PropertyType | get_property (const Glib::ustring &property_name) const |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot) |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot) |
void | freeze_notify () |
void | thaw_notify () |
virtual void | reference () const |
virtual void | unreference () const |
GObject * | gobj () |
const GObject * | gobj () const |
GObject * | gobj_copy () const |
Public Member Functions inherited from sigc::trackable | |
trackable () noexcept | |
trackable (const trackable &src) noexcept | |
trackable (trackable &&src) noexcept | |
~trackable () | |
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const |
void | notify_callbacks () |
trackable & | operator= (const trackable &src) |
trackable & | operator= (trackable &&src) noexcept |
void | remove_destroy_notify_callback (notifiable *data) const |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
static Glib::RefPtr< PrintSettings > | create () |
static Glib::RefPtr< PrintSettings > | create_from_key_file (const Glib::RefPtr< const Glib::KeyFile >& key_file) |
Reads the print settings from the key_file. More... | |
static Glib::RefPtr< PrintSettings > | create_from_key_file (const Glib::RefPtr< const Glib::KeyFile >& key_file, const Glib::ustring& group_name) |
Reads the print settings from the group group_name in key_file. More... | |
static Glib::RefPtr< PrintSettings > | create_from_file (const std::string& file_name) |
Reads the print settings from file_name. More... | |
Protected Member Functions | |
PrintSettings () | |
Protected Member Functions inherited from Glib::Object | |
Object () | |
Object (const Glib::ConstructParams &construct_params) | |
Object (GObject *castitem) | |
~Object () noexcept override | |
Protected Member Functions inherited from Glib::ObjectBase | |
ObjectBase () | |
ObjectBase (const char *custom_type_name) | |
ObjectBase (const std::type_info &custom_type_info) | |
ObjectBase (ObjectBase &&src) noexcept | |
ObjectBase & | operator= (ObjectBase &&src) noexcept |
virtual | ~ObjectBase () noexcept=0 |
void | initialize (GObject *castitem) |
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper) |
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. More... | |
Detailed Description
A 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.
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.
Member Typedef Documentation
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);.
Constructor & Destructor Documentation
|
noexcept |
|
overridenoexcept |
|
protected |
Member Function Documentation
Glib::RefPtr<PrintSettings> Gtk::PrintSettings::copy | ( | ) | const |
Copies a Gtk::PrintSettings object.
- Returns
- A newly allocated copy of other.
|
static |
|
static |
Reads the print settings from file_name.
Returns a new PrintSettings object with the restored settings, or an empty RefPtr if an error occurred. See save_to_file().
- Parameters
-
file_name The filename to read the settings from.
- Returns
- the restored PrintSettings
- Exceptions
-
KeyFileError,FileError
|
static |
Reads the print settings from the key_file.
Returns a new PrintSettings object with the restored settings, or an empty RefPtr if an error occurred. See save_to_key_file().
- Parameters
-
key_file The KeyFile to retrieve the settings from.
- Returns
- the restored PrintSettings
- Exceptions
-
KeyFileError,FileError
|
static |
Reads the print settings from the group group_name in key_file.
Returns a new PrintSettings object with the restored settings, or an empty RefPtr if an error occurred. See save_to_key_file().
- Parameters
-
key_file The KeyFile to retrieve the settings from. group_name The name of the group to use.
- Returns
- the restored PrintSettings
- Exceptions
-
KeyFileError,FileError
Glib::ustring Gtk::PrintSettings::get | ( | const Glib::ustring & | key | ) | const |
Looks up the string value associated with key.
- Parameters
-
key A key.
- Returns
- The string value for key.
bool Gtk::PrintSettings::get_bool | ( | const Glib::ustring & | key | ) | const |
Returns the boolean represented by the value that is associated with key.
The string “true” represents true
, any other string false
.
- Parameters
-
key A key.
- Returns
true
, if key maps to a true value.
bool Gtk::PrintSettings::get_collate | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_COLLATE.
- Returns
- Whether to collate the printed pages.
Glib::ustring Gtk::PrintSettings::get_default_source | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
- Returns
- The default source.
Glib::ustring Gtk::PrintSettings::get_dither | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_DITHER.
- Returns
- The dithering that is used.
double Gtk::PrintSettings::get_double | ( | const Glib::ustring & | key | ) | const |
Returns the double value associated with key, or 0.
- Parameters
-
key A key.
- Returns
- The double value of key.
double Gtk::PrintSettings::get_double_with_default | ( | const Glib::ustring & | key, |
double | def | ||
) | const |
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 Glib::ascii_strtod().
- Parameters
-
key A key. def The default value.
- Returns
- The floating point number associated with key.
PrintDuplex Gtk::PrintSettings::get_duplex | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_DUPLEX.
- Returns
- Whether to print the output in duplex.
Glib::ustring Gtk::PrintSettings::get_finishings | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_FINISHINGS.
- Returns
- The finishings.
int Gtk::PrintSettings::get_int | ( | const Glib::ustring & | key | ) | const |
Returns the integer value of key, or 0.
- Parameters
-
key A key.
- Returns
- The integer value of key.
int Gtk::PrintSettings::get_int_with_default | ( | const Glib::ustring & | key, |
int | def | ||
) | const |
Returns the value of key, interpreted as an integer, or the default value.
- Parameters
-
key A key. def The default value.
- Returns
- The integer value of key.
double Gtk::PrintSettings::get_length | ( | const Glib::ustring & | key, |
Unit | unit | ||
) | const |
Returns the value associated with key, interpreted as a length.
The returned value is converted to units.
- Parameters
-
key A key. unit The unit of the return value.
- Returns
- The length value of key, converted to unit.
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.
- Returns
- The media type.
int Gtk::PrintSettings::get_n_copies | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_N_COPIES.
- Returns
- The number of copies to print.
int Gtk::PrintSettings::get_number_up | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP.
- Returns
- The number of pages per sheet.
NumberUpLayout Gtk::PrintSettings::get_number_up_layout | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
- Returns
- Layout of page in number-up mode.
PageOrientation Gtk::PrintSettings::get_orientation | ( | ) | const |
Get the value of GTK_PRINT_SETTINGS_ORIENTATION, converted to a Gtk::PageOrientation.
- Returns
- The orientation.
Glib::ustring Gtk::PrintSettings::get_output_bin | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.
- Returns
- The output bin.
std::vector<PageRange> Gtk::PrintSettings::get_page_ranges | ( | ) | const |
PageSet Gtk::PrintSettings::get_page_set | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_PAGE_SET.
- Returns
- The set of pages to print.
double Gtk::PrintSettings::get_paper_height | ( | Unit | unit | ) | const |
Gets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to unit.
- Parameters
-
unit The unit for the return value.
- Returns
- The paper height, in units of unit.
PaperSize Gtk::PrintSettings::get_paper_size | ( | ) |
Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize.
- Returns
- The paper size.
const PaperSize Gtk::PrintSettings::get_paper_size | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk::PaperSize.
- Returns
- The paper size.
double Gtk::PrintSettings::get_paper_width | ( | Unit | unit | ) | const |
Gets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to unit.
- Parameters
-
unit The unit for the return value.
- Returns
- The paper width, in units of unit.
PrintPages Gtk::PrintSettings::get_print_pages | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.
- Returns
- Which pages to print.
Glib::ustring Gtk::PrintSettings::get_printer | ( | ) | const |
Convenience function to obtain the value of GTK_PRINT_SETTINGS_PRINTER.
- Returns
- The printer name.
double Gtk::PrintSettings::get_printer_lpi | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.
- Returns
- The resolution in lpi (lines per inch).
PrintQuality Gtk::PrintSettings::get_quality | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_QUALITY.
- Returns
- The print quality.
int Gtk::PrintSettings::get_resolution | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION.
- Returns
- The resolution in dpi.
int Gtk::PrintSettings::get_resolution_x | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_X.
- Returns
- The horizontal resolution in dpi.
int Gtk::PrintSettings::get_resolution_y | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_Y.
- Returns
- The vertical resolution in dpi.
bool Gtk::PrintSettings::get_reverse | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_REVERSE.
- Returns
- Whether to reverse the order of the printed pages.
double Gtk::PrintSettings::get_scale | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_SCALE.
- Returns
- The scale in percent.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
bool Gtk::PrintSettings::get_use_color | ( | ) | const |
Gets the value of GTK_PRINT_SETTINGS_USE_COLOR.
- Returns
- Whether to use color.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
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 |
Returns true
, if a value is associated with key.
- Parameters
-
key A key.
- Returns
true
, if key has a value.
bool Gtk::PrintSettings::load_from_file | ( | const std::string & | file_name | ) |
Reads the print settings from file_name.
If the file could not be loaded then error is set to either a Glib::FileError or Glib::KeyFileError. See to_file().
- Parameters
-
file_name The filename to read the settings from.
- Returns
true
on success.
- Exceptions
-
Glib::Error
bool Gtk::PrintSettings::load_from_key_file | ( | const Glib::RefPtr< const Glib::KeyFile > & | key_file, |
const Glib::ustring & | group_name | ||
) |
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 Glib::FileError or Glib::KeyFileError.
- Parameters
-
key_file The Glib::KeyFile to retrieve the settings from. group_name The name of the group to use, or nullptr
to use the default “Print Settings”.
- Returns
true
on success.
- Exceptions
-
Glib::Error
bool Gtk::PrintSettings::load_from_key_file | ( | const Glib::RefPtr< const Glib::KeyFile > & | key_file | ) |
Reads the print settings from the key_file.
See save_to_key_file().
- Parameters
-
key_file The KeyFile to retrieve the settings from.
- Returns
- true on success.
- Exceptions
-
KeyFileError,FileError
|
noexcept |
bool Gtk::PrintSettings::save_to_file | ( | const std::string & | file_name | ) | const |
This function saves the print settings from settings to file_name.
- Exceptions
-
FileError
- Parameters
-
file_name The file to save to.
- Returns
true
on success.
void Gtk::PrintSettings::save_to_key_file | ( | const Glib::RefPtr< Glib::KeyFile > & | key_file, |
const Glib::ustring & | group_name | ||
) | const |
This function adds the print settings from settings to key_file.
- Parameters
-
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::save_to_key_file | ( | const Glib::RefPtr< Glib::KeyFile > & | key_file | ) | const |
This function adds the print settings from settings to key_file, in the "Print Settings" group.
- Parameters
-
key_file The Glib::KeyFile to save the print settings to.
void Gtk::PrintSettings::set | ( | const Glib::ustring & | key, |
const Glib::ustring & | value | ||
) |
Associates value with key.
- Parameters
-
key A key. value A string value, or nullptr
.
void Gtk::PrintSettings::set_bool | ( | const Glib::ustring & | key, |
bool | value = true |
||
) |
Sets key to a boolean value.
- Parameters
-
key A key. value A boolean.
void Gtk::PrintSettings::set_collate | ( | bool | collate = true | ) |
Sets the value of GTK_PRINT_SETTINGS_COLLATE.
- Parameters
-
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.
- Parameters
-
default_source The default source.
void Gtk::PrintSettings::set_dither | ( | const Glib::ustring & | dither | ) |
Sets the value of GTK_PRINT_SETTINGS_DITHER.
- Parameters
-
dither The dithering that is used.
void Gtk::PrintSettings::set_double | ( | const Glib::ustring & | key, |
double | value | ||
) |
Sets key to a double value.
- Parameters
-
key A key. value A double value.
void Gtk::PrintSettings::set_duplex | ( | PrintDuplex | duplex | ) |
Sets the value of GTK_PRINT_SETTINGS_DUPLEX.
- Parameters
-
duplex A Gtk::PrintDuplex value.
void Gtk::PrintSettings::set_finishings | ( | const Glib::ustring & | finishings | ) |
Sets the value of GTK_PRINT_SETTINGS_FINISHINGS.
- Parameters
-
finishings The finishings.
void Gtk::PrintSettings::set_int | ( | const Glib::ustring & | key, |
int | value | ||
) |
Sets key to an integer value.
- Parameters
-
key A key. value An integer.
void Gtk::PrintSettings::set_length | ( | const Glib::ustring & | key, |
double | value, | ||
Unit | unit | ||
) |
Associates a length in units of unit with key.
- Parameters
-
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.
- Parameters
-
media_type The media type.
void Gtk::PrintSettings::set_n_copies | ( | int | num_copies | ) |
Sets the value of GTK_PRINT_SETTINGS_N_COPIES.
- Parameters
-
num_copies The number of copies.
void Gtk::PrintSettings::set_number_up | ( | int | number_up | ) |
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP.
- Parameters
-
number_up The number of pages per sheet.
void Gtk::PrintSettings::set_number_up | ( | NumberUpLayout | number_up_layout | ) |
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
- Parameters
-
number_up_layout A Gtk::NumberUpLayout value.
void Gtk::PrintSettings::set_orientation | ( | PageOrientation | orientation | ) |
Sets the value of GTK_PRINT_SETTINGS_ORIENTATION.
- Parameters
-
orientation A page orientation.
void Gtk::PrintSettings::set_output_bin | ( | const Glib::ustring & | output_bin | ) |
Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.
- Parameters
-
output_bin The output bin.
void Gtk::PrintSettings::set_page_ranges | ( | const std::vector< PageRange >& | page_ranges | ) |
void Gtk::PrintSettings::set_page_set | ( | PageSet | page_set | ) |
Sets the value of GTK_PRINT_SETTINGS_PAGE_SET.
- Parameters
-
page_set A Gtk::PageSet value.
void Gtk::PrintSettings::set_paper_height | ( | double | height, |
Unit | unit | ||
) |
Sets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT.
- Parameters
-
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.
- Parameters
-
paper_size A paper size.
void Gtk::PrintSettings::set_paper_width | ( | double | width, |
Unit | unit | ||
) |
Sets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH.
- Parameters
-
width The paper width. unit The units of width.
void Gtk::PrintSettings::set_print_pages | ( | PrintPages | pages | ) |
Sets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.
- Parameters
-
pages A Gtk::PrintPages value.
void Gtk::PrintSettings::set_printer | ( | const Glib::ustring & | printer | ) |
Convenience function to set GTK_PRINT_SETTINGS_PRINTER to printer.
- Parameters
-
printer The printer name.
void Gtk::PrintSettings::set_printer_lpi | ( | double | lpi | ) |
Sets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.
- Parameters
-
lpi The resolution in lpi (lines per inch).
void Gtk::PrintSettings::set_quality | ( | PrintQuality | quality | ) |
Sets the value of GTK_PRINT_SETTINGS_QUALITY.
- Parameters
-
quality A Gtk::PrintQuality value.
void Gtk::PrintSettings::set_resolution | ( | int | resolution | ) |
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y.
- Parameters
-
resolution The resolution in dpi.
void Gtk::PrintSettings::set_resolution_xy | ( | int | resolution_x, |
int | resolution_y | ||
) |
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y.
- Parameters
-
resolution_x The horizontal resolution in dpi. resolution_y The vertical resolution in dpi.
void Gtk::PrintSettings::set_reverse | ( | bool | reverse = true | ) |
Sets the value of GTK_PRINT_SETTINGS_REVERSE.
- Parameters
-
reverse Whether to reverse the output.
void Gtk::PrintSettings::set_scale | ( | double | scale | ) |
Sets the value of GTK_PRINT_SETTINGS_SCALE.
- Parameters
-
scale The scale in percent.
void Gtk::PrintSettings::set_use_color | ( | bool | use_color = true | ) |
Sets the value of GTK_PRINT_SETTINGS_USE_COLOR.
- Parameters
-
use_color Whether to use color.
void Gtk::PrintSettings::setting_foreach | ( | const SlotForeach& | slot | ) |
Calls a function for each print setting.
- Parameters
-
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 nullptr
.
- Parameters
-
key A key.
Friends And Related Function Documentation
|
related |
A Glib::wrap() method for this object.
- Parameters
-
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.
- Returns
- A C++ instance that wraps this C instance.