wxWidgets: wxPrintData Class Reference

| Version: 3.2.7

Public Member Functions | List of all members
wxPrintData Class Reference
Class List by Category » Printing Framework | Class List by Category » Data Structures

`#include <wx/cmndata.h>`

Inheritance diagram for wxPrintData:
[legend]

## Detailed Description

This class holds a variety of information related to printers and printer device contexts.

This class is used to create a wxPrinterDC and a wxPostScriptDC. It is also used as a data member of wxPrintDialogData and wxPageSetupDialogData, as part of the mechanism for transferring data between the print dialogs and the application.

##

Library: wxCore
Category: Printing Framework, Data Structures

See also
  Printing Framework Overview, wxPrintDialog, wxPageSetupDialog, wxPrintDialogData, wxPageSetupDialogData, wxPrintDialog Overview, wxPrinterDC, wxPostScriptDC

## Public Member Functions
| wxPrintData ()
| Default constructor. More...
| wxPrintData (const wxPrintData &data)
| Copy constructor. More...
virtual | ~wxPrintData ()
| Destructor. More...
wxPrintBin | GetBin () const
| Returns the current bin (papersource). More...
bool | GetCollate () const
| Returns true if collation is on. More...
bool | GetColour () const
| Returns true if colour printing is on. More...
wxDuplexMode | GetDuplex () const
| Returns the duplex mode. More...
int | GetNoCopies () const
| Returns the number of copies requested by the user. More...
wxPrintOrientation | GetOrientation () const
| Gets the orientation. More...
wxPaperSize | GetPaperId () const
| Returns the paper size id. More...
const wxString & | GetPrinterName () const
| Returns the printer name. More...
wxPrintQuality | GetQuality () const
| Returns the current print quality. More...
bool | IsOk () const
| Returns true if the print data is valid for using in print dialogs. More...
void | SetBin (wxPrintBin flag)
| Sets the current bin. More...
void | SetCollate (bool flag)
| Sets collation to on or off. More...
void | SetColour (bool flag)
| Sets colour printing on or off. More...
void | SetDuplex (wxDuplexMode mode)
| Returns the duplex mode. More...
void | SetNoCopies (int n)
| Sets the default number of copies to be printed out. More...
void | SetOrientation (wxPrintOrientation orientation)
| Sets the orientation. More...
void | SetPaperId (wxPaperSize paperId)
| Sets the paper id. More...
void | SetPaperSize (const wxSize &size)
| Sets custom paper size. More...
void | SetPrinterName (const wxString &printerName)
| Sets the printer name. More...
void | SetQuality (wxPrintQuality quality)
| Sets the desired print quality. More...
wxPrintData & | operator= (const wxPrintData &data)
| Assigns print data to this object. More...
wxString | GetFilename () const
void | SetFilename (const wxString &filename)
wxPrintMode | GetPrintMode () const
void | SetPrintMode (wxPrintMode printMode)
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
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). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...
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. More...

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
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. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

## Constructor & Destructor Documentation

## ◆ wxPrintData() [1/2]

wxPrintData::wxPrintData | ( |  | ) |

Default constructor.

## ◆ wxPrintData() [2/2]

wxPrintData::wxPrintData | ( | const wxPrintData & | data | ) |

Copy constructor.

## ◆ ~wxPrintData()

virtual wxPrintData::~wxPrintData | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ GetBin()

wxPrintBin wxPrintData::GetBin | ( |  | ) | const

Returns the current bin (papersource).

By default, the system is left to select the bin (`wxPRINTBIN_DEFAULT` is returned).

See SetBin() for the full list of bin values.

## ◆ GetCollate()

bool wxPrintData::GetCollate | ( |  | ) | const

Returns true if collation is on.

## ◆ GetColour()

bool wxPrintData::GetColour | ( |  | ) | const

Returns true if colour printing is on.

## ◆ GetDuplex()

wxDuplexMode wxPrintData::GetDuplex | ( |  | ) | const

Returns the duplex mode.

One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL, wxDUPLEX_VERTICAL.

## ◆ GetFilename()

wxString wxPrintData::GetFilename | ( |  | ) | const

