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

A Gtk::PrintDialog object collects the arguments that are needed to present a print dialog to the user, such as a title for the dialog and whether it should be modal. More...

#include <gtkmm/printdialog.h>

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

Public Member Functions

 PrintDialog (PrintDialog &&src) noexcept
 
PrintDialogoperator= (PrintDialog &&src) noexcept
 
 ~PrintDialog () noexcept override
 
GtkPrintDialoggobj ()
 Provides access to the underlying C GObject.
 
const GtkPrintDialoggobj () const
 Provides access to the underlying C GObject.
 
GtkPrintDialoggobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
Glib::ustring get_title () const
 Returns the title that will be shown on the print dialog.
 
void set_title (const Glib::ustring &title)
 Sets the title that will be shown on the print dialog.
 
Glib::ustring get_accept_label () const
 Returns the label that will be shown on the accept button of the print dialog.
 
void set_accept_label (const Glib::ustring &accept_label)
 Sets the label that will be shown on the accept button of the print dialog shown for setup().
 
bool get_modal () const
 Returns whether the print dialog blocks interaction with the parent window while it is presented.
 
void set_modal (bool modal=true)
 Sets whether the print dialog blocks interaction with the parent window while it is presented.
 
Glib::RefPtr< PageSetupget_page_setup ()
 Returns the page setup.
 
Glib::RefPtr< const PageSetupget_page_setup () const
 Returns the page setup.
 
void set_page_setup (const Glib::RefPtr< PageSetup > &page_setup)
 Set the page setup for the print dialog.
 
Glib::RefPtr< PrintSettingsget_print_settings ()
 Returns the print settings for the print dialog.
 
Glib::RefPtr< const PrintSettingsget_print_settings () const
 Returns the print settings for the print dialog.
 
void set_print_settings (const Glib::RefPtr< PrintSettings > &print_settings)
 Sets the print settings for the print dialog.
 
