gtkmm: Gtk::Printer Class Reference

A Printer object represents a printer. More...

#include <gtkmm/printer.h>

Inheritance diagram for Gtk::Printer:

Public Member Functions

 Printer (Printer&& src) noexcept
 
Printeroperator= (Printer&& src) noexcept
 
 ~Printer () noexcept override
 
GtkPrinter* gobj ()
 Provides access to the underlying C GObject. More...

 
const GtkPrinter* gobj () const
 Provides access to the underlying C GObject. More...

 
GtkPrinter* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
bool equal (const Glib::RefPtr< Printer >& other) const
 
Glib::ustring get_name () const
 Returns the name of the printer. More...

 
Glib::ustring get_state_message () const
 Returns the state message describing the current state of the printer. More...

 
Glib::ustring get_description () const
 Gets the description of the printer. More...

 
Glib::ustring get_location () const
 Returns a description of the location of the printer. More...

 
Glib::ustring get_icon_name () const
 Gets the name of the icon to use for the printer. More...

 
int get_job_count () const
 Gets the number of jobs currently queued on the printer. More...

 
bool is_active () const
 Returns whether the printer is currently active (i.e. accepts new jobs). More...

 
bool is_paused () const
 Returns whether the printer is currently paused. More...

 
bool is_accepting_jobs () const
 Returns whether the printer is accepting jobs. More...

 
bool is_virtual () const
 Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class). More...

 
bool is_default () const
 Returns whether the printer is the default printer. More...

 
bool accepts_pdf () const
 Returns whether the printer accepts input in PDF format. More...

 
bool accepts_ps () const
 Returns whether the printer accepts input in PostScript format. More...

 
std::vector< Glib::RefPtr< PageSetup > > list_papers ()
 Lists all the paper sizes printer supports. More...

 
Glib::RefPtr< PageSetupget_default_page_size () const
 Returns default page size of printer. More...

 
std::vector< Glib::RefPtr< const PageSetup > > list_papers () const
 Lists all the paper sizes printer supports. More...

 
bool has_details () const
 Returns whether the printer details are available. More...

 
void request_details ()
 Requests the printer details. More...

 
PrintCapabilities get_capabilities () const
 Returns the printer’s capabilities. More...

 
bool get_hard_margins (double& top, double& bottom, double&left, double&right) const
 Retrieve the hard margins of printer, i.e. the margins that define the area at the borders of the paper that the printer cannot print to. More...

 
bool get_hard_margins (const PaperSize& paper_size, double& top, double& bottom, double&left, double&right) const
 Retrieve the hard margins of printer for paper_size, i.e. the margins that define the area at the borders of the paper that the printer cannot print to. More...

 
Glib::SignalProxy< void(bool)> signal_details_acquired ()
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_name () const
 Name of the printer. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_is_virtual () const
 false if this represents a real hardware printer. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_state_message () const
 String giving the current state of the printer. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_location () const
 The location of the printer. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_icon_name () const
 The icon name to use for the printer. More...

 
