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.
259 @category{printing,data}
261 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
262 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
263 wxPrinterDC, wxPostScriptDC
265 class wxPrintData
: public wxObject
276 wxPrintData(const wxPrintData
& data
);
281 virtual ~wxPrintData();
284 Returns the current bin (papersource). By default, the system is left
285 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
287 See SetBin() for the full list of bin values.
289 wxPrintBin
GetBin() const;
292 Returns @true if collation is on.
294 bool GetCollate() const;
297 Returns @true if colour printing is on.
299 bool GetColour() const;
302 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
305 wxDuplexMode
GetDuplex() const;
308 Returns the number of copies requested by the user.
310 int GetNoCopies() const;
313 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
315 wxPrintOrientation
GetOrientation() const;
318 Returns the paper size id.
322 wxPaperSize
GetPaperId() const;
325 Returns the printer name. If the printer name is the empty string, it
326 indicates that the default printer should be used.
328 const wxString
& GetPrinterName() const;
331 Returns the current print quality. This can be a positive integer,
332 denoting the number of dots per inch, or one of the following
335 - wxPRINT_QUALITY_HIGH
336 - wxPRINT_QUALITY_MEDIUM
337 - wxPRINT_QUALITY_LOW
338 - wxPRINT_QUALITY_DRAFT
340 On input you should pass one of these identifiers, but on return you
341 may get back a positive integer indicating the current resolution
344 wxPrintQuality
GetQuality() const;
347 Returns @true if the print data is valid for using in print dialogs.
348 This can return @false on Windows if the current printer is not set,
349 for example. On all other platforms, it returns @true.
354 Sets the current bin.
356 void SetBin(wxPrintBin flag
);
359 Sets collation to on or off.
361 void SetCollate(bool flag
);
364 Sets colour printing on or off.
366 void SetColour(bool flag
);
369 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
372 void SetDuplex(wxDuplexMode mode
);
375 Sets the default number of copies to be printed out.
377 void SetNoCopies(int n
);
380 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
382 void SetOrientation(wxPrintOrientation orientation
);
385 Sets the paper id. This indicates the type of paper to be used. For a
386 mapping between paper id, paper size and string name, see
387 wxPrintPaperDatabase in @c "paper.h" (not yet documented).
389 void SetPaperId(wxPaperSize paperId
);
392 Sets the printer name. This can be the empty string to indicate that
393 the default printer should be used.
395 void SetPrinterName(const wxString
& printerName
);
398 Sets the desired print quality. This can be a positive integer,
399 denoting the number of dots per inch, or one of the following
402 - wxPRINT_QUALITY_HIGH
403 - wxPRINT_QUALITY_MEDIUM
404 - wxPRINT_QUALITY_LOW
405 - wxPRINT_QUALITY_DRAFT
407 On input you should pass one of these identifiers, but on return you
408 may get back a positive integer indicating the current resolution
411 void SetQuality(wxPrintQuality quality
);
414 Assigns print data to this object.
416 wxPrintData
& operator =(const wxPrintData
& data
);
419 wxString
GetFilename() const;
420 void SetFilename( const wxString
&filename
);
422 wxPrintMode
GetPrintMode() const ;
423 void SetPrintMode(wxPrintMode printMode
) ;
429 @class wxPrintDialogData
431 This class holds information related to the visual characteristics of
432 wxPrintDialog. It contains a wxPrintData object with underlying printing
436 @category{printing,cmndlg,data}
438 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
440 class wxPrintDialogData
: public wxObject
451 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
454 Construct an object from a print dialog data object.
456 wxPrintDialogData(const wxPrintData
& printData
);
461 virtual ~wxPrintDialogData();
464 Enables or disables the "Help" button.
466 void EnableHelp(bool flag
);
469 Enables or disables the "Page numbers" controls.
471 void EnablePageNumbers(bool flag
);
474 Enables or disables the "Print to file" checkbox.
476 void EnablePrintToFile(bool flag
);
479 Enables or disables the "Selection" radio button.
481 void EnableSelection(bool flag
);
484 Returns @true if the user requested that all pages be printed.
486 bool GetAllPages() const;
489 Returns @true if the user requested that the document(s) be collated.
491 bool GetCollate() const;
494 Returns the @e from page number, as entered by the user.
496 int GetFromPage() const;
499 Returns the @e maximum page number.
501 int GetMaxPage() const;
504 Returns the @e minimum page number.
506 int GetMinPage() const;
509 Returns the number of copies requested by the user.
511 int GetNoCopies() const;
514 Returns a reference to the internal wxPrintData object.
516 wxPrintData
& GetPrintData();
519 Returns @true if the user has selected printing to a file.
521 bool GetPrintToFile() const;
524 Returns @true if the user requested that the selection be printed
525 (where "selection" is a concept specific to the application).
527 bool GetSelection() const;
530 Returns the @e "print to" page number, as entered by the user.
532 int GetToPage() const;
535 Returns @true if the print data is valid for using in print dialogs.
536 This can return @false on Windows if the current printer is not set,
537 for example. On all other platforms, it returns @true.
542 Sets the "Collate" checkbox to @true or @false.
544 void SetCollate(bool flag
);
547 Sets the @e from page number.
549 void SetFromPage(int page
);
552 Sets the @e maximum page number.
554 void SetMaxPage(int page
);
557 Sets the @e minimum page number.
559 void SetMinPage(int page
);
562 Sets the default number of copies the user has requested to be printed
565 void SetNoCopies(int n
);
568 Sets the internal wxPrintData.
570 void SetPrintData(const wxPrintData
& printData
);
573 Sets the "Print to file" checkbox to @true or @false.
575 void SetPrintToFile(bool flag
);
578 Selects the "Selection" radio button. The effect of printing the
579 selection depends on how the application implements this command, if at
582 void SetSelection(bool flag
);
585 @deprecated This function has been deprecated since version 2.5.4.
587 Determines whether the dialog to be shown will be the Print dialog
588 (pass @false) or Print Setup dialog (pass @true).
591 void SetSetupDialog(bool flag
);
594 Sets the @e "print to" page number.
596 void SetToPage(int page
);
599 Assigns print data to this object.
601 void operator =(const wxPrintData
& data
);
604 Assigns another print dialog data object to this object.
606 void operator =(const wxPrintDialogData
& data
);