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