]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_printfw.i
* wxPrintDialog no longer derives from wxDialog.
[wxWidgets.git] / wxPython / src / _printfw.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _????.i
3 // Purpose: SWIG interface for wx????
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 9-Aug-2003
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 %newgroup
18
19 %{
20 #include "wx/wxPython/printfw.h"
21
22 %}
23
24 MAKE_CONST_WXSTRING2(PrintoutTitleStr, wxT("Printout"));
25 MAKE_CONST_WXSTRING2(PreviewCanvasNameStr, wxT("previewcanvas"));
26
27
28 //---------------------------------------------------------------------------
29
30 enum wxPrintMode
31 {
32 wxPRINT_MODE_NONE = 0,
33 wxPRINT_MODE_PREVIEW = 1, // Preview in external application
34 wxPRINT_MODE_FILE = 2, // Print to file
35 wxPRINT_MODE_PRINTER = 3, // Send to printer
36 wxPRINT_MODE_STREAM = 4 // Send postscript data into a stream
37 };
38
39 enum wxPrintBin
40 {
41 wxPRINTBIN_DEFAULT,
42
43 wxPRINTBIN_ONLYONE,
44 wxPRINTBIN_LOWER,
45 wxPRINTBIN_MIDDLE,
46 wxPRINTBIN_MANUAL,
47 wxPRINTBIN_ENVELOPE,
48 wxPRINTBIN_ENVMANUAL,
49 wxPRINTBIN_AUTO,
50 wxPRINTBIN_TRACTOR,
51 wxPRINTBIN_SMALLFMT,
52 wxPRINTBIN_LARGEFMT,
53 wxPRINTBIN_LARGECAPACITY,
54 wxPRINTBIN_CASSETTE,
55 wxPRINTBIN_FORMSOURCE,
56
57 wxPRINTBIN_USER,
58 };
59
60
61 class wxPrintData : public wxObject {
62 public:
63 %nokwargs wxPrintData;
64 wxPrintData();
65 wxPrintData(const wxPrintData& data); // for making copies
66
67 ~wxPrintData();
68
69 int GetNoCopies();
70 bool GetCollate();
71 int GetOrientation();
72
73 bool Ok();
74
75 const wxString& GetPrinterName();
76 bool GetColour();
77 wxDuplexMode GetDuplex();
78 wxPaperSize GetPaperId();
79 const wxSize& GetPaperSize();
80
81 int GetQuality();
82 wxPrintBin GetBin();
83 wxPrintMode GetPrintMode() const;
84
85 void SetNoCopies(int v);
86 void SetCollate(bool flag);
87 void SetOrientation(int orient);
88
89 void SetPrinterName(const wxString& name);
90 void SetColour(bool colour);
91 void SetDuplex(wxDuplexMode duplex);
92 void SetPaperId(wxPaperSize sizeId);
93 void SetPaperSize(const wxSize& sz);
94 void SetQuality(int quality);
95 void SetBin(wxPrintBin bin);
96 void SetPrintMode(wxPrintMode printMode);
97
98 wxString GetFilename() const;
99 void SetFilename( const wxString &filename );
100
101 %pythoncode { def __nonzero__(self): return self.Ok() }
102
103
104 // NOTE: These are now inside of #if WXWIN_COMPATIBILITY_2_4, so be
105 // prepared to remove them...
106
107 // PostScript-specific data
108 const wxString& GetPrinterCommand();
109 const wxString& GetPrinterOptions();
110 const wxString& GetPreviewCommand();
111 const wxString& GetFontMetricPath();
112 double GetPrinterScaleX();
113 double GetPrinterScaleY();
114 long GetPrinterTranslateX();
115 long GetPrinterTranslateY();
116 void SetPrinterCommand(const wxString& command);
117 void SetPrinterOptions(const wxString& options);
118 void SetPreviewCommand(const wxString& command);
119 void SetFontMetricPath(const wxString& path);
120 void SetPrinterScaleX(double x);
121 void SetPrinterScaleY(double y);
122 void SetPrinterScaling(double x, double y);
123 void SetPrinterTranslateX(long x);
124 void SetPrinterTranslateY(long y);
125 void SetPrinterTranslation(long x, long y);
126
127 };
128
129 //---------------------------------------------------------------------------
130
131 class wxPageSetupDialogData : public wxObject {
132 public:
133 %nokwargs wxPageSetupDialogData;
134 wxPageSetupDialogData();
135 wxPageSetupDialogData(const wxPageSetupDialogData& data); // for making copies
136 ~wxPageSetupDialogData();
137
138 void EnableHelp(bool flag);
139 void EnableMargins(bool flag);
140 void EnableOrientation(bool flag);
141 void EnablePaper(bool flag);
142 void EnablePrinter(bool flag);
143 bool GetDefaultMinMargins();
144 bool GetEnableMargins();
145 bool GetEnableOrientation();
146 bool GetEnablePaper();
147 bool GetEnablePrinter();
148 bool GetEnableHelp();
149 bool GetDefaultInfo();
150 wxPoint GetMarginTopLeft();
151 wxPoint GetMarginBottomRight();
152 wxPoint GetMinMarginTopLeft();
153 wxPoint GetMinMarginBottomRight();
154 wxPaperSize GetPaperId();
155 wxSize GetPaperSize();
156
157 wxPrintData& GetPrintData();
158 // %addmethods {
159 // %new wxPrintData* GetPrintData() {
160 // return new wxPrintData(self->GetPrintData()); // force a copy
161 // }
162 // }
163
164 bool Ok();
165
166 void SetDefaultInfo(bool flag);
167 void SetDefaultMinMargins(bool flag);
168 void SetMarginTopLeft(const wxPoint& pt);
169 void SetMarginBottomRight(const wxPoint& pt);
170 void SetMinMarginTopLeft(const wxPoint& pt);
171 void SetMinMarginBottomRight(const wxPoint& pt);
172 void SetPaperId(wxPaperSize id);
173 void SetPaperSize(const wxSize& size);
174 void SetPrintData(const wxPrintData& printData);
175
176 %pythoncode { def __nonzero__(self): return self.Ok() }
177 };
178
179
180
181 MustHaveApp(wxPageSetupDialog);
182
183 class wxPageSetupDialog : public wxDialog {
184 public:
185 %pythonAppend wxPageSetupDialog "self._setOORInfo(self)"
186
187 wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL);
188
189 wxPageSetupDialogData& GetPageSetupData();
190 int ShowModal();
191 };
192
193 //---------------------------------------------------------------------------
194
195
196 class wxPrintDialogData : public wxObject {
197 public:
198 %nokwargs wxPrintDialogData;
199 wxPrintDialogData();
200 wxPrintDialogData(const wxPrintData& printData); // for making copies
201 ~wxPrintDialogData();
202
203 int GetFromPage() const;
204 int GetToPage() const;
205 int GetMinPage() const;
206 int GetMaxPage() const;
207 int GetNoCopies() const;
208 bool GetAllPages() const;
209 bool GetSelection() const;
210 bool GetCollate() const;
211 bool GetPrintToFile() const;
212
213 // WXWIN_COMPATIBILITY_2_4
214 bool GetSetupDialog() const;
215 void SetSetupDialog(bool flag);
216
217 void SetFromPage(int v);
218 void SetToPage(int v);
219 void SetMinPage(int v);
220 void SetMaxPage(int v);
221 void SetNoCopies(int v);
222 void SetAllPages(bool flag);
223 void SetSelection(bool flag);
224 void SetCollate(bool flag);
225 void SetPrintToFile(bool flag);
226
227 void EnablePrintToFile(bool flag);
228 void EnableSelection(bool flag);
229 void EnablePageNumbers(bool flag);
230 void EnableHelp(bool flag);
231
232 bool GetEnablePrintToFile() const;
233 bool GetEnableSelection() const;
234 bool GetEnablePageNumbers() const;
235 bool GetEnableHelp() const;
236
237 // Is this data OK for showing the print dialog?
238 bool Ok() const;
239
240
241 wxPrintData& GetPrintData();
242 void SetPrintData(const wxPrintData& printData);
243
244 %pythoncode { def __nonzero__(self): return self.Ok() }
245 };
246
247
248
249 MustHaveApp(wxPrintDialog);
250
251
252 // NOTE: Contrary to it's name, this class doesn't derive from wxDialog. It
253 // is a facade in front of a platform-specific (native dialog) provided by the
254 // wxPrintFactory.
255
256 class wxPrintDialog : public wxObject {
257 public:
258 wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL);
259
260 // TODO?: wxPrintDialog(wxWindow *parent, wxPrintData* data);
261
262 virtual int ShowModal();
263
264 virtual wxPrintDialogData& GetPrintDialogData();
265 virtual wxPrintData& GetPrintData();
266
267 %newobject GetPrintDC;
268 virtual wxDC *GetPrintDC();
269
270 };
271
272
273 //---------------------------------------------------------------------------
274 //---------------------------------------------------------------------------
275
276
277 enum wxPrinterError
278 {
279 wxPRINTER_NO_ERROR = 0,
280 wxPRINTER_CANCELLED,
281 wxPRINTER_ERROR
282 };
283
284
285 MustHaveApp(wxPrinter);
286
287 class wxPrinter : public wxObject {
288 public:
289 wxPrinter(wxPrintDialogData* data = NULL);
290 ~wxPrinter();
291
292 virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPyPrintout *printout);
293 virtual void ReportError(wxWindow *parent, wxPyPrintout *printout, const wxString& message);
294
295 virtual bool Setup(wxWindow *parent);
296 virtual bool Print(wxWindow *parent, wxPyPrintout *printout, bool prompt = true);
297 virtual wxDC* PrintDialog(wxWindow *parent);
298
299 virtual wxPrintDialogData& GetPrintDialogData() const;
300
301 bool GetAbort();
302 static wxPrinterError GetLastError();
303 };
304
305
306 //---------------------------------------------------------------------------
307 // Custom wxPrintout class that knows how to call python, See implementation in
308 // include/sx/wxPython/printfw.h
309
310 %{
311
312 IMPLEMENT_ABSTRACT_CLASS(wxPyPrintout, wxPrintout);
313
314 // Since this one would be tough and ugly to do with the Macros...
315 void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
316 bool hadErr = false;
317 bool found;
318
319 bool blocked = wxPyBeginBlockThreads();
320 if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) {
321 PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
322 if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) {
323 PyObject* val;
324
325 val = PyTuple_GetItem(result, 0);
326 if (PyInt_Check(val)) *minPage = PyInt_AsLong(val);
327 else hadErr = true;
328
329 val = PyTuple_GetItem(result, 1);
330 if (PyInt_Check(val)) *maxPage = PyInt_AsLong(val);
331 else hadErr = true;
332
333 val = PyTuple_GetItem(result, 2);
334 if (PyInt_Check(val)) *pageFrom = PyInt_AsLong(val);
335 else hadErr = true;
336
337 val = PyTuple_GetItem(result, 3);
338 if (PyInt_Check(val)) *pageTo = PyInt_AsLong(val);
339 else hadErr = true;
340 }
341 else
342 hadErr = true;
343
344 if (hadErr) {
345 PyErr_SetString(PyExc_TypeError, "GetPageInfo should return a tuple of 4 integers.");
346 PyErr_Print();
347 }
348 Py_DECREF(result);
349 }
350 wxPyEndBlockThreads(blocked);
351 if (! found)
352 wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
353 }
354
355 void wxPyPrintout::base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
356 wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
357 }
358
359
360 IMP_PYCALLBACK_BOOL_INTINT(wxPyPrintout, wxPrintout, OnBeginDocument);
361 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndDocument);
362 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnBeginPrinting);
363 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndPrinting);
364 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnPreparePrinting);
365 IMP_PYCALLBACK_BOOL_INT_pure(wxPyPrintout, wxPrintout, OnPrintPage);
366 IMP_PYCALLBACK_BOOL_INT(wxPyPrintout, wxPrintout, HasPage);
367
368
369 %}
370
371
372 MustHaveApp(wxPyPrintout);
373
374 // Now define the custom class for SWIGging
375 %name(Printout) class wxPyPrintout : public wxObject {
376 public:
377 %pythonAppend wxPyPrintout "self._setCallbackInfo(self, Printout)"
378
379 wxPyPrintout(const wxString& title = wxPyPrintoutTitleStr);
380 //~wxPyPrintout(); wxPrintPreview object takes ownership...
381
382 void _setCallbackInfo(PyObject* self, PyObject* _class);
383
384
385 wxString GetTitle() const;
386 wxDC* GetDC();
387 void SetDC(wxDC *dc);
388
389 void SetPageSizePixels(int w, int h);
390 DocDeclA(
391 void, GetPageSizePixels(int *OUTPUT, int *OUTPUT),
392 "GetPageSizePixels() -> (w, h)");
393
394 void SetPageSizeMM(int w, int h);
395 DocDeclA(
396 void, GetPageSizeMM(int *OUTPUT, int *OUTPUT),
397 "GetPageSizeMM() -> (w, h)");
398
399 void SetPPIScreen(int x, int y);
400 DocDeclA(
401 void, GetPPIScreen(int *OUTPUT, int *OUTPUT),
402 "GetPPIScreen() -> (x,y)");
403
404 void SetPPIPrinter(int x, int y);
405 DocDeclA(
406 void, GetPPIPrinter(int *OUTPUT, int *OUTPUT),
407 "GetPPIPrinter() -> (x,y)");
408
409 bool IsPreview();
410 void SetIsPreview(bool p);
411
412
413 bool base_OnBeginDocument(int startPage, int endPage);
414 void base_OnEndDocument();
415 void base_OnBeginPrinting();
416 void base_OnEndPrinting();
417 void base_OnPreparePrinting();
418 bool base_HasPage(int page);
419 DocDeclA(
420 void, base_GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
421 "base_GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)");
422 };
423
424 //---------------------------------------------------------------------------
425
426
427
428 MustHaveApp(wxPreviewCanvas);
429
430 class wxPreviewCanvas: public wxScrolledWindow
431 {
432 public:
433 %pythonAppend wxPreviewCanvas "self._setOORInfo(self)"
434
435 wxPreviewCanvas(wxPrintPreview *preview,
436 wxWindow *parent,
437 const wxPoint& pos = wxDefaultPosition,
438 const wxSize& size = wxDefaultSize,
439 long style = 0,
440 const wxString& name = wxPyPreviewCanvasNameStr);
441 };
442
443
444 MustHaveApp(wxPreviewFrame);
445
446 class wxPreviewFrame : public wxFrame {
447 public:
448 %pythonAppend wxPreviewFrame "self._setOORInfo(self)"
449
450 wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title,
451 const wxPoint& pos = wxDefaultPosition,
452 const wxSize& size = wxDefaultSize,
453 long style = wxDEFAULT_FRAME_STYLE,
454 const wxString& name = wxPyFrameNameStr);
455
456 void Initialize();
457 void CreateControlBar();
458 void CreateCanvas();
459
460 wxPreviewControlBar* GetControlBar() const;
461 };
462
463
464
465 enum {
466 wxPREVIEW_PRINT,
467 wxPREVIEW_PREVIOUS,
468 wxPREVIEW_NEXT,
469 wxPREVIEW_ZOOM,
470 wxPREVIEW_FIRST,
471 wxPREVIEW_LAST,
472 wxPREVIEW_GOTO,
473 wxPREVIEW_DEFAULT,
474
475 wxID_PREVIEW_CLOSE,
476 wxID_PREVIEW_NEXT,
477 wxID_PREVIEW_PREVIOUS,
478 wxID_PREVIEW_PRINT,
479 wxID_PREVIEW_ZOOM,
480 wxID_PREVIEW_FIRST,
481 wxID_PREVIEW_LAST,
482 wxID_PREVIEW_GOTO
483 };
484
485 MustHaveApp(wxPreviewControlBar);
486
487 class wxPreviewControlBar: public wxPanel
488 {
489 public:
490 %pythonAppend wxPreviewControlBar "self._setOORInfo(self)"
491
492 wxPreviewControlBar(wxPrintPreview *preview,
493 long buttons,
494 wxWindow *parent,
495 const wxPoint& pos = wxDefaultPosition,
496 const wxSize& size = wxDefaultSize,
497 long style = wxTAB_TRAVERSAL,
498 const wxString& name = wxPyPanelNameStr);
499
500 int GetZoomControl();
501 void SetZoomControl(int zoom);
502 wxPrintPreview* GetPrintPreview();
503
504 void OnNext();
505 void OnPrevious();
506 void OnFirst();
507 void OnLast();
508 void OnGoto();
509 };
510
511
512
513 //---------------------------------------------------------------------------
514
515 MustHaveApp(wxPrintPreview);
516
517 class wxPrintPreview : public wxObject {
518 public:
519 %nokwargs wxPrintPreview;
520 wxPrintPreview(wxPyPrintout* printout,
521 wxPyPrintout* printoutForPrinting,
522 wxPrintDialogData *data=NULL);
523 wxPrintPreview(wxPyPrintout* printout,
524 wxPyPrintout* printoutForPrinting,
525 wxPrintData* data);
526
527 virtual bool SetCurrentPage(int pageNum);
528 int GetCurrentPage();
529
530 void SetPrintout(wxPyPrintout *printout);
531 wxPyPrintout *GetPrintout();
532 wxPyPrintout *GetPrintoutForPrinting();
533
534 void SetFrame(wxFrame *frame);
535 void SetCanvas(wxPreviewCanvas *canvas);
536
537 virtual wxFrame *GetFrame();
538 virtual wxPreviewCanvas *GetCanvas();
539
540 // The preview canvas should call this from OnPaint
541 virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
542
543 // This draws a blank page onto the preview canvas
544 virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
545
546 // This is called by wxPrintPreview to render a page into a wxMemoryDC.
547 virtual bool RenderPage(int pageNum);
548
549 // Adjusts the scrollbars for the current scale
550 virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
551
552 wxPrintDialogData& GetPrintDialogData();
553
554 virtual void SetZoom(int percent);
555 int GetZoom();
556
557 int GetMaxPage();
558 int GetMinPage();
559
560 bool Ok();
561 void SetOk(bool ok);
562
563 virtual bool Print(bool interactive);
564 virtual void DetermineScaling();
565
566 %pythoncode { def __nonzero__(self): return self.Ok() }
567 };
568
569
570
571 //---------------------------------------------------------------------------
572
573 // Python-derivable versions of the above preview classes
574
575 %{
576
577 #define DEC_PYCALLBACK_BOOL_PREWINDC(CBNAME) \
578 bool CBNAME(wxPreviewCanvas* a, wxDC& b); \
579 bool base_##CBNAME(wxPreviewCanvas* a, wxDC& b)
580
581
582 #define IMP_PYCALLBACK_BOOL_PREWINDC(CLASS, PCLASS, CBNAME) \
583 bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \
584 bool rval=false; \
585 bool found; \
586 bool blocked = wxPyBeginBlockThreads(); \
587 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
588 PyObject* win = wxPyMake_wxObject(a,false); \
589 PyObject* dc = wxPyMake_wxObject(&b,false); \
590 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc)); \
591 Py_DECREF(win); \
592 Py_DECREF(dc); \
593 } \
594 wxPyEndBlockThreads(blocked); \
595 if (! found) \
596 rval = PCLASS::CBNAME(a, b); \
597 return rval; \
598 } \
599 bool CLASS::base_##CBNAME(wxPreviewCanvas* a, wxDC& b) { \
600 return PCLASS::CBNAME(a, b); \
601 }
602
603
604
605
606 class wxPyPrintPreview : public wxPrintPreview
607 {
608 DECLARE_CLASS(wxPyPrintPreview)
609 public:
610 wxPyPrintPreview(wxPyPrintout* printout,
611 wxPyPrintout* printoutForPrinting,
612 wxPrintDialogData* data=NULL)
613 : wxPrintPreview(printout, printoutForPrinting, data)
614 {}
615 wxPyPrintPreview(wxPyPrintout* printout,
616 wxPyPrintout* printoutForPrinting,
617 wxPrintData* data=NULL)
618 : wxPrintPreview(printout, printoutForPrinting, data)
619 {}
620
621 DEC_PYCALLBACK_BOOL_INT(SetCurrentPage);
622 DEC_PYCALLBACK_BOOL_PREWINDC(PaintPage);
623 DEC_PYCALLBACK_BOOL_PREWINDC(DrawBlankPage);
624 DEC_PYCALLBACK_BOOL_INT(RenderPage);
625 DEC_PYCALLBACK_VOID_INT(SetZoom);
626 DEC_PYCALLBACK_BOOL_BOOL(Print);
627 DEC_PYCALLBACK_VOID_(DetermineScaling);
628
629 PYPRIVATE;
630 };
631
632 // Stupid renamed classes... Fix this in 2.5...
633 #if defined(__WXMSW__)
634 IMPLEMENT_CLASS( wxPyPrintPreview, wxWindowsPrintPreview );
635 #elif defined(__WXMAC__)
636 IMPLEMENT_CLASS( wxPyPrintPreview, wxMacPrintPreview );
637 #else
638 IMPLEMENT_CLASS( wxPyPrintPreview, wxPostScriptPrintPreview );
639 #endif
640
641 IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, SetCurrentPage);
642 IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, PaintPage);
643 IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, DrawBlankPage);
644 IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, RenderPage);
645 IMP_PYCALLBACK_VOID_INT (wxPyPrintPreview, wxPrintPreview, SetZoom);
646 IMP_PYCALLBACK_BOOL_BOOL (wxPyPrintPreview, wxPrintPreview, Print);
647 IMP_PYCALLBACK_VOID_ (wxPyPrintPreview, wxPrintPreview, DetermineScaling);
648 %}
649
650
651 MustHaveApp(wxPyPrintPreview);
652
653 class wxPyPrintPreview : public wxPrintPreview
654 {
655 public:
656 %pythonAppend wxPyPrintPreview "self._setCallbackInfo(self, PyPrintPreview)"
657 %nokwargs wxPyPrintPreview;
658 wxPyPrintPreview(wxPyPrintout* printout,
659 wxPyPrintout* printoutForPrinting,
660 wxPrintDialogData* data=NULL);
661 wxPyPrintPreview(wxPyPrintout* printout,
662 wxPyPrintout* printoutForPrinting,
663 wxPrintData* data);
664
665 void _setCallbackInfo(PyObject* self, PyObject* _class);
666
667 bool base_SetCurrentPage(int pageNum);
668 bool base_PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
669 bool base_DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
670 bool base_RenderPage(int pageNum);
671 void base_SetZoom(int percent);
672 bool base_Print(bool interactive);
673 void base_DetermineScaling();
674 };
675
676
677
678
679 %{
680 class wxPyPreviewFrame : public wxPreviewFrame
681 {
682 DECLARE_CLASS(wxPyPreviewFrame);
683 public:
684 wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent,
685 const wxString& title,
686 const wxPoint& pos = wxDefaultPosition,
687 const wxSize& size = wxDefaultSize,
688 long style = wxDEFAULT_FRAME_STYLE,
689 const wxString& name = wxPyFrameNameStr)
690 : wxPreviewFrame(preview, parent, title, pos, size, style, name)
691 {}
692
693 void SetPreviewCanvas(wxPreviewCanvas* canvas) { m_previewCanvas = canvas; }
694 void SetControlBar(wxPreviewControlBar* bar) { m_controlBar = bar; }
695
696 DEC_PYCALLBACK_VOID_(Initialize);
697 DEC_PYCALLBACK_VOID_(CreateCanvas);
698 DEC_PYCALLBACK_VOID_(CreateControlBar);
699
700 PYPRIVATE;
701 };
702
703 IMPLEMENT_CLASS(wxPyPreviewFrame, wxPreviewFrame);
704
705 IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, Initialize);
706 IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateCanvas);
707 IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateControlBar);
708 %}
709
710
711 MustHaveApp(wxPyPreviewFrame);
712
713 class wxPyPreviewFrame : public wxPreviewFrame
714 {
715 public:
716 %pythonAppend wxPyPreviewFrame "self._setCallbackInfo(self, PyPreviewFrame); self._setOORInfo(self)"
717
718 wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent,
719 const wxString& title,
720 const wxPoint& pos = wxDefaultPosition,
721 const wxSize& size = wxDefaultSize,
722 long style = wxDEFAULT_FRAME_STYLE,
723 const wxString& name = wxPyFrameNameStr);
724
725 void _setCallbackInfo(PyObject* self, PyObject* _class);
726
727 void SetPreviewCanvas(wxPreviewCanvas* canvas);
728 void SetControlBar(wxPreviewControlBar* bar);
729
730 void base_Initialize();
731 void base_CreateCanvas();
732 void base_CreateControlBar();
733 };
734
735
736
737
738 %{
739 class wxPyPreviewControlBar : public wxPreviewControlBar
740 {
741 DECLARE_CLASS(wxPyPreviewControlBar);
742 public:
743 wxPyPreviewControlBar(wxPrintPreview *preview,
744 long buttons,
745 wxWindow *parent,
746 const wxPoint& pos = wxDefaultPosition,
747 const wxSize& size = wxDefaultSize,
748 long style = 0,
749 const wxString& name = wxPyPanelNameStr)
750 : wxPreviewControlBar(preview, buttons, parent, pos, size, style, name)
751 {}
752
753 void SetPrintPreview(wxPrintPreview* preview) { m_printPreview = preview; }
754
755 DEC_PYCALLBACK_VOID_(CreateButtons);
756 DEC_PYCALLBACK_VOID_INT(SetZoomControl);
757
758 PYPRIVATE;
759 };
760
761 IMPLEMENT_CLASS(wxPyPreviewControlBar, wxPreviewControlBar);
762 IMP_PYCALLBACK_VOID_(wxPyPreviewControlBar, wxPreviewControlBar, CreateButtons);
763 IMP_PYCALLBACK_VOID_INT(wxPyPreviewControlBar, wxPreviewControlBar, SetZoomControl);
764 %}
765
766
767 MustHaveApp(wxPyPreviewControlBar);
768
769 class wxPyPreviewControlBar : public wxPreviewControlBar
770 {
771 public:
772 %pythonAppend wxPyPreviewControlBar "self._setCallbackInfo(self, PyPreviewControlBar); self._setOORInfo(self)"
773
774 wxPyPreviewControlBar(wxPrintPreview *preview,
775 long buttons,
776 wxWindow *parent,
777 const wxPoint& pos = wxDefaultPosition,
778 const wxSize& size = wxDefaultSize,
779 long style = 0,
780 const wxString& name = wxPyPanelNameStr);
781
782 void _setCallbackInfo(PyObject* self, PyObject* _class);
783
784 void SetPrintPreview(wxPrintPreview* preview);
785
786 void base_CreateButtons();
787 void base_SetZoomControl(int zoom);
788 };
789
790 //---------------------------------------------------------------------------
791 //---------------------------------------------------------------------------
792 %init %{
793 wxPyPtrTypeMap_Add("wxPrintout", "wxPyPrintout");
794 %}
795 //---------------------------------------------------------------------------