void setup (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 This function presents a print dialog to let the user select a printer, and set up print settings and page setup.
 
void setup (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A setup() convenience overload.
 
Glib::RefPtr< PrintSetupsetup_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the setup() call.
 
void print (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< PrintSetup > &setup={}, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 This function prints content from a stream.
 
void print (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< PrintSetup > &setup={}, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A print() convenience overload.
 
Glib::RefPtr< Gio::OutputStreamprint_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the print() call and returns the results.
 
void print_file (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & file, const Glib::RefPtr< PrintSetup > &setup={}, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 This function prints a file.
 
void print_file (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & file, const Glib::RefPtr< PrintSetup > &setup={}, const Glib::RefPtr< Gio::Cancellable > &cancellable={})
 A print_file() convenience overload.
 
bool print_file_finish (const Glib::RefPtr< Gio::AsyncResult > &result)
 Finishes the print_file() call and returns the results.
 
Glib::PropertyProxy< Glib::ustringproperty_title ()
 A title that may be shown on the print dialog that is presented by Gtk::PrintDialog::setup().
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_title () const
 A title that may be shown on the print dialog that is presented by Gtk::PrintDialog::setup().
 
Glib::PropertyProxy< Glib::ustringproperty_accept_label ()
 A label that may be shown on the accept button of a print dialog that is presented by Gtk::PrintDialog::setup().
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_accept_label () const
 A label that may be shown on the accept button of a print dialog that is presented by Gtk::PrintDialog::setup().
 
Glib::PropertyProxy< bool > property_modal ()
 Whether the print dialog is modal.
 
Glib::PropertyProxy_ReadOnly< bool > property_modal () const
 Whether the print dialog is modal.
 
Glib::PropertyProxy< Glib::RefPtr< PageSetup > > property_page_setup ()
 The page setup to use.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PageSetup > > property_page_setup () const
 The page setup to use.
 
Glib::PropertyProxy< Glib::RefPtr< PrintSettings > > property_print_settings ()
 The print settings to use.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PrintSettings > > property_print_settings () const
 The print settings to use.
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
voidget_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
voidsteal_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
 
GObjectgobj ()
 
const GObjectgobj () const
 
GObjectgobj_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.
 
static Glib::RefPtr< PrintDialogcreate ()
 

Protected Member Functions

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

Related Symbols

(Note that these are not member symbols.)

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

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
 

Detailed Description

A Gtk::PrintDialog object collects the arguments that are needed to present a print dialog to the user, such as a title for the dialog and whether it should be modal.

The dialog is shown with the setup() function. The actual printing can be done with print() or print_file(). These APIs follow the GIO async pattern, and the results can be obtained by calling the corresponding finish methods.

Since gtkmm 4.14:

Constructor & Destructor Documentation

◆ PrintDialog() [1/2]

Gtk::PrintDialog::PrintDialog ( PrintDialog &&  src)
noexcept

◆ ~PrintDialog()

Gtk::PrintDialog::~PrintDialog ( )
overridenoexcept

◆ PrintDialog() [2/2]

Gtk::PrintDialog::PrintDialog ( )
protected

Member Function Documentation

◆ create()

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

◆ get_accept_label()

Glib::ustring Gtk::PrintDialog::get_accept_label ( ) const

Returns the label that will be shown on the accept button of the print dialog.

Since gtkmm 4.14:
Returns
The accept label.

◆ get_modal()

bool Gtk::PrintDialog::get_modal ( ) const

Returns whether the print dialog blocks interaction with the parent window while it is presented.

Since gtkmm 4.14:
Returns
Whether the print dialog is modal.

◆ get_page_setup() [1/2]

Glib::RefPtr< PageSetup > Gtk::PrintDialog::get_page_setup ( )

Returns the page setup.

Since gtkmm 4.14:
Returns
The page setup.

◆ get_page_setup() [2/2]

Glib::RefPtr< const PageSetup > Gtk::PrintDialog::get_page_setup ( ) const

Returns the page setup.

Since gtkmm 4.14:
Returns
The page setup.

◆ get_print_settings() [1/2]

Glib::RefPtr< PrintSettings > Gtk::PrintDialog::get_print_settings ( )

Returns the print settings for the print dialog.

Since gtkmm 4.14:
Returns
The settings.

◆ get_print_settings() [2/2]

Glib::RefPtr< const PrintSettings > Gtk::PrintDialog::get_print_settings ( ) const

Returns the print settings for the print dialog.

Since gtkmm 4.14:
Returns
The settings.

◆ get_title()

Glib::ustring Gtk::PrintDialog::get_title ( ) const

Returns the title that will be shown on the print dialog.

Since gtkmm 4.14:
Returns
The title.

◆ get_type()

static GType Gtk::PrintDialog::get_type ( )
static

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

◆ gobj() [1/2]

GtkPrintDialog * Gtk::PrintDialog::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkPrintDialog * Gtk::PrintDialog::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GtkPrintDialog * Gtk::PrintDialog::gobj_copy ( )

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

◆ operator=()

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

◆ print() [1/2]

void Gtk::PrintDialog::print ( const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< PrintSetup > &  setup = {},
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
)

A print() convenience overload.

◆ print() [2/2]

void Gtk::PrintDialog::print ( Window parent,
const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< PrintSetup > &  setup = {},
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
)

This function prints content from a stream.

If you pass nullptr as setup, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.

The slot will be called when the printing is done.

Since gtkmm 4.14:
Parameters
parentThe parent Gtk::Window.
setupThe Gtk::PrintSetup to use.
cancellableA Cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ print_file() [1/2]

void Gtk::PrintDialog::print_file ( const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::File > &  file,
const Glib::RefPtr< PrintSetup > &  setup = {},
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
)

A print_file() convenience overload.

◆ print_file() [2/2]

void Gtk::PrintDialog::print_file ( Window parent,
const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::File > &  file,
const Glib::RefPtr< PrintSetup > &  setup = {},
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
)

This function prints a file.

If you pass nullptr as setup, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.

Since gtkmm 4.14:
Parameters
parentThe parent Gtk::Window.
setupThe Gtk::PrintSetup to use.
fileThe Gio::File to print.
cancellableA Cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ print_file_finish()

bool Gtk::PrintDialog::print_file_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result)

Finishes the print_file() call and returns the results.

Since gtkmm 4.14:
Parameters
resultA Gio::AsyncResult.
Returns
Whether the call was successful.
Exceptions
Gtk::DialogError

◆ print_finish()

Glib::RefPtr< Gio::OutputStream > Gtk::PrintDialog::print_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result)

Finishes the print() call and returns the results.

If the call was successful, the content to be printed should be written to the returned output stream. Otherwise, nullptr is returned.

The overall results of the print operation will be returned in the Gio::OutputStream::close() call, so if you are interested in the results, you need to explicitly close the output stream (it will be closed automatically if you just unref it). Be aware that the close call may not be instant as it operation will for the printer to finish printing.

Since gtkmm 4.14:
Parameters
resultA Gio::AsyncResult.
Returns
A Gio::OutputStream.
Exceptions
Gtk::DialogError

◆ property_accept_label() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::PrintDialog::property_accept_label ( )

A label that may be shown on the accept button of a print dialog that is presented by Gtk::PrintDialog::setup().

Since gtkmm 4.14:

Default value: ""

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_accept_label() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::PrintDialog::property_accept_label ( ) const

A label that may be shown on the accept button of a print dialog that is presented by Gtk::PrintDialog::setup().

Since gtkmm 4.14:

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.

◆ property_modal() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintDialog::property_modal ( )

Whether the print dialog is modal.

Since gtkmm 4.14:

Default value: true

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_modal() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintDialog::property_modal ( ) const

Whether the print dialog is modal.

Since gtkmm 4.14:

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.

◆ property_page_setup() [1/2]

Glib::PropertyProxy< Glib::RefPtr< PageSetup > > Gtk::PrintDialog::property_page_setup ( )

The page setup to use.

Since gtkmm 4.14:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_page_setup() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PageSetup > > Gtk::PrintDialog::property_page_setup ( ) const

The page setup to use.

Since gtkmm 4.14:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_print_settings() [1/2]

Glib::PropertyProxy< Glib::RefPtr< PrintSettings > > Gtk::PrintDialog::property_print_settings ( )

The print settings to use.

Since gtkmm 4.14:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_print_settings() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PrintSettings > > Gtk::PrintDialog::property_print_settings ( ) const

The print settings to use.

Since gtkmm 4.14:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_title() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::PrintDialog::property_title ( )

A title that may be shown on the print dialog that is presented by Gtk::PrintDialog::setup().

Since gtkmm 4.14:

Default value: ""

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_title() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::PrintDialog::property_title ( ) const

A title that may be shown on the print dialog that is presented by Gtk::PrintDialog::setup().

Since gtkmm 4.14:

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.

◆ set_accept_label()

void Gtk::PrintDialog::set_accept_label ( const Glib::ustring accept_label)

Sets the label that will be shown on the accept button of the print dialog shown for setup().

Since gtkmm 4.14:
Parameters
accept_labelThe new accept label.

◆ set_modal()

void Gtk::PrintDialog::set_modal ( bool  modal = true)

Sets whether the print dialog blocks interaction with the parent window while it is presented.

Since gtkmm 4.14:
Parameters
modalThe new value.

◆ set_page_setup()

void Gtk::PrintDialog::set_page_setup ( const Glib::RefPtr< PageSetup > &  page_setup)

Set the page setup for the print dialog.

Since gtkmm 4.14:
Parameters
page_setupThe new page setup.

◆ set_print_settings()

void Gtk::PrintDialog::set_print_settings ( const Glib::RefPtr< PrintSettings > &  print_settings)

Sets the print settings for the print dialog.

Since gtkmm 4.14:
Parameters
print_settingsThe new print settings.

◆ set_title()

void Gtk::PrintDialog::set_title ( const Glib::ustring title)

Sets the title that will be shown on the print dialog.

Since gtkmm 4.14:
Parameters
titleThe new title.

◆ setup() [1/2]

void Gtk::PrintDialog::setup ( const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
)

A setup() convenience overload.

◆ setup() [2/2]

void Gtk::PrintDialog::setup ( Window parent,
const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
)

This function presents a print dialog to let the user select a printer, and set up print settings and page setup.

The slot will be called when the dialog is dismissed. The obtained Gtk::PrintSetup can then be passed to print() or print_file().

One possible use for this method is to have the user select a printer, then show a page setup UI in the application (e.g. to arrange images on a page), then call print() on self to do the printing without further user interaction.

Since gtkmm 4.14:
Parameters
parentThe parent Gtk::Window.
cancellableA Cancellable to cancel the operation.
slotA callback to call when the operation is complete.

◆ setup_finish()

Glib::RefPtr< PrintSetup > Gtk::PrintDialog::setup_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result)

Finishes the setup() call.

If the call was successful, it returns a Gtk::PrintSetup which contains the print settings and page setup information that will be used to print.

Since gtkmm 4.14:
Parameters
resultA Gio::AsyncResult.
Returns
The Gtk::PrintSetup object that resulted from the call, or nullptr if the call was not successful.
Exceptions
Gtk::DialogError

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gtk::PrintDialog > wrap ( GtkPrintDialog 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.