wxWidgets: wxPrinter Class Reference

| Version: 3.1.5

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
wxPrinter Class Reference
Class List by Category » Printing Framework

`#include </cygdrive/c/Users/Hamis/Cygwin-packaging/wxWidgets3.1/wxWidgets3.1-3.1.5-4.x86_64/src/wxWidgets-3.1.5/interface/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: wxCore

<>< =''>:</>&;&;< =''>\ </></>

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

## Public Member Functions
| wxPrinter (wxPrintDialogData *data=NULL)
| Constructor.
virtual wxPrintAbortDialog * | 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.
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 wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
wxObjectRefData * | GetRefData () 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 wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
virtual wxObjectRefData * | CloneRefData (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
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data.

## Constructor & Destructor Documentation

## ◆ wxPrinter()

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

## ◆ CreateAbortWindow()

virtual wxPrintAbortDialog * wxPrinter::CreateAbortWindow | ( | wxWindow * | parent,
|  | wxPrintout * | printout )
| virtual

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

## ◆ GetAbort()

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

Returns true if the user has aborted the print job.

## ◆ GetLastError()

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.

## ◆ GetPrintDialogData()

virtual wxPrintDialogData & wxPrinter::GetPrintDialogData | ( |  | ) | const
| virtual

Returns the print data associated with the printer object.

## ◆ Print()

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.

## ◆ PrintDialog()

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.

## ◆ ReportError()

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

Default error-reporting function.

## ◆ Setup()

virtual bool wxPrinter::Setup | ( | wxWindow * | parent | ) |
| virtual

Invokes the print setup dialog.

Deprecated
  The setup dialog is obsolete, though retained for backward compatibility.