gtkmm 3.24.7
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Related Functions | List of all members
Gtk::PaperSize Class Reference

PaperSize handles paper sizes. More...

#include <gtkmm/papersize.h>

Public Types

typedef const void * BoolExpr
 This typedef is just to make it more obvious that our operator const void* should be used like operator bool(). More...
 

Public Member Functions

 PaperSize ()
 
 PaperSize (GtkPaperSize * gobject, bool make_a_copy=true)
 
 PaperSize (const PaperSize & other)
 
PaperSizeoperator= (const PaperSize & other)
 
 PaperSize (PaperSize && other) noexcept
 
PaperSizeoperator= (PaperSize && other) noexcept
 
 ~PaperSize () noexcept
 
void swap (PaperSize & other) noexcept
 
GtkPaperSize * gobj ()
 Provides access to the underlying C instance. More...
 
const GtkPaperSize * gobj () const
 Provides access to the underlying C instance. More...
 
GtkPaperSize * gobj_copy () const
 Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. More...
 
 PaperSize (const Glib::ustring & name)
 
 PaperSize (const Glib::ustring & ppd_name, const Glib::ustring & ppd_display_name, double width, double height)
 
 PaperSize (const Glib::ustring & name, const Glib::ustring & display_name, double width, double height, Unit unit)
 
 PaperSize (const Glib::KeyFile & key_file, const Glib::ustring & group_name=Glib::ustring())
 
bool equal (const PaperSize & other) const
 
 operator BoolExpr () const
 Returns true if the PaperSize is a valid object. More...
 
 operator bool () const
 Returns true if the PaperSize is a valid object. More...
 
Glib::ustring get_name () const
 Gets the name of the Gtk::PaperSize. More...
 
Glib::ustring get_display_name () const
 Gets the human-readable name of the Gtk::PaperSize. More...
 
Glib::ustring get_ppd_name () const
 Gets the PPD name of the Gtk::PaperSize, which may be nullptr. More...
 
double get_width (Unit unit) const
 Gets the paper width of the Gtk::PaperSize, in units of unit. More...
 
double get_height (Unit unit) const
 Gets the paper height of the Gtk::PaperSize, in units of unit. More...
 
bool is_custom () const
 Returns true if size is not a standard paper size. More...
 
bool is_ipp () const
 Returns true if size is an IPP standard paper size. More...
 
void set_size (double width, double height, Unit unit)
 Changes the dimensions of a size to width x height. More...
 
double get_default_top_margin (Unit unit) const
 Gets the default top margin for the Gtk::PaperSize. More...
 
double get_default_bottom_margin (Unit unit) const
 Gets the default bottom margin for the Gtk::PaperSize. More...
 
double get_default_left_margin (Unit unit) const
 Gets the default left margin for the Gtk::PaperSize. More...
 
double get_default_right_margin (Unit unit) const
 Gets the default right margin for the Gtk::PaperSize. More...
 
void save_to_key_file (Glib::KeyFile & key_file, const Glib::ustring & group_name)
 This function adds the paper size from size to key_file. More...
 
void save_to_key_file (Glib::KeyFile & key_file)
 This function adds the paper size to key_file in the first group. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static std::vector< PaperSizeget_paper_sizes (bool include_custom=true)
 Creates a list of known paper sizes. More...
 
static Glib::ustring get_default ()
 Returns the name of the default paper size, which depends on the current locale. More...
 

Protected Attributes

GtkPaperSize * gobject_
 

Related Functions

(Note that these are not member functions.)

bool operator== (const PaperSize & lhs, const PaperSize & rhs)
 
bool operator!= (const PaperSize & lhs, const PaperSize & rhs)
 
void swap (PaperSize & lhs, PaperSize & rhs) noexcept
 
