Gtk::PageSetup Class Reference
Printing

A PageSetup object stores the page size, orientation and margins. More...

Inheritance diagram for Gtk::PageSetup:
[legend]
Collaboration diagram for Gtk::PageSetup:
[legend]

## Public Member Functions

| PageSetup (PageSetup&& src) noexcept
PageSetup& | operator= (PageSetup&& src) noexcept
| ~PageSetup () noexceptoverride
GtkPageSetup* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkPageSetup* | gobj () const
| Provides access to the underlying C GObject. More...
GtkPageSetup* | 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< PageSetup > | copy () const
| Copies a Gtk::PageSetup. More...
bool | load_from_file (const std::string& file_name)
| Reads the page setup from the file file_name. More...
bool | load_from_key_file (const Glib::KeyFile& key_file, const Glib::ustring& group_name)
| Reads the page setup from the group group_name in the key file key_file. More...
bool | load_from_key_file (const Glib::KeyFile& key_file)
| Reads the page setup from the "Page Setup" group in the key file key_file. More...
PageOrientation | get_orientation () const
| Gets the page orientation of the Gtk::PageSetup. More...
void | set_orientation (PageOrientation orientation)
| Sets the page orientation of the Gtk::PageSetup. More...
PaperSize | get_paper_size ()
| Gets the paper size of the Gtk::PageSetup. More...
const PaperSize | get_paper_size () const
| Gets the paper size of the Gtk::PageSetup. More...
void | set_paper_size (const PaperSize& paper_size)
| Sets the paper size of the Gtk::PageSetup without changing the margins. More...
double | get_top_margin (Unit unit) const
| Gets the top margin in units of unit. More...
void | set_top_margin (double margin, Unit unit)
| Sets the top margin of the Gtk::PageSetup. More...
double | get_bottom_margin (Unit unit) const
| Gets the bottom margin in units of unit. More...
void | set_bottom_margin (double margin, Unit unit)
| Sets the bottom margin of the Gtk::PageSetup. More...
double | get_left_margin (Unit unit) const
| Gets the left margin in units of unit. More...
void | set_left_margin (double margin, Unit unit)
| Sets the left margin of the Gtk::PageSetup. More...
double | get_right_margin (Unit unit) const
| Gets the right margin in units of unit. More...
void | set_right_margin (double margin, Unit unit)
| Sets the right margin of the Gtk::PageSetup. More...
void | set_paper_size_and_default_margins (const PaperSize& paper_size)
| Sets the paper size of the Gtk::PageSetup and modifies the margins according to the new paper size. More...
double | get_paper_width (Unit unit) const
| Returns the paper width in units of unit. More...
double | get_paper_height (Unit unit) const
| Returns the paper height in units of unit. More...
double | get_page_width (Unit unit) const
| Returns the page width in units of unit. More...
double | get_page_height (Unit unit) const
| Returns the page height in units of unit. More...
bool | save_to_file (const std::string& file_name) const
| This function saves the information from setup to file_name. More...
void | save_to_key_file (Glib::KeyFile& key_file, const Glib::ustring& group_name)
| This function adds the page setup from setup to key_file. More...
void | save_to_key_file (Glib::KeyFile& key_file, const Glib::ustring& group_name) const
| This function adds the page setup from setup to key_file. More...
void | save_to_key_file (Glib::KeyFile& key_file)
| This function adds the page setup from setup to key_file, in the group "Page Setup". More...
void | save_to_key_file (Glib::KeyFile& key_file) const
| This function adds the page setup from setup to key_file, in the group "Page Setup". 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
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (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)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *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< PageSetup > | create ()
static Glib::RefPtr< PageSetup > | create_from_key_file (const Glib::KeyFile& key_file)
| Reads the page setup from the "Page Setup" group in the key file key_file. More...
static Glib::RefPtr< PageSetup > | create_from_key_file (const Glib::KeyFile& key_file, const Glib::ustring& group_name)
| Reads the page setup from the group group_name in the key file key_file. More...
static Glib::RefPtr< PageSetup > | create_from_file (const std::string& file_name)
| Reads the page setup from the file . More...

## Protected Member Functions

