]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/cmndata.h
Make the CreateTool factories be public so they can be used from application code
[wxWidgets.git] / interface / wx / cmndata.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: cmndata.h
4608b3f8 3// Purpose: interface of print wx*Data classes
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
23324ae1
FM
9/**
10 @class wxPageSetupDialogData
7c913512 11
23324ae1 12 This class holds a variety of information related to wxPageSetupDialog.
7c913512 13
23324ae1 14 It contains a wxPrintData member which is used to hold basic printer
d18d9f60
BP
15 configuration data (as opposed to the user-interface configuration settings
16 stored by wxPageSetupDialogData).
7c913512 17
23324ae1 18 @library{wxcore}
3c99e2fd 19 @category{printing,data}
7c913512 20
d18d9f60 21 @see @ref overview_printing, wxPageSetupDialog
23324ae1
FM
22*/
23class wxPageSetupDialogData : public wxObject
24{
25public:
23324ae1 26 /**
d18d9f60 27 Default constructor.
23324ae1
FM
28 */
29 wxPageSetupDialogData();
d18d9f60
BP
30
31 /**
32 Copy constructor.
33 */
4707b84c 34 wxPageSetupDialogData(const wxPageSetupDialogData& data);
d18d9f60
BP
35
36 /**
37 Construct an object from a print data object.
38 */
4707b84c 39 wxPageSetupDialogData(const wxPrintData& printData);
23324ae1
FM
40
41 /**
42 Destructor.
43 */
b7e94bd7 44 virtual ~wxPageSetupDialogData();
23324ae1
FM
45
46 /**
d18d9f60 47 Enables or disables the "Help" button (Windows only).
23324ae1
FM
48 */
49 void EnableHelp(bool flag);
50
51 /**
52 Enables or disables the margin controls (Windows only).
53 */
54 void EnableMargins(bool flag);
55
56 /**
57 Enables or disables the orientation control (Windows only).
58 */
59 void EnableOrientation(bool flag);
60
61 /**
62 Enables or disables the paper size control (Windows only).
63 */
64 void EnablePaper(bool flag);
65
66 /**
d18d9f60
BP
67 Enables or disables the "Printer" button, which invokes a printer setup
68 dialog.
23324ae1
FM
69 */
70 void EnablePrinter(bool flag);
71
72 /**
d18d9f60
BP
73 Returns @true if the dialog will simply return default printer
74 information (such as orientation) instead of showing a dialog (Windows
75 only).
23324ae1 76 */
328f5751 77 bool GetDefaultInfo() const;
23324ae1
FM
78
79 /**
d18d9f60
BP
80 Returns @true if the page setup dialog will take its minimum margin
81 values from the currently selected printer properties (Windows only).
23324ae1 82 */
328f5751 83 bool GetDefaultMinMargins() const;
23324ae1
FM
84
85 /**
86 Returns @true if the printer setup button is enabled.
87 */
328f5751 88 bool GetEnableHelp() const;
23324ae1
FM
89
90 /**
91 Returns @true if the margin controls are enabled (Windows only).
92 */
328f5751 93 bool GetEnableMargins() const;
23324ae1
FM
94
95 /**
96 Returns @true if the orientation control is enabled (Windows only).
97 */
328f5751 98 bool GetEnableOrientation() const;
23324ae1
FM
99
100 /**
101 Returns @true if the paper size control is enabled (Windows only).
102 */
328f5751 103 bool GetEnablePaper() const;
23324ae1
FM
104
105 /**
106 Returns @true if the printer setup button is enabled.
107 */
328f5751 108 bool GetEnablePrinter() const;
23324ae1
FM
109
110 /**
111 Returns the right (x) and bottom (y) margins in millimetres.
112 */
328f5751 113 wxPoint GetMarginBottomRight() const;
23324ae1
FM
114
115 /**
116 Returns the left (x) and top (y) margins in millimetres.
117 */
328f5751 118 wxPoint GetMarginTopLeft() const;
23324ae1
FM
119
120 /**
121 Returns the right (x) and bottom (y) minimum margins the user can enter
d18d9f60 122 (Windows only). Units are in millimetres.
23324ae1 123 */
328f5751 124 wxPoint GetMinMarginBottomRight() const;
23324ae1
FM
125
126 /**
d18d9f60
BP
127 Returns the left (x) and top (y) minimum margins the user can enter
128 (Windows only). Units are in millimetres.
23324ae1 129 */
328f5751 130 wxPoint GetMinMarginTopLeft() const;
23324ae1
FM
131
132 /**
133 Returns the paper id (stored in the internal wxPrintData object).
d18d9f60
BP
134
135 @see wxPrintData::SetPaperId()
23324ae1 136 */
328f5751 137 wxPaperSize GetPaperId() const;
23324ae1
FM
138
139 /**
140 Returns the paper size in millimetres.
141 */
328f5751 142 wxSize GetPaperSize() const;
23324ae1
FM
143
144 /**
d18d9f60 145 Returns a reference to the print data associated with this object.
23324ae1 146 */
4707b84c
FM
147 wxPrintData& GetPrintData();
148 const wxPrintData& GetPrintData() const;
23324ae1
FM
149
150 /**
d18d9f60
BP
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.
23324ae1 154 */
328f5751 155 bool IsOk() const;
23324ae1
FM
156
157 /**
d18d9f60
BP
158 Pass @true if the dialog will simply return default printer information
159 (such as orientation) instead of showing a dialog (Windows only).
23324ae1
FM
160 */
161 void SetDefaultInfo(bool flag);
162
163 /**
d18d9f60
BP
164 Pass @true if the page setup dialog will take its minimum margin values
165 from the currently selected printer properties (Windows only). Units
166 are in millimetres.
23324ae1
FM
167 */
168 void SetDefaultMinMargins(bool flag);
169
170 /**
171 Sets the right (x) and bottom (y) margins in millimetres.
172 */
173 void SetMarginBottomRight(const wxPoint& pt);
174
175 /**
176 Sets the left (x) and top (y) margins in millimetres.
177 */
178 void SetMarginTopLeft(const wxPoint& pt);
179
180 /**
d18d9f60
BP
181 Sets the right (x) and bottom (y) minimum margins the user can enter
182 (Windows only). Units are in millimetres.
23324ae1
FM
183 */
184 void SetMinMarginBottomRight(const wxPoint& pt);
185
186 /**
d18d9f60
BP
187 Sets the left (x) and top (y) minimum margins the user can enter
188 (Windows only). Units are in millimetres.
23324ae1
FM
189 */
190 void SetMinMarginTopLeft(const wxPoint& pt);
191
192 /**
d18d9f60
BP
193 Sets the paper size id. Calling this function overrides the explicit
194 paper dimensions passed in SetPaperSize().
195
196 @see wxPrintData::SetPaperId()
23324ae1 197 */
4707b84c 198 void SetPaperId(wxPaperSize id);
23324ae1
FM
199
200 /**
d18d9f60
BP
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.
23324ae1
FM
204 */
205 void SetPaperSize(const wxSize& size);
206
207 /**
d18d9f60 208 Sets the print data associated with this object.
23324ae1
FM
209 */
210 void SetPrintData(const wxPrintData& printData);
211
23324ae1 212 /**
d18d9f60 213 Assigns print data to this object.
23324ae1 214 */
4707b84c 215 wxPageSetupDialogData& operator =(const wxPrintData& data);
d18d9f60
BP
216
217 /**
218 Assigns page setup data to this object.
219 */
4707b84c 220 wxPageSetupDialogData& operator =(const wxPageSetupDialogData& data);
23324ae1
FM
221};
222
d18d9f60
BP
223/**
224 Enumeration of various printer bin sources.
225
226 @see wxPrintData::SetBin()
227*/
228enum wxPrintBin
229{
230 wxPRINTBIN_DEFAULT,
231
232 wxPRINTBIN_ONLYONE,
233 wxPRINTBIN_LOWER,
234 wxPRINTBIN_MIDDLE,
235 wxPRINTBIN_MANUAL,
236 wxPRINTBIN_ENVELOPE,
237 wxPRINTBIN_ENVMANUAL,
238 wxPRINTBIN_AUTO,
239 wxPRINTBIN_TRACTOR,
240 wxPRINTBIN_SMALLFMT,
241 wxPRINTBIN_LARGEFMT,
242 wxPRINTBIN_LARGECAPACITY,
243 wxPRINTBIN_CASSETTE,
244 wxPRINTBIN_FORMSOURCE,
245
246 wxPRINTBIN_USER,
247};
248
23324ae1
FM
249/**
250 @class wxPrintData
7c913512 251
d18d9f60
BP
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
23324ae1 256 between the print dialogs and the application.
7c913512 257
d18d9f60 258 @remarks
d62c1e62 259
d18d9f60
BP
260 The following functions are specific to PostScript printing and have not
261 yet been documented:
262
263 @code
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
d18d9f60
BP
274
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) ;
d18d9f60
BP
286 @endcode
287
23324ae1 288 @library{wxcore}
3c99e2fd 289 @category{printing,data}
7c913512 290
d18d9f60
BP
291 @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
292 wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
293 wxPrinterDC, wxPostScriptDC
23324ae1
FM
294*/
295class wxPrintData : public wxObject
296{
297public:
23324ae1 298 /**
d18d9f60 299 Default constructor.
23324ae1
FM
300 */
301 wxPrintData();
d18d9f60
BP
302
303 /**
304 Copy constructor.
305 */
7c913512 306 wxPrintData(const wxPrintData& data);
23324ae1
FM
307
308 /**
309 Destructor.
310 */
b7e94bd7 311 virtual ~wxPrintData();
23324ae1
FM
312
313 /**
d18d9f60
BP
314 Returns the current bin (papersource). By default, the system is left
315 to select the bin (@c wxPRINTBIN_DEFAULT is returned).
316
23324ae1
FM
317 See SetBin() for the full list of bin values.
318 */
328f5751 319 wxPrintBin GetBin() const;
23324ae1
FM
320
321 /**
322 Returns @true if collation is on.
323 */
328f5751 324 bool GetCollate() const;
23324ae1
FM
325
326 /**
327 Returns @true if colour printing is on.
328 */
328f5751 329 bool GetColour() const;
23324ae1
FM
330
331 /**
332 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
333 wxDUPLEX_VERTICAL.
334 */
328f5751 335 wxDuplexMode GetDuplex() const;
23324ae1
FM
336
337 /**
338 Returns the number of copies requested by the user.
339 */
328f5751 340 int GetNoCopies() const;
23324ae1
FM
341
342 /**
343 Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
344 */
af7e24c3 345 wxPrintOrientation GetOrientation() const;
23324ae1
FM
346
347 /**
d18d9f60
BP
348 Returns the paper size id.
349
350 @see SetPaperId()
23324ae1 351 */
328f5751 352 wxPaperSize GetPaperId() const;
23324ae1
FM
353
354 /**
d18d9f60
BP
355 Returns the printer name. If the printer name is the empty string, it
356 indicates that the default printer should be used.
23324ae1 357 */
4707b84c 358 const wxString& GetPrinterName() const;
23324ae1
FM
359
360 /**
d18d9f60
BP
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
363 identifiers:
3c4f71cc 364
d18d9f60
BP
365 - wxPRINT_QUALITY_HIGH
366 - wxPRINT_QUALITY_MEDIUM
367 - wxPRINT_QUALITY_LOW
368 - wxPRINT_QUALITY_DRAFT
369
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
372 setting.
23324ae1 373 */
328f5751 374 wxPrintQuality GetQuality() const;
23324ae1
FM
375
376 /**
377 Returns @true if the print data is valid for using in print dialogs.
d18d9f60
BP
378 This can return @false on Windows if the current printer is not set,
379 for example. On all other platforms, it returns @true.
23324ae1 380 */
328f5751 381 bool IsOk() const;
23324ae1
FM
382
383 /**
d18d9f60 384 Sets the current bin.
23324ae1
FM
385 */
386 void SetBin(wxPrintBin flag);
387
388 /**
389 Sets collation to on or off.
390 */
391 void SetCollate(bool flag);
392
393 /**
394 Sets colour printing on or off.
395 */
396 void SetColour(bool flag);
397
398 /**
399 Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
400 wxDUPLEX_VERTICAL.
401 */
402 void SetDuplex(wxDuplexMode mode);
403
404 /**
405 Sets the default number of copies to be printed out.
406 */
407 void SetNoCopies(int n);
408
409 /**
410 Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
411 */
af7e24c3 412 void SetOrientation(wxPrintOrientation orientation);
23324ae1
FM
413
414 /**
d18d9f60
BP
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).
23324ae1
FM
418 */
419 void SetPaperId(wxPaperSize paperId);
420
421 /**
d18d9f60
BP
422 Sets the printer name. This can be the empty string to indicate that
423 the default printer should be used.
23324ae1
FM
424 */
425 void SetPrinterName(const wxString& printerName);
426
427 /**
d18d9f60
BP
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
430 identifiers:
431
432 - wxPRINT_QUALITY_HIGH
433 - wxPRINT_QUALITY_MEDIUM
434 - wxPRINT_QUALITY_LOW
435 - wxPRINT_QUALITY_DRAFT
3c4f71cc 436
d18d9f60
BP
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
439 setting.
23324ae1
FM
440 */
441 void SetQuality(wxPrintQuality quality);
442
23324ae1 443 /**
d18d9f60 444 Assigns print data to this object.
23324ae1 445 */
11e3af6e 446 wxPrintData& operator =(const wxPrintData& data);
9a077460
RD
447
448
449 wxString GetFilename() const;
450 void SetFilename( const wxString &filename );
dc363328
RD
451
452 wxPrintMode GetPrintMode() const ;
453 void SetPrintMode(wxPrintMode printMode) ;
23324ae1
FM
454};
455
456
e54c96f1 457
23324ae1
FM
458/**
459 @class wxPrintDialogData
7c913512 460
23324ae1 461 This class holds information related to the visual characteristics of
d18d9f60
BP
462 wxPrintDialog. It contains a wxPrintData object with underlying printing
463 settings.
7c913512 464
23324ae1 465 @library{wxcore}
3c99e2fd 466 @category{printing,cmndlg,data}
7c913512 467
d18d9f60 468 @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
23324ae1
FM
469*/
470class wxPrintDialogData : public wxObject
471{
472public:
23324ae1 473 /**
d18d9f60 474 Default constructor.
23324ae1
FM
475 */
476 wxPrintDialogData();
d18d9f60
BP
477
478 /**
479 Copy constructor.
480 */
4707b84c 481 wxPrintDialogData(const wxPrintDialogData& dialogData);
d18d9f60
BP
482
483 /**
484 Construct an object from a print dialog data object.
485 */
4707b84c 486 wxPrintDialogData(const wxPrintData& printData);
23324ae1
FM
487
488 /**
489 Destructor.
490 */
b7e94bd7 491 virtual ~wxPrintDialogData();
23324ae1
FM
492
493 /**
d18d9f60 494 Enables or disables the "Help" button.
23324ae1
FM
495 */
496 void EnableHelp(bool flag);
497
498 /**
d18d9f60 499 Enables or disables the "Page numbers" controls.
23324ae1
FM
500 */
501 void EnablePageNumbers(bool flag);
502
503 /**
d18d9f60 504 Enables or disables the "Print to file" checkbox.
23324ae1
FM
505 */
506 void EnablePrintToFile(bool flag);
507
508 /**
d18d9f60 509 Enables or disables the "Selection" radio button.
23324ae1
FM
510 */
511 void EnableSelection(bool flag);
512
513 /**
514 Returns @true if the user requested that all pages be printed.
515 */
328f5751 516 bool GetAllPages() const;
23324ae1
FM
517
518 /**
519 Returns @true if the user requested that the document(s) be collated.
520 */
328f5751 521 bool GetCollate() const;
23324ae1
FM
522
523 /**
524 Returns the @e from page number, as entered by the user.
525 */
328f5751 526 int GetFromPage() const;
23324ae1
FM
527
528 /**
529 Returns the @e maximum page number.
530 */
328f5751 531 int GetMaxPage() const;
23324ae1
FM
532
533 /**
534 Returns the @e minimum page number.
535 */
328f5751 536 int GetMinPage() const;
23324ae1
FM
537
538 /**
539 Returns the number of copies requested by the user.
540 */
328f5751 541 int GetNoCopies() const;
23324ae1
FM
542
543 /**
544 Returns a reference to the internal wxPrintData object.
545 */
d18d9f60 546 wxPrintData& GetPrintData();
23324ae1
FM
547
548 /**
549 Returns @true if the user has selected printing to a file.
550 */
328f5751 551 bool GetPrintToFile() const;
23324ae1
FM
552
553 /**
d18d9f60
BP
554 Returns @true if the user requested that the selection be printed
555 (where "selection" is a concept specific to the application).
23324ae1 556 */
328f5751 557 bool GetSelection() const;
23324ae1
FM
558
559 /**
d18d9f60 560 Returns the @e "print to" page number, as entered by the user.
23324ae1 561 */
328f5751 562 int GetToPage() const;
23324ae1
FM
563
564 /**
565 Returns @true if the print data is valid for using in print dialogs.
d18d9f60
BP
566 This can return @false on Windows if the current printer is not set,
567 for example. On all other platforms, it returns @true.
23324ae1 568 */
328f5751 569 bool IsOk() const;
23324ae1
FM
570
571 /**
d18d9f60 572 Sets the "Collate" checkbox to @true or @false.
23324ae1
FM
573 */
574 void SetCollate(bool flag);
575
576 /**
577 Sets the @e from page number.
578 */
579 void SetFromPage(int page);
580
581 /**
582 Sets the @e maximum page number.
583 */
584 void SetMaxPage(int page);
585
586 /**
587 Sets the @e minimum page number.
588 */
589 void SetMinPage(int page);
590
591 /**
d18d9f60
BP
592 Sets the default number of copies the user has requested to be printed
593 out.
23324ae1
FM
594 */
595 void SetNoCopies(int n);
596
597 /**
598 Sets the internal wxPrintData.
599 */
600 void SetPrintData(const wxPrintData& printData);
601
602 /**
d18d9f60 603 Sets the "Print to file" checkbox to @true or @false.
23324ae1
FM
604 */
605 void SetPrintToFile(bool flag);
606
607 /**
d18d9f60
BP
608 Selects the "Selection" radio button. The effect of printing the
609 selection depends on how the application implements this command, if at
610 all.
23324ae1
FM
611 */
612 void SetSelection(bool flag);
613
614 /**
d18d9f60
BP
615 @deprecated This function has been deprecated since version 2.5.4.
616
23324ae1
FM
617 Determines whether the dialog to be shown will be the Print dialog
618 (pass @false) or Print Setup dialog (pass @true).
d62c1e62 619
23324ae1
FM
620 */
621 void SetSetupDialog(bool flag);
622
623 /**
d18d9f60 624 Sets the @e "print to" page number.
23324ae1
FM
625 */
626 void SetToPage(int page);
627
23324ae1 628 /**
d18d9f60 629 Assigns print data to this object.
23324ae1
FM
630 */
631 void operator =(const wxPrintData& data);
d18d9f60
BP
632
633 /**
634 Assigns another print dialog data object to this object.
635 */
7c913512 636 void operator =(const wxPrintDialogData& data);
23324ae1 637};
e54c96f1 638