Gtk::PaperSize wrap (GtkPaperSize * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

PaperSize handles paper sizes.

It uses the standard called "PWG 5101.1-2002 PWG: Standard for Media Standardized Names" to name the paper sizes (and to get the data for the page sizes). In addition to standard paper sizes, PaperSize allows to construct custom paper sizes with arbitrary dimensions.

The PaperSize object stores not only the dimensions (width and height) of a paper size and its name, it also provides default print margins.

Since gtkmm 2.10:

Member Typedef Documentation

◆ BoolExpr

typedef const void* Gtk::PaperSize::BoolExpr

This typedef is just to make it more obvious that our operator const void* should be used like operator bool().

Deprecated:
Use the explicit operator bool() instead.

Constructor & Destructor Documentation

◆ PaperSize() [1/8]

Gtk::PaperSize::PaperSize ( )

◆ PaperSize() [2/8]

Gtk::PaperSize::PaperSize ( GtkPaperSize *  gobject,
bool  make_a_copy = true 
)
explicit

◆ PaperSize() [3/8]

Gtk::PaperSize::PaperSize ( const PaperSize other)

◆ PaperSize() [4/8]

Gtk::PaperSize::PaperSize ( PaperSize &&  other)
noexcept

◆ ~PaperSize()

Gtk::PaperSize::~PaperSize ( )
noexcept

◆ PaperSize() [5/8]

Gtk::PaperSize::PaperSize ( const Glib::ustring &  name)
explicit

◆ PaperSize() [6/8]

Gtk::PaperSize::PaperSize ( const Glib::ustring &  ppd_name,
const Glib::ustring &  ppd_display_name,
double  width,
double  height 
)
explicit

◆ PaperSize() [7/8]

Gtk::PaperSize::PaperSize ( const Glib::ustring &  name,
const Glib::ustring &  display_name,
double  width,
double  height,
Unit  unit 
)
explicit

◆ PaperSize() [8/8]

Gtk::PaperSize::PaperSize ( const Glib::KeyFile &  key_file,
const Glib::ustring &  group_name = Glib::ustring() 
)
explicit

Member Function Documentation

◆ equal()

bool Gtk::PaperSize::equal ( const PaperSize other) const

◆ get_default()

static Glib::ustring Gtk::PaperSize::get_default ( )
static

Returns the name of the default paper size, which depends on the current locale.

Since gtkmm 2.10:
Returns
The name of the default paper size. The string is owned by GTK+ and should not be modified.

◆ get_default_bottom_margin()

double Gtk::PaperSize::get_default_bottom_margin ( Unit  unit) const

Gets the default bottom margin for the Gtk::PaperSize.

Since gtkmm 2.10:
Parameters
unitThe unit for the return value, not Gtk::UNIT_NONE.
Returns
The default bottom margin.

◆ get_default_left_margin()

double Gtk::PaperSize::get_default_left_margin ( Unit  unit) const

Gets the default left margin for the Gtk::PaperSize.

Since gtkmm 2.10:
Parameters
unitThe unit for the return value, not Gtk::UNIT_NONE.
Returns
The default left margin.

◆ get_default_right_margin()

double Gtk::PaperSize::get_default_right_margin ( Unit  unit) const

Gets the default right margin for the Gtk::PaperSize.

Since gtkmm 2.10:
Parameters
unitThe unit for the return value, not Gtk::UNIT_NONE.
Returns
The default right margin.

◆ get_default_top_margin()

double Gtk::PaperSize::get_default_top_margin ( Unit  unit) const

Gets the default top margin for the Gtk::PaperSize.

Since gtkmm 2.10:
Parameters
unitThe unit for the return value, not Gtk::UNIT_NONE.
Returns
The default top margin.

◆ get_display_name()

Glib::ustring Gtk::PaperSize::get_display_name ( ) const

Gets the human-readable name of the Gtk::PaperSize.

Since gtkmm 2.10:
Returns
The human-readable name of size.

◆ get_height()

double Gtk::PaperSize::get_height ( Unit  unit) const

Gets the paper height of the Gtk::PaperSize, in units of unit.

Since gtkmm 2.10:
Parameters
unitThe unit for the return value, not Gtk::UNIT_NONE.
Returns
The paper height.

◆ get_name()

Glib::ustring Gtk::PaperSize::get_name ( ) const

Gets the name of the Gtk::PaperSize.

Since gtkmm 2.10:
Returns
The name of size.

◆ get_paper_sizes()

static std::vector< PaperSize > Gtk::PaperSize::get_paper_sizes ( bool  include_custom = true)
static

Creates a list of known paper sizes.

Since gtkmm 2.12:
Parameters
include_customWhether to include custom paper sizes as defined in the page setup dialog.
Returns
A newly allocated list of newly allocated Gtk::PaperSize objects.

◆ get_ppd_name()

Glib::ustring Gtk::PaperSize::get_ppd_name ( ) const

Gets the PPD name of the Gtk::PaperSize, which may be nullptr.

Since gtkmm 2.10:
Returns
The PPD name of size.

◆ get_type()

static GType Gtk::PaperSize::get_type ( )
static

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

◆ get_width()

double Gtk::PaperSize::get_width ( Unit  unit) const

Gets the paper width of the Gtk::PaperSize, in units of unit.

Since gtkmm 2.10:
Parameters
unitThe unit for the return value, not Gtk::UNIT_NONE.
Returns
The paper width.

◆ gobj() [1/2]

GtkPaperSize * Gtk::PaperSize::gobj ( )
inline

Provides access to the underlying C instance.

◆ gobj() [2/2]

const GtkPaperSize * Gtk::PaperSize::gobj ( ) const
inline

Provides access to the underlying C instance.

◆ gobj_copy()

GtkPaperSize * Gtk::PaperSize::gobj_copy ( ) const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

◆ is_custom()

bool Gtk::PaperSize::is_custom ( ) const

Returns true if size is not a standard paper size.

Returns
Whether size is a custom paper size.

◆ is_ipp()

bool Gtk::PaperSize::is_ipp ( ) const

Returns true if size is an IPP standard paper size.

Returns
Whether size is not an IPP custom paper size.

◆ operator bool()

Gtk::PaperSize::operator bool ( ) const
explicit

Returns true if the PaperSize is a valid object.

For instance,

if(papersize)
do_something()
Since gtkmm 3.22:

◆ operator BoolExpr()

Gtk::PaperSize::operator BoolExpr ( ) const

Returns true if the PaperSize is a valid object.

For instance,

if(papersize)
do_something()
Deprecated:
Use the explicit operator bool() instead.
Since gtkmm 2.12:

◆ operator=() [1/2]

PaperSize & Gtk::PaperSize::operator= ( const PaperSize other)

◆ operator=() [2/2]

PaperSize & Gtk::PaperSize::operator= ( PaperSize &&  other)
noexcept

◆ save_to_key_file() [1/2]

void Gtk::PaperSize::save_to_key_file ( Glib::KeyFile &  key_file)

This function adds the paper size to key_file in the first group.

Since gtkmm 2.12:
Parameters
key_fileThe Glib::KeyFile to save the paper size to.

◆ save_to_key_file() [2/2]

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

This function adds the paper size from size to key_file.

Since gtkmm 2.12:
Parameters
key_fileThe Glib::KeyFile to save the paper size to.
group_nameThe group to add the settings to in key_file.

◆ set_size()

void Gtk::PaperSize::set_size ( double  width,
double  height,
Unit  unit 
)

Changes the dimensions of a size to width x height.

Since gtkmm 2.10:
Parameters
widthThe new width in units of unit.
heightThe new height in units of unit.
unitThe unit for width and height.

◆ swap()

void Gtk::PaperSize::swap ( PaperSize other)
noexcept

Friends And Related Function Documentation

◆ operator!=()

bool operator!= ( const PaperSize lhs,
const PaperSize rhs 
)
related

◆ operator==()

bool operator== ( const PaperSize lhs,
const PaperSize rhs 
)
related

◆ swap()

void swap ( PaperSize lhs,
PaperSize rhs 
)
related
Parameters
lhsThe left-hand side
rhsThe right-hand side

◆ wrap()

Gtk::PaperSize wrap ( GtkPaperSize *  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.

Member Data Documentation

◆ gobject_

GtkPaperSize* Gtk::PaperSize::gobject_
protected