1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of print wx*Data classes
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 @class wxPageSetupDialogData
11 This class holds a variety of information related to wxPageSetupDialog.
13 It contains a wxPrintData member which is used to hold basic printer
14 configuration data (as opposed to the user-interface configuration settings
15 stored by wxPageSetupDialogData).
18 @category{printing,data}
20 @see @ref overview_printing, wxPageSetupDialog
22 class wxPageSetupDialogData
: public wxObject
28 wxPageSetupDialogData();
33 wxPageSetupDialogData(const wxPageSetupDialogData
& data
);
36 Construct an object from a print data object.
38 wxPageSetupDialogData(const wxPrintData
& printData
);
43 virtual ~wxPageSetupDialogData();
46 Enables or disables the "Help" button (Windows only).
48 void EnableHelp(bool flag
);
51 Enables or disables the margin controls (Windows only).
53 void EnableMargins(bool flag
);
56 Enables or disables the orientation control (Windows only).
58 void EnableOrientation(bool flag
);
61 Enables or disables the paper size control (Windows only).
63 void EnablePaper(bool flag
);
66 Enables or disables the "Printer" button, which invokes a printer setup
69 void EnablePrinter(bool flag
);
72 Returns @true if the dialog will simply return default printer
73 information (such as orientation) instead of showing a dialog (Windows
76 bool GetDefaultInfo() const;
79 Returns @true if the page setup dialog will take its minimum margin
80 values from the currently selected printer properties (Windows only).
82 bool GetDefaultMinMargins() const;
85 Returns @true if the printer setup button is enabled.
87 bool GetEnableHelp() const;
90 Returns @true if the margin controls are enabled (Windows only).
92 bool GetEnableMargins() const;
95 Returns @true if the orientation control is enabled (Windows only).
97 bool GetEnableOrientation() const;
100 Returns @true if the paper size control is enabled (Windows only).
102 bool GetEnablePaper() const;
105 Returns @true if the printer setup button is enabled.
107 bool GetEnablePrinter() const;
110 Returns the right (x) and bottom (y) margins in millimetres.
112 wxPoint
GetMarginBottomRight() const;
115 Returns the left (x) and top (y) margins in millimetres.
117 wxPoint
GetMarginTopLeft() const;
120 Returns the right (x) and bottom (y) minimum margins the user can enter
121 (Windows only). Units are in millimetres.
123 wxPoint
GetMinMarginBottomRight() const;
126 Returns the left (x) and top (y) minimum margins the user can enter
127 (Windows only). Units are in millimetres.
129 wxPoint
GetMinMarginTopLeft() const;
132 Returns the paper id (stored in the internal wxPrintData object).
134 @see wxPrintData::SetPaperId()
136 wxPaperSize
GetPaperId() const;
139 Returns the paper size in millimetres.
141 wxSize
GetPaperSize() const;
144 Returns a reference to the print data associated with this object.
146 wxPrintData
& GetPrintData();
147 const wxPrintData
& GetPrintData() const;
150 Returns @true if the print data associated with the dialog data is
151 valid. This can return @false on Windows if the current printer is not
152 set, for example. On all other platforms, it returns @true.
157 Pass @true if the dialog will simply return default printer information
158 (such as orientation) instead of showing a dialog (Windows only).
160 void SetDefaultInfo(bool flag
);
163 Pass @true if the page setup dialog will take its minimum margin values
164 from the currently selected printer properties (Windows only). Units
167 void SetDefaultMinMargins(bool flag
);
170 Sets the right (x) and bottom (y) margins in millimetres.
172 void SetMarginBottomRight(const wxPoint
& pt
);
175 Sets the left (x) and top (y) margins in millimetres.
177 void SetMarginTopLeft(const wxPoint
& pt
);
180 Sets the right (x) and bottom (y) minimum margins the user can enter
181 (Windows only). Units are in millimetres.
183 void SetMinMarginBottomRight(const wxPoint
& pt
);
186 Sets the left (x) and top (y) minimum margins the user can enter
187 (Windows only). Units are in millimetres.
189 void SetMinMarginTopLeft(const wxPoint
& pt
);
192 Sets the paper size id. Calling this function overrides the explicit
193 paper dimensions passed in SetPaperSize().
195 @see wxPrintData::SetPaperId()
197 void SetPaperId(wxPaperSize id
);
200 Sets the paper size in millimetres. If a corresponding paper id is
201 found, it will be set in the internal wxPrintData object, otherwise the
202 paper size overrides the paper id.
204 void SetPaperSize(const wxSize
& size
);
207 Sets the print data associated with this object.
209 void SetPrintData(const wxPrintData
& printData
);
212 Assigns print data to this object.
214 wxPageSetupDialogData
& operator =(const wxPrintData
& data
);
217 Assigns page setup data to this object.
219 wxPageSetupDialogData
& operator =(const wxPageSetupDialogData
& data
);
223 Enumeration of various printer bin sources.
225 @see wxPrintData::SetBin()
236 wxPRINTBIN_ENVMANUAL
,
241 wxPRINTBIN_LARGECAPACITY
,
243 wxPRINTBIN_FORMSOURCE
,
251 This class holds a variety of information related to printers and printer
252 device contexts. This class is used to create a wxPrinterDC and a
253 wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
254 wxPageSetupDialogData, as part of the mechanism for transferring data
255 between the print dialogs and the application.
258 @category{printing,data}
260 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
261 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
262 wxPrinterDC, wxPostScriptDC
264 class wxPrintData
: public wxObject
275 wxPrintData(const wxPrintData
& data
);
280 virtual ~wxPrintData();
283 Returns the current bin (papersource). By default, the system is left
284 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
286 See SetBin() for the full list of bin values.
288 wxPrintBin
GetBin() const;
291 Returns @true if collation is on.
293 bool GetCollate() const;
296 Returns @true if colour printing is on.
298 bool GetColour() const;
301 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
304 wxDuplexMode
GetDuplex() const;
307 Returns the number of copies requested by the user.
309 int GetNoCopies() const;
312 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
314 wxPrintOrientation
GetOrientation() const;
317 Returns the paper size id.
321 wxPaperSize
GetPaperId() const;
324 Returns the printer name. If the printer name is the empty string, it
325 indicates that the default printer should be used.
327 const wxString
& GetPrinterName() const;
330 Returns the current print quality. This can be a positive integer,
331 denoting the number of dots per inch, or one of the following
334 - wxPRINT_QUALITY_HIGH
335 - wxPRINT_QUALITY_MEDIUM
336 - wxPRINT_QUALITY_LOW
337 - wxPRINT_QUALITY_DRAFT
339 On input you should pass one of these identifiers, but on return you
340 may get back a positive integer indicating the current resolution
343 wxPrintQuality
GetQuality() const;
346 Returns @true if the print data is valid for using in print dialogs.
347 This can return @false on Windows if the current printer is not set,
348 for example. On all other platforms, it returns @true.
353 Sets the current bin.
355 void SetBin(wxPrintBin flag
);
358 Sets collation to on or off.
360 void SetCollate(bool flag
);
363 Sets colour printing on or off.
365 void SetColour(bool flag
);
368 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
371 void SetDuplex(wxDuplexMode mode
);
374 Sets the default number of copies to be printed out.
376 void SetNoCopies(int n
);
379 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
381 void SetOrientation(wxPrintOrientation orientation
);
384 Sets the paper id. This indicates the type of paper to be used. For a
385 mapping between paper id, paper size and string name, see
386 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
388 void SetPaperId(wxPaperSize paperId
);
391 Sets the printer name. This can be the empty string to indicate that
392 the default printer should be used.
394 void SetPrinterName(const wxString
& printerName
);
397 Sets the desired print quality. This can be a positive integer,
398 denoting the number of dots per inch, or one of the following
401 - wxPRINT_QUALITY_HIGH
402 - wxPRINT_QUALITY_MEDIUM
403 - wxPRINT_QUALITY_LOW
404 - wxPRINT_QUALITY_DRAFT
406 On input you should pass one of these identifiers, but on return you
407 may get back a positive integer indicating the current resolution
410 void SetQuality(wxPrintQuality quality
);
413 Assigns print data to this object.
415 wxPrintData
& operator =(const wxPrintData
& data
);
418 wxString
GetFilename() const;
419 void SetFilename( const wxString
&filename
);
421 wxPrintMode
GetPrintMode() const ;
422 void SetPrintMode(wxPrintMode printMode
) ;
428 @class wxPrintDialogData
430 This class holds information related to the visual characteristics of
431 wxPrintDialog. It contains a wxPrintData object with underlying printing
435 @category{printing,cmndlg,data}
437 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
439 class wxPrintDialogData
: public wxObject
450 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
453 Construct an object from a print dialog data object.
455 wxPrintDialogData(const wxPrintData
& printData
);
460 virtual ~wxPrintDialogData();
463 Enables or disables the "Help" button.
465 void EnableHelp(bool flag
);
468 Enables or disables the "Page numbers" controls.
470 void EnablePageNumbers(bool flag
);
473 Enables or disables the "Print to file" checkbox.
475 void EnablePrintToFile(bool flag
);
478 Enables or disables the "Selection" radio button.
480 void EnableSelection(bool flag
);
483 Returns @true if the user requested that all pages be printed.
485 bool GetAllPages() const;
488 Returns @true if the user requested that the document(s) be collated.
490 bool GetCollate() const;
493 Returns the @e from page number, as entered by the user.
495 int GetFromPage() const;
498 Returns the @e maximum page number.
500 int GetMaxPage() const;
503 Returns the @e minimum page number.
505 int GetMinPage() const;
508 Returns the number of copies requested by the user.
510 int GetNoCopies() const;
513 Returns a reference to the internal wxPrintData object.
515 wxPrintData
& GetPrintData();
518 Returns @true if the user has selected printing to a file.
520 bool GetPrintToFile() const;
523 Returns @true if the user requested that the selection be printed
524 (where "selection" is a concept specific to the application).
526 bool GetSelection() const;
529 Returns the @e "print to" page number, as entered by the user.
531 int GetToPage() const;
534 Returns @true if the print data is valid for using in print dialogs.
535 This can return @false on Windows if the current printer is not set,
536 for example. On all other platforms, it returns @true.
541 Sets the "Collate" checkbox to @true or @false.
543 void SetCollate(bool flag
);
546 Sets the @e from page number.
548 void SetFromPage(int page
);
551 Sets the @e maximum page number.
553 void SetMaxPage(int page
);
556 Sets the @e minimum page number.
558 void SetMinPage(int page
);
561 Sets the default number of copies the user has requested to be printed
564 void SetNoCopies(int n
);
567 Sets the internal wxPrintData.
569 void SetPrintData(const wxPrintData
& printData
);
572 Sets the "Print to file" checkbox to @true or @false.
574 void SetPrintToFile(bool flag
);
577 Selects the "Selection" radio button. The effect of printing the
578 selection depends on how the application implements this command, if at
581 void SetSelection(bool flag
);
584 @deprecated This function has been deprecated since version 2.5.4.
586 Determines whether the dialog to be shown will be the Print dialog
587 (pass @false) or Print Setup dialog (pass @true).
590 void SetSetupDialog(bool flag
);
593 Sets the @e "print to" page number.
595 void SetToPage(int page
);
598 Assigns print data to this object.
600 void operator =(const wxPrintData
& data
);
603 Assigns another print dialog data object to this object.
605 void operator =(const wxPrintDialogData
& data
);