$szTitle = "wxprinter"; include "./_header.inc"; ?>
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.
derived from
include files
<wx/print.h>
see also
printing framework overview, wxprinterdc, wxprintdialog, wxprintout, wxprintpreview.
members
wxprinter::wxprinter
wxprinter::createabortwindow
wxprinter::getabort
wxprinter::getlasterror
wxprinter::getprintdialogdata
wxprinter::print
wxprinter::printdialog
wxprinter::reporterror
wxprinter::setup
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
void createabortwindow(wxwindow* parent, wxprintout* printout)
creates the default printing abort window, with a cancel button.
bool getabort()
returns true if the user has aborted the print job.
static wxprintererror getlasterror()
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. |
wxprintdialogdata& getprintdialogdata()
returns the print data associated with the printer object.
bool print(wxwindow *parent, wxprintout *printout, bool prompt=true)
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 wxprinter::getlasterror to get detailed information about the kind of the error.
wxdc* printdialog(wxwindow *parent)
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 wxprinter::getlasterror to get detailed information about the kind of the error).
the application must delete this device context to avoid a memory leak.
void reporterror(wxwindow *parent, wxprintout *printout, const wxstring& message)
default error-reporting function.
bool setup(wxwindow *parent)
invokes the print setup dialog. note that the setup dialog is obsolete from windows 95, though retained for backward compatibility.
include "./_footer.inc"; ?>