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
275 void SetPrinterCommand(const wxString& command) ;
276 void SetPrinterOptions(const wxString& options) ;
277 void SetPreviewCommand(const wxString& command) ;
278 void SetFilename(const wxString& filename) ;
279 void SetFontMetricPath(const wxString& path) ;
280 void SetPrinterScaleX(double x) ;
281 void SetPrinterScaleY(double y) ;
282 void SetPrinterScaling(double x, double y) ;
283 void SetPrinterTranslateX(long x) ;
284 void SetPrinterTranslateY(long y) ;
285 void SetPrinterTranslation(long x, long y) ;
289 @category{printing,data}
291 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
292 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
293 wxPrinterDC, wxPostScriptDC
295 class wxPrintData
: public wxObject
306 wxPrintData(const wxPrintData
& data
);
311 virtual ~wxPrintData();
314 Returns the current bin (papersource). By default, the system is left
315 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
317 See SetBin() for the full list of bin values.
319 wxPrintBin
GetBin() const;
322 Returns @true if collation is on.
324 bool GetCollate() const;
327 Returns @true if colour printing is on.
329 bool GetColour() const;
332 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
335 wxDuplexMode
GetDuplex() const;
338 Returns the number of copies requested by the user.
340 int GetNoCopies() const;
343 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
345 wxPrintOrientation
GetOrientation() const;
348 Returns the paper size id.
352 wxPaperSize
GetPaperId() const;
355 Returns the printer name. If the printer name is the empty string, it
356 indicates that the default printer should be used.
358 const wxString
& GetPrinterName() const;
361 Returns the current print quality. This can be a positive integer,
362 denoting the number of dots per inch, or one of the following
365 - wxPRINT_QUALITY_HIGH
366 - wxPRINT_QUALITY_MEDIUM
367 - wxPRINT_QUALITY_LOW
368 - wxPRINT_QUALITY_DRAFT
370 On input you should pass one of these identifiers, but on return you
371 may get back a positive integer indicating the current resolution
374 wxPrintQuality
GetQuality() const;
377 Returns @true if the print data is valid for using in print dialogs.
378 This can return @false on Windows if the current printer is not set,
379 for example. On all other platforms, it returns @true.
384 Sets the current bin.
386 void SetBin(wxPrintBin flag
);
389 Sets collation to on or off.
391 void SetCollate(bool flag
);
394 Sets colour printing on or off.
396 void SetColour(bool flag
);
399 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
402 void SetDuplex(wxDuplexMode mode
);
405 Sets the default number of copies to be printed out.
407 void SetNoCopies(int n
);
410 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
412 void SetOrientation(wxPrintOrientation orientation
);
415 Sets the paper id. This indicates the type of paper to be used. For a
416 mapping between paper id, paper size and string name, see
417 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
419 void SetPaperId(wxPaperSize paperId
);
422 Sets the printer name. This can be the empty string to indicate that
423 the default printer should be used.
425 void SetPrinterName(const wxString
& printerName
);
428 Sets the desired print quality. This can be a positive integer,
429 denoting the number of dots per inch, or one of the following
432 - wxPRINT_QUALITY_HIGH
433 - wxPRINT_QUALITY_MEDIUM
434 - wxPRINT_QUALITY_LOW
435 - wxPRINT_QUALITY_DRAFT
437 On input you should pass one of these identifiers, but on return you
438 may get back a positive integer indicating the current resolution
441 void SetQuality(wxPrintQuality quality
);
444 Assigns print data to this object.
446 wxPrintData
& operator =(const wxPrintData
& data
);
449 wxString
GetFilename() const;
450 void SetFilename( const wxString
&filename
);
452 wxPrintMode
GetPrintMode() const ;
453 void SetPrintMode(wxPrintMode printMode
) ;
459 @class wxPrintDialogData
461 This class holds information related to the visual characteristics of
462 wxPrintDialog. It contains a wxPrintData object with underlying printing
466 @category{printing,cmndlg,data}
468 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
470 class wxPrintDialogData
: public wxObject
481 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
484 Construct an object from a print dialog data object.
486 wxPrintDialogData(const wxPrintData
& printData
);
491 virtual ~wxPrintDialogData();
494 Enables or disables the "Help" button.
496 void EnableHelp(bool flag
);
499 Enables or disables the "Page numbers" controls.
501 void EnablePageNumbers(bool flag
);
504 Enables or disables the "Print to file" checkbox.
506 void EnablePrintToFile(bool flag
);
509 Enables or disables the "Selection" radio button.
511 void EnableSelection(bool flag
);
514 Returns @true if the user requested that all pages be printed.
516 bool GetAllPages() const;
519 Returns @true if the user requested that the document(s) be collated.
521 bool GetCollate() const;
524 Returns the @e from page number, as entered by the user.
526 int GetFromPage() const;
529 Returns the @e maximum page number.
531 int GetMaxPage() const;
534 Returns the @e minimum page number.
536 int GetMinPage() const;
539 Returns the number of copies requested by the user.
541 int GetNoCopies() const;
544 Returns a reference to the internal wxPrintData object.
546 wxPrintData
& GetPrintData();
549 Returns @true if the user has selected printing to a file.
551 bool GetPrintToFile() const;
554 Returns @true if the user requested that the selection be printed
555 (where "selection" is a concept specific to the application).
557 bool GetSelection() const;
560 Returns the @e "print to" page number, as entered by the user.
562 int GetToPage() const;
565 Returns @true if the print data is valid for using in print dialogs.
566 This can return @false on Windows if the current printer is not set,
567 for example. On all other platforms, it returns @true.
572 Sets the "Collate" checkbox to @true or @false.
574 void SetCollate(bool flag
);
577 Sets the @e from page number.
579 void SetFromPage(int page
);
582 Sets the @e maximum page number.
584 void SetMaxPage(int page
);
587 Sets the @e minimum page number.
589 void SetMinPage(int page
);
592 Sets the default number of copies the user has requested to be printed
595 void SetNoCopies(int n
);
598 Sets the internal wxPrintData.
600 void SetPrintData(const wxPrintData
& printData
);
603 Sets the "Print to file" checkbox to @true or @false.
605 void SetPrintToFile(bool flag
);
608 Selects the "Selection" radio button. The effect of printing the
609 selection depends on how the application implements this command, if at
612 void SetSelection(bool flag
);
615 @deprecated This function has been deprecated since version 2.5.4.
617 Determines whether the dialog to be shown will be the Print dialog
618 (pass @false) or Print Setup dialog (pass @true).
621 void SetSetupDialog(bool flag
);
624 Sets the @e "print to" page number.
626 void SetToPage(int page
);
629 Assigns print data to this object.
631 void operator =(const wxPrintData
& data
);
634 Assigns another print dialog data object to this object.
636 void operator =(const wxPrintDialogData
& data
);