]> git.saurik.com Git - wxWidgets.git/blame - interface/print.h
More proof-reading in wxImage
[wxWidgets.git] / interface / print.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: print.h
e54c96f1 3// Purpose: interface of wxPreviewControlBar
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxPreviewControlBar
11 @wxheader{print.h}
7c913512 12
23324ae1
FM
13 This is the default implementation of the preview control bar, a panel
14 with buttons and a zoom control. You can derive a new class from this and
15 override some or all member functions to change the behaviour and appearance;
16 or you can leave it as it is.
7c913512 17
23324ae1
FM
18 @library{wxbase}
19 @category{printing}
7c913512 20
e54c96f1 21 @see wxPreviewFrame, wxPreviewCanvas, wxPrintPreview
23324ae1
FM
22*/
23class wxPreviewControlBar : public wxPanel
24{
25public:
26 /**
27 Destructor.
28 */
29 ~wxPreviewControlBar();
30
31 /**
32 Creates buttons, according to value of the button style flags.
33 */
34 void CreateButtons();
35
36 /**
37 Gets the print preview object associated with the control bar.
38 */
4cc4bfaf 39 wxPrintPreview* GetPrintPreview();
23324ae1
FM
40
41 /**
42 Gets the current zoom setting in percent.
43 */
44 int GetZoomControl();
45
46 /**
47 Sets the zoom control.
48 */
49 void SetZoomControl(int percent);
50
51 /**
52 Constructor.
23324ae1
FM
53 The buttons parameter may be a combination of the following, using the bitwise
54 'or' operator.
3c4f71cc 55
23324ae1 56 wxPREVIEW_PRINT
3c4f71cc 57
23324ae1 58 Create a print button.
3c4f71cc 59
23324ae1 60 wxPREVIEW_NEXT
3c4f71cc 61
23324ae1 62 Create a next page button.
3c4f71cc 63
23324ae1 64 wxPREVIEW_PREVIOUS
3c4f71cc 65
23324ae1 66 Create a previous page button.
3c4f71cc 67
23324ae1 68 wxPREVIEW_ZOOM
3c4f71cc 69
23324ae1 70 Create a zoom control.
3c4f71cc 71
23324ae1 72 wxPREVIEW_DEFAULT
3c4f71cc 73
23324ae1
FM
74 Equivalent to a combination of wxPREVIEW_PREVIOUS, wxPREVIEW_NEXT and
75 wxPREVIEW_ZOOM.
76 */
7c913512
FM
77 wxPreviewControlBar(wxPrintPreview* preview, long buttons,
78 wxWindow* parent,
79 const wxPoint& pos = wxDefaultPosition,
80 const wxSize& size = wxDefaultSize,
81 long style = 0,
82 const wxString& name = "panel");
23324ae1
FM
83};
84
85
e54c96f1 86
23324ae1
FM
87/**
88 @class wxPreviewCanvas
89 @wxheader{print.h}
7c913512 90
23324ae1
FM
91 A preview canvas is the default canvas used by the print preview
92 system to display the preview.
7c913512 93
23324ae1
FM
94 @library{wxbase}
95 @category{printing}
7c913512 96
e54c96f1 97 @see wxPreviewFrame, wxPreviewControlBar, wxPrintPreview
23324ae1
FM
98*/
99class wxPreviewCanvas : public wxScrolledWindow
100{
101public:
102 /**
103 Constructor.
104 */
105 wxPreviewCanvas(wxPrintPreview* preview, wxWindow* parent,
106 const wxPoint& pos = wxDefaultPosition,
107 const wxSize& size = wxDefaultSize,
108 long style = 0,
109 const wxString& name = "canvas");
110
111 /**
112 Destructor.
113 */
114 ~wxPreviewCanvas();
115
116 /**
117 Calls wxPrintPreview::PaintPage to refresh the canvas.
118 */
119 void OnPaint(wxPaintEvent& event);
120};
121
122
e54c96f1 123
23324ae1
FM
124/**
125 @class wxPreviewFrame
126 @wxheader{print.h}
7c913512 127
23324ae1
FM
128 This class provides the default method of managing the print preview interface.
129 Member functions may be overridden to replace functionality, or the
130 class may be used without derivation.
7c913512 131
23324ae1
FM
132 @library{wxbase}
133 @category{printing}
7c913512 134
e54c96f1 135 @see wxPreviewCanvas, wxPreviewControlBar, wxPrintPreview
23324ae1
FM
136*/
137class wxPreviewFrame : public wxFrame
138{
139public:
140 /**
141 Constructor. Pass a print preview object plus other normal frame arguments.
142 The print preview object will be destroyed by the frame when it closes.
143 */
144 wxPreviewFrame(wxPrintPreview* preview, wxWindow* parent,
145 const wxString& title,
146 const wxPoint& pos = wxDefaultPosition,
147 const wxSize& size size = wxDefaultSize,
148 long style = wxDEFAULT_FRAME_STYLE,
149 const wxString& name = "frame");
150
151 /**
152 Destructor.
153 */
154 ~wxPreviewFrame();
155
156 /**
157 Creates a wxPreviewCanvas. Override this function to allow
158 a user-defined preview canvas object to be created.
159 */
160 void CreateCanvas();
161
162 /**
163 Creates a wxPreviewControlBar. Override this function to allow
164 a user-defined preview control bar object to be created.
165 */
166 void CreateControlBar();
167
168 /**
169 Creates the preview canvas and control bar, and calls
170 wxWindow::MakeModal(@true) to disable other top-level windows
171 in the application.
23324ae1
FM
172 This function should be called by the application prior to
173 showing the frame.
174 */
175 void Initialize();
176
177 /**
178 Enables the other frames in the application, and deletes the print preview
179 object, implicitly deleting any printout objects associated with the print
180 preview object.
181 */
182 void OnCloseWindow(wxCloseEvent& event);
183};
184
185
e54c96f1 186
23324ae1
FM
187/**
188 @class wxPrintPreview
189 @wxheader{print.h}
7c913512 190
23324ae1
FM
191 Objects of this class manage the print preview process. The object is passed
192 a wxPrintout object, and the wxPrintPreview object itself is passed to
193 a wxPreviewFrame object. Previewing is started by initializing and showing
194 the preview frame. Unlike wxPrinter::Print, flow of control returns to the
195 application
196 immediately after the frame is shown.
7c913512 197
23324ae1
FM
198 @library{wxbase}
199 @category{printing}
7c913512 200
e54c96f1 201 @see @ref overview_printingoverview "Printing framework overview", wxPrinterDC,
23324ae1
FM
202 wxPrintDialog, wxPrintout, wxPrinter, wxPreviewCanvas, wxPreviewControlBar, wxPreviewFrame.
203*/
204class wxPrintPreview : public wxObject
205{
206public:
207 /**
208 Constructor. Pass a printout object, an optional printout object to be
209 used for actual printing, and the address of an optional
210 block of printer data, which will be copied to the print preview object's
211 print data.
4cc4bfaf 212 If @a printoutForPrinting is non-@NULL, a @b Print... button will be placed on
23324ae1
FM
213 the
214 preview frame so that the user can print directly from the preview interface.
23324ae1
FM
215 Do not explicitly delete the printout objects once this destructor has been
216 called, since they will be deleted in the wxPrintPreview constructor.
4cc4bfaf 217 The same does not apply to the @a data argument.
23324ae1
FM
218 Test the Ok member to check whether the wxPrintPreview object was created
219 correctly.
220 Ok could return @false if there was a problem initializing the printer device
221 context
222 (current printer not set, for example).
223 */
224 wxPrintPreview(wxPrintout* printout,
225 wxPrintout* printoutForPrinting,
4cc4bfaf 226 wxPrintData* data = NULL);
23324ae1
FM
227
228 /**
229 Destructor. Deletes both print preview objects, so do not destroy these objects
230 in your application.
231 */
232 ~wxPrinter();
233
234 /**
235 Gets the preview window used for displaying the print preview image.
236 */
237 wxPreviewCanvas* GetCanvas();
238
239 /**
240 Gets the page currently being previewed.
241 */
242 int GetCurrentPage();
243
244 /**
245 Gets the frame used for displaying the print preview canvas
246 and control bar.
247 */
4cc4bfaf 248 wxFrame* GetFrame();
23324ae1
FM
249
250 /**
251 Returns the maximum page number.
252 */
253 int GetMaxPage();
254
255 /**
256 Returns the minimum page number.
257 */
258 int GetMinPage();
259
260 /**
261 Gets the preview printout object associated with the wxPrintPreview object.
262 */
4cc4bfaf 263 wxPrintout* GetPrintout();
23324ae1
FM
264
265 /**
266 Gets the printout object to be used for printing from within the preview
267 interface,
268 or @NULL if none exists.
269 */
4cc4bfaf 270 wxPrintout* GetPrintoutForPrinting();
23324ae1
FM
271
272 /**
273 Returns @true if the wxPrintPreview is valid, @false otherwise. It could return
274 @false if there was a
275 problem initializing the printer device context (current printer not set, for
276 example).
277 */
4cc4bfaf 278 bool Ok();
23324ae1
FM
279
280 /**
281 This refreshes the preview window with the preview image.
282 It must be called from the preview window's OnPaint member.
23324ae1
FM
283 The implementation simply blits the preview bitmap onto
284 the canvas, creating a new preview bitmap if none exists.
285 */
4cc4bfaf 286 bool PaintPage(wxPreviewCanvas* canvas, wxDC dc);
23324ae1
FM
287
288 /**
289 Invokes the print process using the second wxPrintout object
290 supplied in the wxPrintPreview constructor.
291 Will normally be called by the @b Print... panel item on the
292 preview frame's control bar.
23324ae1
FM
293 Returns @false in case of error -- call
294 wxPrinter::GetLastError to get detailed
295 information about the kind of the error.
296 */
297 bool Print(bool prompt);
298
299 /**
300 Renders a page into a wxMemoryDC. Used internally by wxPrintPreview.
301 */
302 bool RenderPage(int pageNum);
303
304 /**
305 Sets the window to be used for displaying the print preview image.
306 */
307 void SetCanvas(wxPreviewCanvas* window);
308
309 /**
310 Sets the current page to be previewed.
311 */
312 void SetCurrentPage(int pageNum);
313
314 /**
315 Sets the frame to be used for displaying the print preview canvas
316 and control bar.
317 */
4cc4bfaf 318 void SetFrame(wxFrame* frame);
23324ae1
FM
319
320 /**
321 Associates a printout object with the wxPrintPreview object.
322 */
4cc4bfaf 323 void SetPrintout(wxPrintout* printout);
23324ae1
FM
324
325 /**
326 Sets the percentage preview zoom, and refreshes the preview canvas
327 accordingly.
328 */
329 void SetZoom(int percent);
330};
331
332
e54c96f1 333
23324ae1
FM
334/**
335 @class wxPrinter
336 @wxheader{print.h}
7c913512 337
23324ae1
FM
338 This class represents the Windows or PostScript printer, and is the vehicle
339 through
340 which printing may be launched by an application. Printing can also
341 be achieved through using of lower functions and classes, but
342 this and associated classes provide a more convenient and general
343 method of printing.
7c913512 344
23324ae1
FM
345 @library{wxbase}
346 @category{printing}
7c913512 347
e54c96f1 348 @see @ref overview_printingoverview "Printing framework overview", wxPrinterDC,
23324ae1
FM
349 wxPrintDialog, wxPrintout, wxPrintPreview.
350*/
351class wxPrinter : public wxObject
352{
353public:
354 /**
355 Constructor. Pass an optional pointer to a block of print
356 dialog data, which will be copied to the printer object's local data.
3c4f71cc 357
4cc4bfaf 358 @see wxPrintDialogData, wxPrintData
23324ae1 359 */
4cc4bfaf 360 wxPrinter(wxPrintDialogData* data = NULL);
23324ae1
FM
361
362 /**
363 Creates the default printing abort window, with a cancel button.
364 */
365 void CreateAbortWindow(wxWindow* parent, wxPrintout* printout);
366
367 /**
368 Returns @true if the user has aborted the print job.
369 */
370 bool GetAbort();
371
372 /**
373 Return last error. Valid after calling Print(),
7c913512
FM
374 PrintDialog() or
375 wxPrintPreview::Print. These functions
23324ae1 376 set last error to @b wxPRINTER_NO_ERROR if no error happened.
23324ae1 377 Returned value is one of the following:
3c4f71cc 378
23324ae1 379 @b wxPRINTER_NO_ERROR
3c4f71cc 380
23324ae1 381 No error happened.
3c4f71cc 382
23324ae1 383 @b wxPRINTER_CANCELLED
3c4f71cc 384
23324ae1 385 The user cancelled printing.
3c4f71cc 386
23324ae1 387 @b wxPRINTER_ERROR
3c4f71cc 388
23324ae1
FM
389 There was an error during printing.
390 */
391 static wxPrinterError GetLastError();
392
393 /**
394 Returns the @ref overview_wxprintdata "print data" associated with the printer
395 object.
396 */
397 wxPrintDialogData GetPrintDialogData();
398
399 /**
400 Starts the printing process. Provide a parent window, a user-defined wxPrintout
401 object which controls
402 the printing of a document, and whether the print dialog should be invoked
403 first.
23324ae1
FM
404 Print could return @false if there was a problem initializing the printer device
405 context
406 (current printer not set, for example) or the user cancelled printing. Call
407 GetLastError() to get detailed
408 information about the kind of the error.
409 */
4cc4bfaf
FM
410 bool Print(wxWindow* parent, wxPrintout* printout,
411 bool prompt = true);
23324ae1
FM
412
413 /**
414 Invokes the print dialog. If successful (the user did not press Cancel
415 and no error occurred), a suitable device context will be returned
416 (otherwise @NULL is returned -- call
417 GetLastError() to get detailed
418 information about the kind of the error).
23324ae1
FM
419 The application must delete this device context to avoid a memory leak.
420 */
4cc4bfaf 421 wxDC* PrintDialog(wxWindow* parent);
23324ae1
FM
422
423 /**
424 Default error-reporting function.
425 */
4cc4bfaf 426 void ReportError(wxWindow* parent, wxPrintout* printout,
23324ae1
FM
427 const wxString& message);
428
429 /**
430 Invokes the print setup dialog. Note that the setup dialog is obsolete from
431 Windows 95, though retained for backward compatibility.
432 */
4cc4bfaf 433 bool Setup(wxWindow* parent);
23324ae1
FM
434};
435
436
e54c96f1 437
23324ae1
FM
438/**
439 @class wxPrintout
440 @wxheader{print.h}
7c913512 441
23324ae1
FM
442 This class encapsulates the functionality of printing out an application
443 document. A new class must be derived and members overridden to respond to calls
444 such as OnPrintPage and HasPage and to render the print image onto an associated
445 wxDC. Instances of this class are passed to wxPrinter::Print or
446 to a wxPrintPreview object to initiate printing or previewing.
7c913512 447
23324ae1
FM
448 Your derived wxPrintout is responsible for drawing both the preview image and
449 the printed page. If your windows' drawing routines accept an arbitrary DC as an
450 argument, you can re-use those routines within your wxPrintout subclass to draw
451 the printout image. You may also add additional drawing elements within your
452 wxPrintout subclass, like headers, footers, and/or page numbers. However, the
453 image on the printed page will often differ from the image drawn on the screen,
454 as will the print preview image -- not just in the presence of headers and
455 footers, but typically in scale. A high-resolution printer presents a much
456 larger drawing surface (i.e., a higher-resolution DC); a zoomed-out preview
457 image presents a much smaller drawing surface (lower-resolution DC). By using
458 the routines FitThisSizeToXXX() and/or MapScreenSizeToXXX() within your
459 wxPrintout subclass to set the user scale and origin of the associated DC, you
460 can easily use a single drawing routine to draw on your application's windows,
461 to create the print preview image, and to create the printed paper image, and
462 achieve a common appearance to the preview image and the printed page.
7c913512 463
23324ae1
FM
464 @library{wxbase}
465 @category{printing}
7c913512 466
e54c96f1 467 @see @ref overview_printingoverview "Printing framework overview", wxPrinterDC,
23324ae1
FM
468 wxPrintDialog, wxPageSetupDialog, wxPrinter, wxPrintPreview
469*/
470class wxPrintout : public wxObject
471{
472public:
473 /**
474 Constructor. Pass an optional title argument - the current filename would be a
475 good idea. This will appear in the printing list
476 (at least in MSW)
477 */
478 wxPrintout(const wxString& title = "Printout");
479
480 /**
481 Destructor.
482 */
483 ~wxPrintout();
484
485 /**
486 Set the user scale and device origin of the wxDC associated with this wxPrintout
487 so that the given image size fits entirely within the page rectangle and the
488 origin is at the top left corner of the page rectangle. On MSW and Mac, the page
489 rectangle is the printable area of the page. On other platforms and PostScript
490 printing, the page rectangle is the entire paper. Use this if you want your
7c913512 491 printed image as large as possible, but with the caveat that on some platforms,
23324ae1
FM
492 portions of the image might be cut off at the edges.
493 */
494 void FitThisSizeToPage(const wxSize& imageSize);
495
496 /**
497 Set the user scale and device origin of the wxDC associated with this wxPrintout
498 so that the given image size fits entirely within the page margins set in the
499 given wxPageSetupDialogData object. This function provides the greatest
500 consistency across all platforms because it does not depend on having access to
501 the printable area of the paper. Note that on Mac, the native wxPageSetupDialog
502 does not let you set the page margins; you'll have to provide your own
503 mechanism,
504 or you can use the Mac-only class wxMacPageMarginsDialog.
505 */
506 void FitThisSizeToPageMargins(const wxSize& imageSize,
507 const wxPageSetupDialogData& pageSetupData);
508
509 /**
510 Set the user scale and device origin of the wxDC associated with this wxPrintout
511 so that the given image size fits entirely within the paper and the origin is at
512 the top left corner of the paper. Note that with most printers, the region
513 around the edges of the paper are not printable so that the edges of the image
514 could be cut off. Use this if you're managing your own page margins.
515 */
516 void FitThisSizeToPaper(const wxSize& imageSize);
517
518 /**
519 Returns the device context associated with the printout (given to the printout
520 at start of
521 printing or previewing). This will be a wxPrinterDC if printing under Windows
522 or Mac,
523 a wxPostScriptDC if printing on other platforms, and a wxMemoryDC if previewing.
524 */
4cc4bfaf 525 wxDC* GetDC();
23324ae1
FM
526
527 /**
528 Return the rectangle corresponding to the page margins specified by the given
529 wxPageSetupDialogData object in the associated wxDC's logical coordinates for
530 the
531 current user scale and device origin. The page margins are specified
532 with respect to the edges of the paper on all platforms.
533 */
534 wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData);
535
536 /**
537 Return the rectangle corresponding to the page in the associated wxDC's
7c913512 538 logical coordinates for the current user scale and device origin.
23324ae1
FM
539 On MSW and Mac, this will be the printable area of the paper. On other platforms
540 and PostScript printing, this will be the full paper rectangle.
541 */
542 wxRect GetLogicalPageRect();
543
544 /**
545 Return the rectangle corresponding to the paper in the associated wxDC's
546 logical coordinates for the current user scale and device origin.
547 */
548 wxRect GetLogicalPaperRect();
549
550 /**
551 Returns the number of pixels per logical inch of the printer device context.
552 Dividing the printer PPI by the screen PPI can give a suitable scaling factor
553 for drawing text onto the printer. Remember to multiply this by a scaling factor
554 to take the preview DC size into account. Or you can just use the
555 FitThisSizeToXXX() and MapScreenSizeToXXX routines below, which do most of the
556 scaling calculations for you.
557 */
4cc4bfaf 558 void GetPPIPrinter(int* w, int* h);
23324ae1
FM
559
560 /**
561 Returns the number of pixels per logical inch of the screen device context.
562 Dividing the printer PPI by the screen PPI can give a suitable scaling factor
563 for drawing text onto the printer. If you are doing your own scaling, remember
564 to multiply this by a scaling factor to take the preview DC size into account.
565 */
4cc4bfaf 566 void GetPPIScreen(int* w, int* h);
23324ae1
FM
567
568 /**
569 Called by the framework to obtain information from the application about minimum
570 and maximum page values that the user can select, and the required page range to
571 be printed. By default this returns 1, 32000 for the page minimum and maximum
572 values, and 1, 1 for the required page range.
4cc4bfaf 573 If @a minPage is zero, the page number controls in the print dialog will be
23324ae1
FM
574 disabled.
575 */
4cc4bfaf
FM
576 void GetPageInfo(int* minPage, int* maxPage, int* pageFrom,
577 int* pageTo);
23324ae1
FM
578
579 /**
580 Returns the size of the printer page in millimetres.
581 */
4cc4bfaf 582 void GetPageSizeMM(int* w, int* h);
23324ae1
FM
583
584 /**
585 Returns the size of the printer page in pixels, called the page rectangle.
586 The page rectangle has a top left corner at (0,0) and a bottom right corner at
587 (w,h). These values may not be the same as the values returned from
588 wxDC::GetSize; if the printout is being used for
589 previewing, a memory device context is used, which uses a bitmap size reflecting
590 the current preview zoom. The application must take this discrepancy into
591 account if previewing is to be supported.
592 */
4cc4bfaf 593 void GetPageSizePixels(int* w, int* h);
23324ae1
FM
594
595 /**
596 Returns the rectangle that corresponds to the entire paper in pixels, called the
597 paper rectangle. This distinction between paper rectangle and page
598 rectangle reflects the fact that most printers cannot print all the way to the
599 edge of the paper. The page rectangle is a rectangle whose top left corner is at
600 (0,0) and whose width and height are given by
601 wxDC::GetPageSizePixels. On MSW and Mac,
602 the page rectangle gives the printable area of the paper, while the paper
603 rectangle represents the entire paper, including non-printable borders. Thus,
604 the rectangle returned by GetPaperRectPixels will have a top left corner whose
605 coordinates are small negative numbers and the bottom right corner will have
606 values somewhat larger than the width and height given by
607 wxDC::GetPageSizePixels. On other
608 platforms and for PostScript printing, the paper is treated as if its entire
609 area were printable, so this function will return the same rectangle as the page
610 rectangle.
611 */
612 wxRect GetPaperRectPixels();
613
614 /**
615 Returns the title of the printout
616 */
617 wxString GetTitle();
618
619 /**
620 Should be overridden to return @true if the document has this page, or @false
621 if not. Returning @false signifies the end of the document. By default,
622 HasPage behaves as if the document has only one page.
623 */
624 bool HasPage(int pageNum);
625
626 /**
627 Returns @true if the printout is currently being used for previewing.
628 */
629 bool IsPreview();
630
631 /**
632 Set the user scale and device origin of the wxDC associated with this wxPrintout
633 so that one screen pixel maps to one device pixel on the DC. That is, the user
634 scale is set to (1,1) and the device origin is set to (0,0). Use this if you
635 want to do your own scaling prior to calling wxDC drawing calls, for example, if
636 your underlying model is floating-point and you want to achieve maximum drawing
637 precision on high-resolution printers. (Note that while the underlying drawing
638 model of Mac OS X is floating-point, wxWidgets's drawing model scales from
639 integer
640 coordinates.) You can use the GetLogicalXXXRect() routines below to obtain the
641 paper rectangle, page rectangle, or page margins rectangle to perform your own
642 scaling.
643 */
644 void MapScreenSizeToDevice();
645
646 /**
647 This sets the user scale of the wxDC assocated with this wxPrintout to the same
648 scale as MapScreenSizeToPaper() but sets
649 the logical origin to the top left corner of the page rectangle.
650 */
651 void MapScreenSizeToPage();
652
653 /**
654 This sets the user scale of the wxDC assocated with this wxPrintout to the same
655 scale as
656 MapScreenSizeToPageMargins() but
657 sets the logical origin to the top left corner of the page margins specified by
658 the given wxPageSetupDialogData object.
659 */
660 void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData);
661
662 /**
663 Set the user scale and device origin of the wxDC associated with this wxPrintout
664 so that the printed page matches the screen size as closely as possible
665 and the logical origin is in the top left corner of the paper rectangle.
666 That is,
667 a 100-pixel object on screen should appear at the same size on the printed
668 page. (It
669 will, of course, be larger or smaller in the preview image, depending on the
670 zoom
671 factor.) Use this if you want WYSIWYG behavior, e.g., in a text editor.
672 */
673 void MapScreenSizeToPaper();
674
675 /**
676 Shift the device origin by an amount specified in logical coordinates.
677 */
678 void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff);
679
680 /**
681 Called by the framework at the start of document printing. Return @false from
682 this function cancels the print job. OnBeginDocument is called once for every
683 copy printed.
23324ae1
FM
684 The base OnBeginDocument() @e must be called (and the return value
685 checked) from within the overridden function, since it calls wxDC::StartDoc.
686 */
687 bool OnBeginDocument(int startPage, int endPage);
688
689 /**
690 Called by the framework at the start of printing. OnBeginPrinting is called
691 once for every
692 print job (regardless of how many copies are being printed).
693 */
694 void OnBeginPrinting();
695
696 /**
697 Called by the framework at the end of document printing. OnEndDocument
698 is called once for every copy printed.
23324ae1
FM
699 The base OnEndDocument() @e must be called
700 from within the overridden function, since it calls wxDC::EndDoc.
701 */
702 void OnEndDocument();
703
704 /**
705 Called by the framework at the end of printing. OnEndPrinting
706 is called once for every print job (regardless of how many copies are being
707 printed).
708 */
709 void OnEndPrinting();
710
711 /**
712 Called once by the framework before any other demands are made of the
713 wxPrintout object. This gives the object an opportunity to calculate the
714 number of pages in the document, for example.
715 */
716 void OnPreparePrinting();
717
718 /**
719 Called by the framework when a page should be printed. Returning @false cancels
720 the print job. The application can use GetDC() to obtain a device
721 context to draw on.
722 */
723 bool OnPrintPage(int pageNum);
724
725 /**
726 Set the device origin of the associated wxDC so that the current logical point
727 becomes the new logical origin.
728 */
729 void SetLogicalOrigin(wxCoord x, wxCoord y);
730};
e54c96f1 731