Public Member Functions | Static Public Member Functions

# wxPrinter Class Reference
[Printing Framework]

`#include <wx/print.h>`

Inheritance diagram for wxPrinter:
[legend]

## Detailed Description

This class represents the Windows or PostScript printer, and is the vehicle through which printing may be launched by an application.

Printing can also be achieved through using of lower functions and classes, but this and associated classes provide a more convenient and general method of printing.

##

Library: wxBase
Category: Printing Framework

See also:
  Printing Framework Overview, wxPrinterDC, wxPrintDialog, wxPrintout, wxPrintPreview

## Public Member Functions
| wxPrinter (wxPrintDialogData *data=NULL)
| Constructor.
virtual wxWindow * | CreateAbortWindow (wxWindow *parent, wxPrintout *printout)
| Creates the default printing abort window, with a cancel button.
bool | GetAbort () const
| Returns true if the user has aborted the print job.
virtual wxPrintDialogData & | GetPrintDialogData () const
| Returns the print data associated with the printer object.
virtual bool | Print (wxWindow *parent, wxPrintout *printout, bool prompt=true)
| Starts the printing process.
virtual wxDC * | PrintDialog (wxWindow *parent)
| Invokes the print dialog.
virtual void | ReportError (wxWindow *parent, wxPrintout *printout, const wxString &message)
| Default error-reporting function.
virtual bool | Setup (wxWindow *parent)
| Invokes the print setup dialog.
## Static Public Member Functions
static wxPrinterError | GetLastError ()
| Return last error.

List of all members.

## Constructor & Destructor Documentation

wxPrinter::wxPrinter | ( | wxPrintDialogData * | data = `NULL` | ) |

Constructor.

Pass an optional pointer to a block of print dialog data, which will be copied to the printer object's local data.

See also:
  wxPrintDialogData, wxPrintData

## Member Function Documentation

virtual wxWindow* wxPrinter::CreateAbortWindow | ( | wxWindow * | parent,
|  | wxPrintout * | printout |
| ) |  |  | `[virtual]`

Creates the default printing abort window, with a cancel button.

bool wxPrinter::GetAbort | ( |  | ) | const

Returns true if the user has aborted the print job.

static wxPrinterError wxPrinter::GetLastError | ( |  | ) | `[static]`

Return last error.

Valid after calling Print(), PrintDialog() or wxPrintPreview::Print().

These functions set last error to `wxPRINTER_NO_ERROR` if no error happened.

Returned value is one of the following:

wxPRINTER_NO_ERROR | No error happened.
wxPRINTER_CANCELLED | The user cancelled printing.
wxPRINTER_ERROR | There was an error during printing.

virtual wxPrintDialogData& wxPrinter::GetPrintDialogData | ( |  | ) | const`[virtual]`

Returns the print data associated with the printer object.

virtual bool wxPrinter::Print | ( | wxWindow * | parent,
|  | wxPrintout * | printout,
|  | bool | prompt = `true` |
| ) |  |  | `[virtual]`

Starts the printing process.

Provide a parent window, a user-defined wxPrintout object which controls the printing of a document, and whether the print dialog should be invoked first.

Print() could return false if there was a problem initializing the printer device context (current printer not set, for example) or the user cancelled printing. Call GetLastError() to get detailed information about the kind of the error.

virtual wxDC* wxPrinter::PrintDialog | ( | wxWindow * | parent | ) | `[virtual]`

Invokes the print dialog.

If successful (the user did not press Cancel and no error occurred), a suitable device context will be returned; otherwise NULL is returned; call GetLastError() to get detailed information about the kind of the error.

Remarks:
  The application must delete this device context to avoid a memory leak.

virtual void wxPrinter::ReportError | ( | wxWindow * | parent,
|  | wxPrintout * | printout,
|  | const wxString & | message |
| ) |  |  | `[virtual]`

Default error-reporting function.

virtual bool wxPrinter::Setup | ( | wxWindow * | parent | ) | `[virtual]`

Invokes the print setup dialog.

Remarks:
  The setup dialog is obsolete from Windows 95, though retained for backward compatibility.

|  | [ top ]