Version: 3.0.2
wxPrinter Class Reference

#include <wx/print.h>

+ Inheritance diagram for wxPrinter:

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:  wxCore
Category:  Printing Framework
See Also
Printing Framework Overview, wxPrinterDC, wxPrintDialog, wxPrintout, wxPrintPreview

Public Member Functions

 wxPrinter (wxPrintDialogData *data=NULL)
 Constructor.
 
virtual wxPrintAbortDialogCreateAbortWindow (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 wxPrintDialogDataGetPrintDialogData () 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 wxDCPrintDialog (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.
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data.
 
 wxObject (const wxObject &other)
 Copy ctor.
 
virtual ~wxObject ()
 Destructor.
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class.
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj.
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone.
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer.
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data.
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public.
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 

Static Public Member Functions

static wxPrinterError GetLastError ()
 Return last error.
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object.
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data.
 

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 wxPrintAbortDialog* 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.