1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of print wx*Data classes
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxPageSetupDialogData
12 This class holds a variety of information related to wxPageSetupDialog.
14 It contains a wxPrintData member which is used to hold basic printer
15 configuration data (as opposed to the user-interface configuration settings
16 stored by wxPageSetupDialogData).
19 @category{printing,data}
21 @see @ref overview_printing, wxPageSetupDialog
23 class wxPageSetupDialogData
: public wxObject
29 wxPageSetupDialogData();
34 wxPageSetupDialogData(const wxPageSetupDialogData
& data
);
37 Construct an object from a print data object.
39 wxPageSetupDialogData(const wxPrintData
& printData
);
44 virtual ~wxPageSetupDialogData();
47 Enables or disables the "Help" button (Windows only).
49 void EnableHelp(bool flag
);
52 Enables or disables the margin controls (Windows only).
54 void EnableMargins(bool flag
);
57 Enables or disables the orientation control (Windows only).
59 void EnableOrientation(bool flag
);
62 Enables or disables the paper size control (Windows only).
64 void EnablePaper(bool flag
);
67 Enables or disables the "Printer" button, which invokes a printer setup
70 void EnablePrinter(bool flag
);
73 Returns @true if the dialog will simply return default printer
74 information (such as orientation) instead of showing a dialog (Windows
77 bool GetDefaultInfo() const;
80 Returns @true if the page setup dialog will take its minimum margin
81 values from the currently selected printer properties (Windows only).
83 bool GetDefaultMinMargins() const;
86 Returns @true if the printer setup button is enabled.
88 bool GetEnableHelp() const;
91 Returns @true if the margin controls are enabled (Windows only).
93 bool GetEnableMargins() const;
96 Returns @true if the orientation control is enabled (Windows only).
98 bool GetEnableOrientation() const;
101 Returns @true if the paper size control is enabled (Windows only).
103 bool GetEnablePaper() const;
106 Returns @true if the printer setup button is enabled.
108 bool GetEnablePrinter() const;
111 Returns the right (x) and bottom (y) margins in millimetres.
113 wxPoint
GetMarginBottomRight() const;
116 Returns the left (x) and top (y) margins in millimetres.
118 wxPoint
GetMarginTopLeft() const;
121 Returns the right (x) and bottom (y) minimum margins the user can enter
122 (Windows only). Units are in millimetres.
124 wxPoint
GetMinMarginBottomRight() const;
127 Returns the left (x) and top (y) minimum margins the user can enter
128 (Windows only). Units are in millimetres.
130 wxPoint
GetMinMarginTopLeft() const;
133 Returns the paper id (stored in the internal wxPrintData object).
135 @see wxPrintData::SetPaperId()
137 wxPaperSize
GetPaperId() const;
140 Returns the paper size in millimetres.
142 wxSize
GetPaperSize() const;
145 Returns a reference to the print data associated with this object.
147 wxPrintData
& GetPrintData();
148 const wxPrintData
& GetPrintData() const;
151 Returns @true if the print data associated with the dialog data is
152 valid. This can return @false on Windows if the current printer is not
153 set, for example. On all other platforms, it returns @true.
158 Pass @true if the dialog will simply return default printer information
159 (such as orientation) instead of showing a dialog (Windows only).
161 void SetDefaultInfo(bool flag
);
164 Pass @true if the page setup dialog will take its minimum margin values
165 from the currently selected printer properties (Windows only). Units
168 void SetDefaultMinMargins(bool flag
);
171 Sets the right (x) and bottom (y) margins in millimetres.
173 void SetMarginBottomRight(const wxPoint
& pt
);
176 Sets the left (x) and top (y) margins in millimetres.
178 void SetMarginTopLeft(const wxPoint
& pt
);
181 Sets the right (x) and bottom (y) minimum margins the user can enter
182 (Windows only). Units are in millimetres.
184 void SetMinMarginBottomRight(const wxPoint
& pt
);
187 Sets the left (x) and top (y) minimum margins the user can enter
188 (Windows only). Units are in millimetres.
190 void SetMinMarginTopLeft(const wxPoint
& pt
);
193 Sets the paper size id. Calling this function overrides the explicit
194 paper dimensions passed in SetPaperSize().
196 @see wxPrintData::SetPaperId()
198 void SetPaperId(wxPaperSize id
);
201 Sets the paper size in millimetres. If a corresponding paper id is
202 found, it will be set in the internal wxPrintData object, otherwise the
203 paper size overrides the paper id.
205 void SetPaperSize(const wxSize
& size
);
208 Sets the print data associated with this object.
210 void SetPrintData(const wxPrintData
& printData
);
213 Assigns print data to this object.
215 wxPageSetupDialogData
& operator =(const wxPrintData
& data
);
218 Assigns page setup data to this object.
220 wxPageSetupDialogData
& operator =(const wxPageSetupDialogData
& data
);
224 Enumeration of various printer bin sources.
226 @see wxPrintData::SetBin()
237 wxPRINTBIN_ENVMANUAL
,
242 wxPRINTBIN_LARGECAPACITY
,
244 wxPRINTBIN_FORMSOURCE
,
252 This class holds a variety of information related to printers and printer
253 device contexts. This class is used to create a wxPrinterDC and a
254 wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
255 wxPageSetupDialogData, as part of the mechanism for transferring data
256 between the print dialogs and the application.
260 The following functions are specific to PostScript printing and have not
264 const wxString& GetPrinterCommand() const ;
265 const wxString& GetPrinterOptions() const ;
266 const wxString& GetPreviewCommand() const ;
267 const wxString& GetFilename() const ;
268 const wxString& GetFontMetricPath() const ;
269 double GetPrinterScaleX() const ;
270 double GetPrinterScaleY() const ;
271 long GetPrinterTranslateX() const ;
272 long GetPrinterTranslateY() const ;
273 // wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
274 wxPrintMode GetPrintMode() const ;
276 void SetPrinterCommand(const wxString& command) ;
277 void SetPrinterOptions(const wxString& options) ;
278 void SetPreviewCommand(const wxString& command) ;
279 void SetFilename(const wxString& filename) ;
280 void SetFontMetricPath(const wxString& path) ;
281 void SetPrinterScaleX(double x) ;
282 void SetPrinterScaleY(double y) ;
283 void SetPrinterScaling(double x, double y) ;
284 void SetPrinterTranslateX(long x) ;
285 void SetPrinterTranslateY(long y) ;
286 void SetPrinterTranslation(long x, long y) ;
287 void SetPrintMode(wxPrintMode printMode) ;
291 @category{printing,data}
293 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
294 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
295 wxPrinterDC, wxPostScriptDC
297 class wxPrintData
: public wxObject
308 wxPrintData(const wxPrintData
& data
);
313 virtual ~wxPrintData();
316 Returns the current bin (papersource). By default, the system is left
317 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
319 See SetBin() for the full list of bin values.
321 wxPrintBin
GetBin() const;
324 Returns @true if collation is on.
326 bool GetCollate() const;
329 Returns @true if colour printing is on.
331 bool GetColour() const;
334 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
337 wxDuplexMode
GetDuplex() const;
340 Returns the number of copies requested by the user.
342 int GetNoCopies() const;
345 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
347 wxPrintOrientation
GetOrientation() const;
350 Returns the paper size id.
354 wxPaperSize
GetPaperId() const;
357 Returns the printer name. If the printer name is the empty string, it
358 indicates that the default printer should be used.
360 const wxString
& GetPrinterName() const;
363 Returns the current print quality. This can be a positive integer,
364 denoting the number of dots per inch, or one of the following
367 - wxPRINT_QUALITY_HIGH
368 - wxPRINT_QUALITY_MEDIUM
369 - wxPRINT_QUALITY_LOW
370 - wxPRINT_QUALITY_DRAFT
372 On input you should pass one of these identifiers, but on return you
373 may get back a positive integer indicating the current resolution
376 wxPrintQuality
GetQuality() const;
379 Returns @true if the print data is valid for using in print dialogs.
380 This can return @false on Windows if the current printer is not set,
381 for example. On all other platforms, it returns @true.
386 Sets the current bin.
388 void SetBin(wxPrintBin flag
);
391 Sets collation to on or off.
393 void SetCollate(bool flag
);
396 Sets colour printing on or off.
398 void SetColour(bool flag
);
401 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
404 void SetDuplex(wxDuplexMode mode
);
407 Sets the default number of copies to be printed out.
409 void SetNoCopies(int n
);
412 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
414 void SetOrientation(wxPrintOrientation orientation
);
417 Sets the paper id. This indicates the type of paper to be used. For a
418 mapping between paper id, paper size and string name, see
419 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
421 void SetPaperId(wxPaperSize paperId
);
424 Sets the printer name. This can be the empty string to indicate that
425 the default printer should be used.
427 void SetPrinterName(const wxString
& printerName
);
430 Sets the desired print quality. This can be a positive integer,
431 denoting the number of dots per inch, or one of the following
434 - wxPRINT_QUALITY_HIGH
435 - wxPRINT_QUALITY_MEDIUM
436 - wxPRINT_QUALITY_LOW
437 - wxPRINT_QUALITY_DRAFT
439 On input you should pass one of these identifiers, but on return you
440 may get back a positive integer indicating the current resolution
443 void SetQuality(wxPrintQuality quality
);
446 Assigns print data to this object.
448 wxPrintData
& operator =(const wxPrintData
& data
);
451 wxString
GetFilename() const;
452 void SetFilename( const wxString
&filename
);
458 @class wxPrintDialogData
460 This class holds information related to the visual characteristics of
461 wxPrintDialog. It contains a wxPrintData object with underlying printing
465 @category{printing,cmndlg,data}
467 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
469 class wxPrintDialogData
: public wxObject
480 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
483 Construct an object from a print dialog data object.
485 wxPrintDialogData(const wxPrintData
& printData
);
490 virtual ~wxPrintDialogData();
493 Enables or disables the "Help" button.
495 void EnableHelp(bool flag
);
498 Enables or disables the "Page numbers" controls.
500 void EnablePageNumbers(bool flag
);
503 Enables or disables the "Print to file" checkbox.
505 void EnablePrintToFile(bool flag
);
508 Enables or disables the "Selection" radio button.
510 void EnableSelection(bool flag
);
513 Returns @true if the user requested that all pages be printed.
515 bool GetAllPages() const;
518 Returns @true if the user requested that the document(s) be collated.
520 bool GetCollate() const;
523 Returns the @e from page number, as entered by the user.
525 int GetFromPage() const;
528 Returns the @e maximum page number.
530 int GetMaxPage() const;
533 Returns the @e minimum page number.
535 int GetMinPage() const;
538 Returns the number of copies requested by the user.
540 int GetNoCopies() const;
543 Returns a reference to the internal wxPrintData object.
545 wxPrintData
& GetPrintData();
548 Returns @true if the user has selected printing to a file.
550 bool GetPrintToFile() const;
553 Returns @true if the user requested that the selection be printed
554 (where "selection" is a concept specific to the application).
556 bool GetSelection() const;
559 Returns the @e "print to" page number, as entered by the user.
561 int GetToPage() const;
564 Returns @true if the print data is valid for using in print dialogs.
565 This can return @false on Windows if the current printer is not set,
566 for example. On all other platforms, it returns @true.
571 Sets the "Collate" checkbox to @true or @false.
573 void SetCollate(bool flag
);
576 Sets the @e from page number.
578 void SetFromPage(int page
);
581 Sets the @e maximum page number.
583 void SetMaxPage(int page
);
586 Sets the @e minimum page number.
588 void SetMinPage(int page
);
591 Sets the default number of copies the user has requested to be printed
594 void SetNoCopies(int n
);
597 Sets the internal wxPrintData.
599 void SetPrintData(const wxPrintData
& printData
);
602 Sets the "Print to file" checkbox to @true or @false.
604 void SetPrintToFile(bool flag
);
607 Selects the "Selection" radio button. The effect of printing the
608 selection depends on how the application implements this command, if at
611 void SetSelection(bool flag
);
614 @deprecated This function has been deprecated since version 2.5.4.
616 Determines whether the dialog to be shown will be the Print dialog
617 (pass @false) or Print Setup dialog (pass @true).
620 void SetSetupDialog(bool flag
);
623 Sets the @e "print to" page number.
625 void SetToPage(int page
);
628 Assigns print data to this object.
630 void operator =(const wxPrintData
& data
);
633 Assigns another print dialog data object to this object.
635 void operator =(const wxPrintDialogData
& data
);