gtkmm 4.16.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::PageSetup Class Reference

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

#include <gtkmm/pagesetup.h>

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

Public Member Functions

 PageSetup (PageSetup &&src) noexcept
 
PageSetupoperator= (PageSetup &&src) noexcept
 
 ~PageSetup () noexcept override
 
GtkPageSetupgobj ()
 Provides access to the underlying C GObject.
 
const GtkPageSetupgobj () const
 Provides access to the underlying C GObject.
 
GtkPageSetupgobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
Glib::RefPtr< PageSetupcopy () const
 Copies a Gtk::PageSetup.
 
bool load_from_file (const std::string &file_name)
 Reads the page setup from the file file_name.
 
bool load_from_key_file (const Glib::RefPtr< 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.
 
bool load_from_key_file (const Glib::RefPtr< const Glib::KeyFile > &key_file)
 Reads the page setup from the "Page Setup" group in the key file key_file.
 
PageOrientation get_orientation () const
 Gets the page orientation of the Gtk::PageSetup.
 
void set_orientation (PageOrientation orientation)
 Sets the page orientation of the Gtk::PageSetup.
 
PaperSize get_paper_size ()
 Gets the paper size of the Gtk::PageSetup.
 
const PaperSize get_paper_size () const
 Gets the paper size of the Gtk::PageSetup.
 
void set_paper_size (const PaperSize &size)
 Sets the paper size of the Gtk::PageSetup without changing the margins.
 
double get_top_margin (Unit unit) const
 Gets the top margin in units of unit.
 
void set_top_margin (double margin, Unit unit)
 Sets the top margin of the Gtk::PageSetup.
 
double get_bottom_margin (Unit unit) const
 Gets the bottom margin in units of unit.
 
void set_bottom_margin (double margin, Unit unit)
 Sets the bottom margin of the Gtk::PageSetup.
 
double get_left_margin (Unit unit) const
 Gets the left margin in units of unit.
 
void set_left_margin (double margin, Unit unit)
 Sets the left margin of the Gtk::PageSetup.
 
double get_right_margin (Unit unit) const
 Gets the right margin in units of unit.
 
void set_right_margin (double margin, Unit unit)
 Sets the right margin of the Gtk::PageSetup.
 
void set_paper_size_and_default_margins (const PaperSize &size)
 Sets the paper size of the Gtk::PageSetup and modifies the margins according to the new paper size.
 
double get_paper_width (Unit unit) const
 Returns the paper width in units of unit.
 
double get_paper_height (Unit unit) const
 Returns the paper height in units of unit.
 
double get_page_width (Unit unit) const
 Returns the page width in units of unit.
 
double get_page_height (Unit unit) const
 Returns the page height in units of unit.
 
bool save_to_file (const std::string &file_name) const
 This function saves the information from setup to file_name.
 
void save_to_key_file (const Glib::RefPtr< Glib::KeyFile > &key_file, const Glib::ustring &group_name) const
 This function adds the page setup from setup to key_file.
 
void save_to_key_file (const Glib::RefPtr< Glib::KeyFile > &key_file) const
 This function adds the page setup from setup to key_file, in the group "Page Setup".
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< PageSetupcreate ()
 
static Glib::RefPtr< PageSetupcreate_from_key_file (const Glib::RefPtr< const Glib::KeyFile > &key_file)
 Reads the page setup from the "Page Setup" group in the key file key_file.
 
static Glib::RefPtr< PageSetupcreate_from_key_file (const Glib::RefPtr< 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.
 
static Glib::RefPtr< PageSetupcreate_from_file (const std::string &file_name)
 Reads the page setup from the file file_name.
 

Protected Member Functions

 PageSetup ()
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gtk::PageSetupwrap (GtkPageSetup *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

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.

Constructor & Destructor Documentation

◆ PageSetup() [1/2]

Gtk::PageSetup::PageSetup ( PageSetup &&  src)
noexcept

◆ ~PageSetup()

Gtk::PageSetup::~PageSetup ( )
overridenoexcept

◆ PageSetup() [2/2]

Gtk::PageSetup::PageSetup ( )
protected

Member Function Documentation

◆ copy()

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

Copies a Gtk::PageSetup.

Returns
A copy of other.

◆ create()

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

◆ create_from_file()

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

Reads the page setup from the file file_name.

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

Parameters
file_nameThe filename to read the page setup from.
Returns
The restored PageSetup

◆ create_from_key_file() [1/2]

static Glib::RefPtr< PageSetup > Gtk::PageSetup::create_from_key_file ( const Glib::RefPtr< 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_fileThe KeyFile to retrieve the page setup from.
Returns
The restored PageSetup
Exceptions
KeyFileError

◆ create_from_key_file() [2/2]

static Glib::RefPtr< PageSetup > Gtk::PageSetup::create_from_key_file ( const Glib::RefPtr< 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_fileThe KeyFile to retrieve the page setup from.
group_nameThe name of the group in the key_file to read.
Returns
The restored PageSetup
Exceptions
KeyFileError

◆ get_bottom_margin()

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

Gets the bottom margin in units of unit.

Parameters
unitThe unit for the return value.
Returns
The bottom margin.

◆ get_left_margin()

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

Gets the left margin in units of unit.

Parameters
unitThe unit for the return value.
Returns
The left margin.

◆ get_orientation()

PageOrientation Gtk::PageSetup::get_orientation ( ) const

Gets the page orientation of the Gtk::PageSetup.

Returns
The page orientation.

◆ get_page_height()

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

Parameters
unitThe unit for the return value.
Returns
The page height.

◆ get_page_width()

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

Parameters
unitThe unit for the return value.
Returns
The page width.

◆ get_paper_height()

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

Parameters
unitThe unit for the return value.
Returns
The paper height.

◆ get_paper_size() [1/2]

PaperSize Gtk::PageSetup::get_paper_size ( )

Gets the paper size of the Gtk::PageSetup.

Returns
The paper size.

◆ get_paper_size() [2/2]

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

Gets the paper size of the Gtk::PageSetup.

Returns
The paper size.

◆ get_paper_width()

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

Parameters
unitThe unit for the return value.
Returns
The paper width.

◆ get_right_margin()

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

Gets the right margin in units of unit.

Parameters
unitThe unit for the return value.
Returns
The right margin.

◆ get_top_margin()

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

Gets the top margin in units of unit.

Parameters
unitThe unit for the return value.
Returns
The top margin.

◆ get_type()

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

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

◆ gobj() [1/2]

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

Provides access to the underlying C GObject.

◆ gobj() [2/2]

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

Provides access to the underlying C GObject.

◆ gobj_copy()

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.

◆ load_from_file()

bool Gtk::PageSetup::load_from_file ( const std::string file_name)

Reads the page setup from the file file_name.

See to_file().

Parameters
file_nameThe filename to read the page setup from.
Returns
true on success.
Exceptions
Glib::Error

◆ load_from_key_file() [1/2]

bool Gtk::PageSetup::load_from_key_file ( const Glib::RefPtr< const Glib::KeyFile > &  key_file)

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

Parameters
key_fileThe KeyFile to retrieve the page setup from.
Returns
true on success
Exceptions
KeyFileError

◆ load_from_key_file() [2/2]

bool Gtk::PageSetup::load_from_key_file ( const Glib::RefPtr< 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.

Parameters
key_fileThe Glib::KeyFile to retrieve the page_setup from.
group_nameThe name of the group in the key_file to read to use the default name “Page Setup”.
Returns
true on success.
Exceptions
Glib::Error

◆ operator=()

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

◆ save_to_file()

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

This function saves the information from setup to file_name.

Parameters
file_nameThe file to save to.
Returns
true on success.
Exceptions
Glib::FileError

◆ save_to_key_file() [1/2]

void Gtk::PageSetup::save_to_key_file ( const Glib::RefPtr< Glib::KeyFile > &  key_file) const

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

Parameters
key_fileThe Glib::KeyFile to save the page setup to.

◆ save_to_key_file() [2/2]

void Gtk::PageSetup::save_to_key_file ( const Glib::RefPtr< Glib::KeyFile > &  key_file,
const Glib::ustring &  group_name 
) const

This function adds the page setup from setup to key_file.

Parameters
key_fileThe Glib::KeyFile to save the page setup to.
group_nameThe group to add the settings to in key_file.

◆ set_bottom_margin()

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

Sets the bottom margin of the Gtk::PageSetup.

Parameters
marginThe new bottom margin in units of unit.
unitThe units for margin.

◆ set_left_margin()

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

Sets the left margin of the Gtk::PageSetup.

Parameters
marginThe new left margin in units of unit.
unitThe units for margin.

◆ set_orientation()

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

Sets the page orientation of the Gtk::PageSetup.

Parameters
orientationA Gtk::PageOrientation value.

◆ set_paper_size()

void Gtk::PageSetup::set_paper_size ( const PaperSize size)

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

See set_paper_size_and_default_margins().

Parameters
sizeA Gtk::PaperSize.

◆ set_paper_size_and_default_margins()

void Gtk::PageSetup::set_paper_size_and_default_margins ( const PaperSize size)

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

Parameters
sizeA Gtk::PaperSize.

◆ set_right_margin()

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

Sets the right margin of the Gtk::PageSetup.

Parameters
marginThe new right margin in units of unit.
unitThe units for margin.

◆ set_top_margin()

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

Sets the top margin of the Gtk::PageSetup.

Parameters
marginThe new top margin in units of unit.
unitThe units for margin.

Friends And Related Symbol Documentation

◆ wrap()

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

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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.