## ◆ GetNoCopies()

int wxPrintData::GetNoCopies | ( |  | ) | const

Returns the number of copies requested by the user.

## ◆ GetOrientation()

wxPrintOrientation wxPrintData::GetOrientation | ( |  | ) | const

Gets the orientation.

This can be wxLANDSCAPE or wxPORTRAIT.

## ◆ GetPaperId()

wxPaperSize wxPrintData::GetPaperId | ( |  | ) | const

Returns the paper size id.

See also
  SetPaperId()

## ◆ GetPrinterName()

const wxString& wxPrintData::GetPrinterName | ( |  | ) | const

Returns the printer name.

If the printer name is the empty string, it indicates that the default printer should be used.

## ◆ GetPrintMode()

wxPrintMode wxPrintData::GetPrintMode | ( |  | ) | const

## ◆ GetQuality()

wxPrintQuality wxPrintData::GetQuality | ( |  | ) | const

Returns the current print quality.

This can be a positive integer, denoting the number of dots per inch, or one of the following identifiers:

- wxPRINT_QUALITY_HIGH
- wxPRINT_QUALITY_MEDIUM
- wxPRINT_QUALITY_LOW
- wxPRINT_QUALITY_DRAFT

On input you should pass one of these identifiers, but on return you may get back a positive integer indicating the current resolution setting.

## ◆ IsOk()

bool wxPrintData::IsOk | ( |  | ) | const

Returns true if the print data is valid for using in print dialogs.

This can return false on Windows if the current printer is not set, for example. On all other platforms, it returns true.

## ◆ operator=()

wxPrintData& wxPrintData::operator= | ( | const wxPrintData & | data | ) |

Assigns print data to this object.

## ◆ SetBin()

void wxPrintData::SetBin | ( | wxPrintBin | flag | ) |

Sets the current bin.

## ◆ SetCollate()

void wxPrintData::SetCollate | ( | bool | flag | ) |

Sets collation to on or off.

## ◆ SetColour()

void wxPrintData::SetColour | ( | bool | flag | ) |

Sets colour printing on or off.

## ◆ SetDuplex()

void wxPrintData::SetDuplex | ( | wxDuplexMode | mode | ) |

Returns the duplex mode.

One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL, wxDUPLEX_VERTICAL.

## ◆ SetFilename()

void wxPrintData::SetFilename | ( | const wxString & | filename | ) |

## ◆ SetNoCopies()

void wxPrintData::SetNoCopies | ( | int | n | ) |

Sets the default number of copies to be printed out.

## ◆ SetOrientation()

void wxPrintData::SetOrientation | ( | wxPrintOrientation | orientation | ) |

Sets the orientation.

This can be wxLANDSCAPE or wxPORTRAIT.

## ◆ SetPaperId()

void wxPrintData::SetPaperId | ( | wxPaperSize | paperId | ) |

Sets the paper id.

This indicates the type of paper to be used. For a mapping between paper id, paper size and string name, see wxPrintPaperDatabase in `"paper.h"` (not yet documented).

See also
  SetPaperSize()

## ◆ SetPaperSize()

void wxPrintData::SetPaperSize | ( | const wxSize & | size | ) |

Sets custom paper size.

This method can be used to set up custom paper size. When using a standard size, prefer to use SetPaperId() instead.

## ◆ SetPrinterName()

void wxPrintData::SetPrinterName | ( | const wxString & | printerName | ) |

Sets the printer name.

This can be the empty string to indicate that the default printer should be used.

## ◆ SetPrintMode()

void wxPrintData::SetPrintMode | ( | wxPrintMode | printMode | ) |

## ◆ SetQuality()

void wxPrintData::SetQuality | ( | wxPrintQuality | quality | ) |

Sets the desired print quality.

This can be a positive integer, denoting the number of dots per inch, or one of the following identifiers:

- wxPRINT_QUALITY_HIGH
- wxPRINT_QUALITY_MEDIUM
- wxPRINT_QUALITY_LOW
- wxPRINT_QUALITY_DRAFT

On input you should pass one of these identifiers, but on return you may get back a positive integer indicating the current resolution setting.