| PageSetup ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexceptoverride
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::PageSetup > | wrap (GtkPageSetup* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members

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

## Detailed Description

A PageSetup object stores the page size, orientation and margins.

You can get one of these from the page setup dialog and then pass it to the PrintOperation when printing. The benefit of splitting this out of the PrintSettings is that these affect the actual layout of the page, and thus need to be set long before the user prints.

The margins specified in this object are the "print margins", i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.

To obtain a PageSetup use PageSetup::create() to get the defaults, or use run_page_setup_dialog() to show the page setup dialog and receive the resulting page setup.

Since gtkmm 2.10:

## Constructor & Destructor Documentation

Gtk::PageSetup::PageSetup | ( | PageSetup&& | src | ) |

noexcept

Gtk::PageSetup::~PageSetup | ( |  | ) |

overridenoexcept

Gtk::PageSetup::PageSetup | ( |  | ) |

protected

## Member Function Documentation

Glib::RefPtr<PageSetup> Gtk::PageSetup::copy | ( |  | ) | const

Copies a Gtk::PageSetup.

Since gtkmm 2.10:

Returns
  A copy of other.

static Glib::RefPtr<PageSetup> Gtk::PageSetup::create | ( |  | ) |

static

static Glib::RefPtr<PageSetup> Gtk::PageSetup::create_from_file | ( | const std::string & | file_name | ) |

static

Reads the page setup from the file .

Returns a new PageSetup object with the restored page setup, or an empty RefPtr if an error occurred. See save_to_file().

Parameters

  file_name | The filename to read the page setup from.

Returns
  The restored PageSetup

Since gtkmm 2.14:

static Glib::RefPtr<PageSetup> Gtk::PageSetup::create_from_key_file | ( | const Glib::KeyFile & | key_file | ) |

static

Reads the page setup from the "Page Setup" group in the key file key_file.

Returns a new PageSetup object with the restored page setup, or an empty RefPtr if an error occurred.

Parameters

  key_file | The KeyFile to retrieve the page setup from.

Returns
  The restored PageSetup

Exceptions

  KeyFileError |

Since gtkmm 2.14:

static Glib::RefPtr<PageSetup> Gtk::PageSetup::create_from_key_file | ( | const Glib::KeyFile & | key_file,
|  | const Glib::ustring & | group_name
| ) |  |

static

Reads the page setup from the group group_name in the key file key_file.

Returns a new PageSetup object with the restored page setup, or an empty RefPtr if an error occurred.

Parameters

  key_file | The KeyFile to retrieve the page setup from.
  group_name | The name of the group in the key_file to read.

Returns
  The restored PageSetup

Exceptions

  KeyFileError |

Since gtkmm 2.14:

double Gtk::PageSetup::get_bottom_margin | ( | Unit | unit | ) | const

Gets the bottom margin in units of unit.

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The bottom margin.

double Gtk::PageSetup::get_left_margin | ( | Unit | unit | ) | const

Gets the left margin in units of unit.

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The left margin.

PageOrientation Gtk::PageSetup::get_orientation | ( |  | ) | const

Gets the page orientation of the Gtk::PageSetup.

Since gtkmm 2.10:

Returns
  The page orientation.

double Gtk::PageSetup::get_page_height | ( | Unit | unit | ) | const

Returns the page height in units of unit.

Note that this function takes orientation and margins into consideration. See get_paper_height().

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The page height.

double Gtk::PageSetup::get_page_width | ( | Unit | unit | ) | const

Returns the page width in units of unit.

Note that this function takes orientation and margins into consideration. See get_paper_width().

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The page width.

double Gtk::PageSetup::get_paper_height | ( | Unit | unit | ) | const

Returns the paper height in units of unit.

Note that this function takes orientation, but not margins into consideration. See get_page_height().

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The paper height.

PaperSize Gtk::PageSetup::get_paper_size | ( |  | ) |

Gets the paper size of the Gtk::PageSetup.

Since gtkmm 2.10:

Returns
  The paper size.

const PaperSize Gtk::PageSetup::get_paper_size | ( |  | ) | const

Gets the paper size of the Gtk::PageSetup.

Since gtkmm 2.10:

Returns
  The paper size.

double Gtk::PageSetup::get_paper_width | ( | Unit | unit | ) | const

Returns the paper width in units of unit.

Note that this function takes orientation, but not margins into consideration. See get_page_width().

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The paper width.

double Gtk::PageSetup::get_right_margin | ( | Unit | unit | ) | const

Gets the right margin in units of unit.

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The right margin.

double Gtk::PageSetup::get_top_margin | ( | Unit | unit | ) | const

Gets the top margin in units of unit.

Since gtkmm 2.10:

Parameters

  unit | The unit for the return value.

Returns
  The top margin.

static GType Gtk::PageSetup::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

GtkPageSetup* Gtk::PageSetup::gobj | ( |  | ) |

inline

Provides access to the underlying C GObject.

const GtkPageSetup* Gtk::PageSetup::gobj | ( |  | ) | const

inline

Provides access to the underlying C GObject.

GtkPageSetup* Gtk::PageSetup::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::PageSetup::load_from_file | ( | const std::string & | file_name | ) |

Reads the page setup from the file file_name.

See to_file().

Since gtkmm 2.14:

Parameters

  file_name | The filename to read the page setup from.

Returns
  `true` on success.

bool Gtk::PageSetup::load_from_key_file | ( | const Glib::KeyFile & | key_file,
|  | const Glib::ustring & | group_name
| ) |  |

Reads the page setup from the group group_name in the key file key_file.

Since gtkmm 2.14:

Parameters

  key_file | The KeyFile to retrieve the page_setup from.
  group_name | The name of the group in the key_file to read, or `nullptr` to use the default name "Page Setup".

Returns
  `true` on success.

bool Gtk::PageSetup::load_from_key_file | ( | const Glib::KeyFile & | key_file | ) |

Reads the page setup from the "Page Setup" group in the key file key_file.

Parameters

  key_file | The KeyFile to retrieve the page setup from.

Returns
  true on success

Exceptions

  KeyFileError |

Since gtkmm 2.14:

PageSetup& Gtk::PageSetup::operator= | ( | PageSetup&& | src | ) |

noexcept

bool Gtk::PageSetup::save_to_file | ( | const std::string & | file_name | ) | const

This function saves the information from setup to file_name.

Exceptions

  Glib::FileError |

Parameters

  file_name | The file to save to.

Returns
  `true` on success

Since gtkmm 2.12:

void Gtk::PageSetup::save_to_key_file | ( | Glib::KeyFile & | key_file,
|  | const Glib::ustring & | group_name
| ) |  |

This function adds the page setup from setup to key_file.

Since gtkmm 2.12:

Deprecated:
  Use the const version.

Parameters

  key_file | The Glib::KeyFile to save the page setup to.
  group_name | The group to add the settings to in key_file.

void Gtk::PageSetup::save_to_key_file | ( | Glib::KeyFile & | key_file,
|  | const Glib::ustring & | group_name
| ) |  | const

This function adds the page setup from setup to key_file.

Since gtkmm 2.12:

Parameters

  key_file | The Glib::KeyFile to save the page setup to.
  group_name | The group to add the settings to in key_file.

void Gtk::PageSetup::save_to_key_file | ( | Glib::KeyFile & | key_file | ) |

This function adds the page setup from setup to key_file, in the group "Page Setup".

Since gtkmm 2.12:

Parameters

  key_file | The G::KeyFile to save the page setup to.

Deprecated:
  Use the const version.

void Gtk::PageSetup::save_to_key_file | ( | Glib::KeyFile & | key_file | ) | const

This function adds the page setup from setup to key_file, in the group "Page Setup".

Since gtkmm 2.12:

Parameters

  key_file | The G::KeyFile to save the page setup to.

void Gtk::PageSetup::set_bottom_margin | ( | double | margin,
|  | Unit | unit
| ) |  |

Sets the bottom margin of the Gtk::PageSetup.

Since gtkmm 2.10:

Parameters

  margin | The new bottom margin in units of unit.
  unit | The units for margin.

void Gtk::PageSetup::set_left_margin | ( | double | margin,
|  | Unit | unit
| ) |  |

Sets the left margin of the Gtk::PageSetup.

Since gtkmm 2.10:

Parameters

  margin | The new left margin in units of unit.
  unit | The units for margin.

void Gtk::PageSetup::set_orientation | ( | PageOrientation | orientation | ) |

Sets the page orientation of the Gtk::PageSetup.

Since gtkmm 2.10:

Parameters

  orientation | A Gtk::PageOrientation value.

void Gtk::PageSetup::set_paper_size | ( | const PaperSize& | paper_size | ) |

Sets the paper size of the Gtk::PageSetup without changing the margins.

See set_paper_size_and_default_margins().

Since gtkmm 2.10:

Parameters

  paper_size | A Gtk::PaperSize.

void Gtk::PageSetup::set_paper_size_and_default_margins | ( | const PaperSize& | paper_size | ) |

Sets the paper size of the Gtk::PageSetup and modifies the margins according to the new paper size.

Since gtkmm 2.10:

Parameters

  paper_size | A Gtk::PaperSize.

void Gtk::PageSetup::set_right_margin | ( | double | margin,
|  | Unit | unit
| ) |  |

Sets the right margin of the Gtk::PageSetup.

Since gtkmm 2.10:

Parameters

  margin | The new right margin in units of unit.
  unit | The units for margin.

void Gtk::PageSetup::set_top_margin | ( | double | margin,
|  | Unit | unit
| ) |  |

Sets the top margin of the Gtk::PageSetup.

Since gtkmm 2.10:

Parameters

  margin | The new top margin in units of unit.
  unit | The units for margin.

## Friends And Related Function Documentation

Glib::RefPtr< Gtk::PageSetup > wrap | ( | GtkPageSetup * | object,
|  | bool | take_copy = `false`
| ) |  |

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.

The documentation for this class was generated from the following file:

- gtkmm/pagesetup.h