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