Glib::PropertyProxy_ReadOnly< int > property_job_count () const
 Number of jobs queued in the printer. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_accepts_pdf () const
 true if this printer can accept PDF. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_accepts_ps () const
 true if this printer can accept PostScript. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_paused () const
 This property is true if this printer is paused. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_accepting_jobs () const
 This property is true if the printer is accepting jobs. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (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::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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 ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (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...

 

Related Functions

(Note that these are not member functions.)

typedef sigc::slot< bool(const Glib::RefPtr< Printer >&)> SlotPrinterEnumerator
 For example, bool on_enumerate_printers(const Glib::RefPtr<Printer>& printer);. More...

 
bool operator== (const Glib::RefPtr< Printer >& lhs, const Glib::RefPtr< Printer >& rhs)
 
bool operator!= (const Glib::RefPtr< Printer >& lhs, const Glib::RefPtr< Printer >& rhs)
 
void enumerate_printers (const SlotPrinterEnumerator& slot, bool wait=true)
 Calls a function for all Printers. More...

 
Glib::RefPtr< Gtk::Printerwrap (GtkPrinter* 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
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 
- 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
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Detailed Description

A Printer object represents a printer.

You only need to deal directly with printers if you use the non-portable PrintUnixDialog API.

A Printer object allows to get status information about the printer, such as its description, its location, the number of queued jobs, etc. Most importantly, a Printer object can be used to create a PrintJob object, which lets you print to the printer.

Since gtkmm 2.10:

Constructor & Destructor Documentation

Gtk::Printer::Printer ( Printer&&  src)
noexcept
Gtk::Printer::~Printer ( )
overridenoexcept

Member Function Documentation

bool Gtk::Printer::accepts_pdf ( ) const

Returns whether the printer accepts input in PDF format.

Returns
true if printer accepts PDF.
bool Gtk::Printer::accepts_ps ( ) const

Returns whether the printer accepts input in PostScript format.

Returns
true if printer accepts PostScript.
bool Gtk::Printer::equal ( const Glib::RefPtr< Printer >&  other) const
PrintCapabilities Gtk::Printer::get_capabilities ( ) const

Returns the printer’s capabilities.

This is useful when you’re using Gtk::PrintUnixDialog’s manual-capabilities setting and need to know which settings the printer can handle and which you must handle yourself.

This will return 0 unless the printer’s details are available, see has_details() and request_details().

Returns
The printer’s capabilities.
Glib::RefPtr<PageSetup> Gtk::Printer::get_default_page_size ( ) const

Returns default page size of printer.

Returns
A newly allocated Gtk::PageSetup with default page size of the printer.
Glib::ustring Gtk::Printer::get_description ( ) const

Gets the description of the printer.

Returns
The description of printer.
bool Gtk::Printer::get_hard_margins ( double &  top,
double &  bottom,
double &  left,
double &  right 
) const

Retrieve the hard margins of printer, i.e. the margins that define the area at the borders of the paper that the printer cannot print to.

Note
This will not succeed unless the printer’s details are available, see has_details() and request_details().
Parameters
topA location to store the top margin in.
bottomA location to store the bottom margin in.
leftA location to store the left margin in.
rightA location to store the right margin in.
Returns
true iff the hard margins were retrieved.
bool Gtk::Printer::get_hard_margins ( const PaperSize paper_size,
double &  top,
double &  bottom,
double &  left,
double &  right 
) const

Retrieve the hard margins of printer for paper_size, i.e. the margins that define the area at the borders of the paper that the printer cannot print to.

Note
This will not succeed unless the printer's details are available, see has_details() and request_details().
Parameters
paper_sizeA Gtk::PaperSize.
topA location to store the top margin in.
bottomA location to store the bottom margin in.
leftA location to store the left margin in.
rightA location to store the right margin in.
Returns
true iff the hard margins were retrieved.
Glib::ustring Gtk::Printer::get_icon_name ( ) const

Gets the name of the icon to use for the printer.

Returns
The icon name for printer.
int Gtk::Printer::get_job_count ( ) const

Gets the number of jobs currently queued on the printer.

Returns
The number of jobs on printer.
Glib::ustring Gtk::Printer::get_location ( ) const

Returns a description of the location of the printer.

Returns
The location of printer.
Glib::ustring Gtk::Printer::get_name ( ) const

Returns the name of the printer.

Returns
The name of printer.
Glib::ustring Gtk::Printer::get_state_message ( ) const

Returns the state message describing the current state of the printer.

Returns
The state message of printer.
static GType Gtk::Printer::get_type ( )
static

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

GtkPrinter* Gtk::Printer::gobj ( )
inline

Provides access to the underlying C GObject.

const GtkPrinter* Gtk::Printer::gobj ( ) const
inline

Provides access to the underlying C GObject.

GtkPrinter* Gtk::Printer::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::Printer::has_details ( ) const

Returns whether the printer details are available.

Returns
true if printer details are available.
bool Gtk::Printer::is_accepting_jobs ( ) const

Returns whether the printer is accepting jobs.

Returns
true if printer is accepting jobs.
bool Gtk::Printer::is_active ( ) const

Returns whether the printer is currently active (i.e. accepts new jobs).

Returns
true if printer is active.
bool Gtk::Printer::is_default ( ) const

Returns whether the printer is the default printer.

Returns
true if printer is the default.
bool Gtk::Printer::is_paused ( ) const

Returns whether the printer is currently paused.

A paused printer still accepts jobs, but it is not printing them.

Returns
true if printer is paused.
bool Gtk::Printer::is_virtual ( ) const

Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class).

Returns
true if printer is virtual.
std::vector< Glib::RefPtr<PageSetup> > Gtk::Printer::list_papers ( )

Lists all the paper sizes printer supports.

This will return and empty list unless the printer’s details are available, see has_details() and request_details().

Returns
A newly allocated list of newly allocated Gtk::PageSetup s.
std::vector< Glib::RefPtr<const PageSetup> > Gtk::Printer::list_papers ( ) const

Lists all the paper sizes printer supports.

This will return and empty list unless the printer’s details are available, see has_details() and request_details().

Returns
A newly allocated list of newly allocated Gtk::PageSetup s.
Printer& Gtk::Printer::operator= ( Printer&&  src)
noexcept
Glib::PropertyProxy_ReadOnly< bool > Gtk::Printer::property_accepting_jobs ( ) const

This property is true if the printer is accepting jobs.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Printer::property_accepts_pdf ( ) const

true if this printer can accept PDF.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Printer::property_accepts_ps ( ) const

true if this printer can accept PostScript.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Printer::property_icon_name ( ) const

The icon name to use for the printer.

Default value: "printer"

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Printer::property_is_virtual ( ) const

false if this represents a real hardware printer.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< int > Gtk::Printer::property_job_count ( ) const

Number of jobs queued in the printer.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Printer::property_location ( ) const

The location of the printer.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Printer::property_name ( ) const

Name of the printer.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Printer::property_paused ( ) const

This property is true if this printer is paused.

A paused printer still accepts jobs, but it does not print them.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Printer::property_state_message ( ) const

String giving the current state of the printer.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
void Gtk::Printer::request_details ( )

Requests the printer details.

When the details are available, the details_acquired signal will be emitted.

Since gtkmm 2.12:
Glib::SignalProxy<void(bool)> Gtk::Printer::signal_details_acquired ( )
Slot Prototype:
void on_my_details_acquired(bool success)

Flags: Run Last

Gets emitted in response to a request for detailed information about a printer from the print backend. The success parameter indicates if the information was actually obtained.

Parameters
successtrue if the details were successfully acquired.

Friends And Related Function Documentation

void enumerate_printers ( const SlotPrinterEnumerator slot,
bool  wait = true 
)
related

Calls a function for all Printers.

If the callback returns true, the enumeration is stopped.

Parameters
slotA function to call for each printer
waitIf true, wait in a recursive mainloop until all printers are enumerated; otherwise return early.
bool operator!= ( const Glib::RefPtr< Printer >&  lhs,
const Glib::RefPtr< Printer >&  rhs 
)
related
bool operator== ( const Glib::RefPtr< Printer >&  lhs,
const Glib::RefPtr< Printer >&  rhs 
)
related
typedef sigc::slot<bool(const Glib::RefPtr<Printer>&)> SlotPrinterEnumerator
related

For example, bool on_enumerate_printers(const Glib::RefPtr<Printer>& printer);.

Parameters
printerA printer.
resulttrue to stop the enumeration, false to continue.
Glib::RefPtr< Gtk::Printer > wrap ( GtkPrinter *  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.