]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_printfw.i
Use SetMinSize instead of SetSizeHints
[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 // NOTE: Contrary to it's name, this class doesn't derive from wxDialog. It
182 // is a facade in front of a platform-specific (native dialog) provided by the
183 // wxPrintFactory.
184
185 MustHaveApp(wxPageSetupDialog);
186
187 class wxPageSetupDialog : public wxObject
188 {
189 public:
190 wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL);
191
192 wxPageSetupDialogData& GetPageSetupData();
193 wxPageSetupDialogData& GetPageSetupDialogData();
194 int ShowModal();
195 };
196
197 //---------------------------------------------------------------------------
198
199
200 class wxPrintDialogData : public wxObject {
201 public:
202 %nokwargs wxPrintDialogData;
203 wxPrintDialogData();
204 wxPrintDialogData(const wxPrintData& printData); // for making copies
205 ~wxPrintDialogData();
206
207 int GetFromPage() const;
208 int GetToPage() const;
209 int GetMinPage() const;
210 int GetMaxPage() const;
211 int GetNoCopies() const;
212 bool GetAllPages() const;
213 bool GetSelection() const;
214 bool GetCollate() const;
215 bool GetPrintToFile() const;
216
217 // WXWIN_COMPATIBILITY_2_4
218 bool GetSetupDialog() const;
219 void SetSetupDialog(bool flag);
220
221 void SetFromPage(int v);
222 void SetToPage(int v);
223 void SetMinPage(int v);
224 void SetMaxPage(int v);
225 void SetNoCopies(int v);
226 void SetAllPages(bool flag);
227 void SetSelection(bool flag);
228 void SetCollate(bool flag);
229 void SetPrintToFile(bool flag);
230
231 void EnablePrintToFile(bool flag);
232 void EnableSelection(bool flag);
233 void EnablePageNumbers(bool flag);
234 void EnableHelp(bool flag);
235
236 bool GetEnablePrintToFile() const;
237 bool GetEnableSelection() const;
238 bool GetEnablePageNumbers() const;
239 bool GetEnableHelp() const;
240
241 // Is this data OK for showing the print dialog?
242 bool Ok() const;
243
244
245 wxPrintData& GetPrintData();
246 void SetPrintData(const wxPrintData& printData);
247
248 %pythoncode { def __nonzero__(self): return self.Ok() }
249 };
250
251
252
253 MustHaveApp(wxPrintDialog);
254
255
256 // NOTE: Contrary to it's name, this class doesn't derive from wxDialog. It
257 // is a facade in front of a platform-specific (native dialog) provided by the
258 // wxPrintFactory.
259
260 class wxPrintDialog : public wxObject {
261 public:
262 wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL);
263
264 // TODO?: wxPrintDialog(wxWindow *parent, wxPrintData* data);
265
266 virtual int ShowModal();
267
268 virtual wxPrintDialogData& GetPrintDialogData();
269 virtual wxPrintData& GetPrintData();
270
271 %newobject GetPrintDC;
272 virtual wxDC *GetPrintDC();
273
274 };
275
276
277 //---------------------------------------------------------------------------
278 //---------------------------------------------------------------------------
279
280
281 enum wxPrinterError
282 {
283 wxPRINTER_NO_ERROR = 0,
284 wxPRINTER_CANCELLED,
285 wxPRINTER_ERROR
286 };
287
288
289 MustHaveApp(wxPrinter);
290
291 class wxPrinter : public wxObject {
292 public:
293 wxPrinter(wxPrintDialogData* data = NULL);
294 ~wxPrinter();
295
296 virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPyPrintout *printout);
297 virtual void ReportError(wxWindow *parent, wxPyPrintout *printout, const wxString& message);
298
299 virtual bool Setup(wxWindow *parent);
300 virtual bool Print(wxWindow *parent, wxPyPrintout *printout, bool prompt = true);
301 virtual wxDC* PrintDialog(wxWindow *parent);
302
303 virtual wxPrintDialogData& GetPrintDialogData() const;
304
305 bool GetAbort();
306 static wxPrinterError GetLastError();
307 };
308
309
310 //---------------------------------------------------------------------------
311 // Custom wxPrintout class that knows how to call python, See implementation in
312 // include/sx/wxPython/printfw.h
313
314 %{
315
316 IMPLEMENT_ABSTRACT_CLASS(wxPyPrintout, wxPrintout);
317
318 // Since this one would be tough and ugly to do with the Macros...
319 void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
320 bool hadErr = false;
321 bool found;
322
323 bool blocked = wxPyBeginBlockThreads();
324 if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) {
325 PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
326 if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) {
327 PyObject* val;
328
329 val = PyTuple_GetItem(result, 0);
330 if (PyInt_Check(val)) *minPage = PyInt_AsLong(val);
331 else hadErr = true;
332
333 val = PyTuple_GetItem(result, 1);
334 if (PyInt_Check(val)) *maxPage = PyInt_AsLong(val);
335 else hadErr = true;
336
337 val = PyTuple_GetItem(result, 2);
338 if (PyInt_Check(val)) *pageFrom = PyInt_AsLong(val);
339 else hadErr = true;
340
341 val = PyTuple_GetItem(result, 3);
342 if (PyInt_Check(val)) *pageTo = PyInt_AsLong(val);
343 else hadErr = true;
344 }
345 else
346 hadErr = true;
347
348 if (hadErr) {
349 PyErr_SetString(PyExc_TypeError, "GetPageInfo should return a tuple of 4 integers.");
350 PyErr_Print();
351 }
352 Py_DECREF(result);
353 }
354 wxPyEndBlockThreads(blocked);
355 if (! found)
356 wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
357 }
358
359 void wxPyPrintout::base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
360 wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
361 }
362
363
364 IMP_PYCALLBACK_BOOL_INTINT(wxPyPrintout, wxPrintout, OnBeginDocument);
365 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndDocument);
366 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnBeginPrinting);
367 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndPrinting);
368 IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnPreparePrinting);
369 IMP_PYCALLBACK_BOOL_INT_pure(wxPyPrintout, wxPrintout, OnPrintPage);
370 IMP_PYCALLBACK_BOOL_INT(wxPyPrintout, wxPrintout, HasPage);
371
372
373 %}
374
375
376 MustHaveApp(wxPyPrintout);
377
378 // Now define the custom class for SWIGging
379 %name(Printout) class wxPyPrintout : public wxObject {
380 public:
381 %pythonAppend wxPyPrintout "self._setCallbackInfo(self, Printout)"
382
383 wxPyPrintout(const wxString& title = wxPyPrintoutTitleStr);
384 //~wxPyPrintout(); wxPrintPreview object takes ownership...
385
386 void _setCallbackInfo(PyObject* self, PyObject* _class);
387
388
389 wxString GetTitle() const;
390 wxDC* GetDC();
391 void SetDC(wxDC *dc);
392
393 void SetPageSizePixels(int w, int h);
394 DocDeclA(
395 void, GetPageSizePixels(int *OUTPUT, int *OUTPUT),
396 "GetPageSizePixels() -> (w, h)");
397
398 void SetPageSizeMM(int w, int h);
399 DocDeclA(
400 void, GetPageSizeMM(int *OUTPUT, int *OUTPUT),
401 "GetPageSizeMM() -> (w, h)");
402
403 void SetPPIScreen(int x, int y);
404 DocDeclA(
405 void, GetPPIScreen(int *OUTPUT, int *OUTPUT),
406 "GetPPIScreen() -> (x,y)");
407
408 void SetPPIPrinter(int x, int y);
409 DocDeclA(
410 void, GetPPIPrinter(int *OUTPUT, int *OUTPUT),
411 "GetPPIPrinter() -> (x,y)");
412
413 bool IsPreview();
414 void SetIsPreview(bool p);
415
416
417 bool base_OnBeginDocument(int startPage, int endPage);
418 void base_OnEndDocument();
419 void base_OnBeginPrinting();
420 void base_OnEndPrinting();
421 void base_OnPreparePrinting();
422 bool base_HasPage(int page);
423 DocDeclA(
424 void, base_GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
425 "base_GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)");
426 };
427
428 //---------------------------------------------------------------------------
429
430
431
432 MustHaveApp(wxPreviewCanvas);
433
434 class wxPreviewCanvas: public wxScrolledWindow
435 {
436 public:
437 %pythonAppend wxPreviewCanvas "self._setOORInfo(self)"
438
439 wxPreviewCanvas(wxPrintPreview *preview,
440 wxWindow *parent,
441 const wxPoint& pos = wxDefaultPosition,
442 const wxSize& size = wxDefaultSize,
443 long style = 0,
444 const wxString& name = wxPyPreviewCanvasNameStr);
445 };
446
447
448 MustHaveApp(wxPreviewFrame);
449
450 class wxPreviewFrame : public wxFrame {
451 public:
452 %pythonAppend wxPreviewFrame "self._setOORInfo(self)"
453
454 wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title,
455 const wxPoint& pos = wxDefaultPosition,
456 const wxSize& size = wxDefaultSize,
457 long style = wxDEFAULT_FRAME_STYLE,
458 const wxString& name = wxPyFrameNameStr);
459
460 void Initialize();
461 void CreateControlBar();
462 void CreateCanvas();
463
464 wxPreviewControlBar* GetControlBar() const;
465 };
466
467
468
469 enum {
470 wxPREVIEW_PRINT,
471 wxPREVIEW_PREVIOUS,
472 wxPREVIEW_NEXT,
473 wxPREVIEW_ZOOM,
474 wxPREVIEW_FIRST,
475 wxPREVIEW_LAST,
476 wxPREVIEW_GOTO,
477 wxPREVIEW_DEFAULT,
478
479 wxID_PREVIEW_CLOSE,
480 wxID_PREVIEW_NEXT,
481 wxID_PREVIEW_PREVIOUS,
482 wxID_PREVIEW_PRINT,
483 wxID_PREVIEW_ZOOM,
484 wxID_PREVIEW_FIRST,
485 wxID_PREVIEW_LAST,
486 wxID_PREVIEW_GOTO
487 };
488
489 MustHaveApp(wxPreviewControlBar);
490
491 class wxPreviewControlBar: public wxPanel
492 {
493 public:
494 %pythonAppend wxPreviewControlBar "self._setOORInfo(self)"
495
496 wxPreviewControlBar(wxPrintPreview *preview,
497 long buttons,
498 wxWindow *parent,
499 const wxPoint& pos = wxDefaultPosition,
500 const wxSize& size = wxDefaultSize,
501 long style = wxTAB_TRAVERSAL,
502 const wxString& name = wxPyPanelNameStr);
503
504 int GetZoomControl();
505 void SetZoomControl(int zoom);
506 wxPrintPreview* GetPrintPreview();
507
508 void OnNext();
509 void OnPrevious();
510 void OnFirst();
511 void OnLast();
512 void OnGoto();
513 };
514
515
516
517 //---------------------------------------------------------------------------
518
519 MustHaveApp(wxPrintPreview);
520
521 class wxPrintPreview : public wxObject {
522 public:
523 %nokwargs wxPrintPreview;
524 wxPrintPreview(wxPyPrintout* printout,
525 wxPyPrintout* printoutForPrinting,
526 wxPrintDialogData *data=NULL);
527 wxPrintPreview(wxPyPrintout* printout,
528 wxPyPrintout* printoutForPrinting,
529 wxPrintData* data);
530
531 virtual bool SetCurrentPage(int pageNum);
532 int GetCurrentPage();
533
534 void SetPrintout(wxPyPrintout *printout);
535 wxPyPrintout *GetPrintout();
536 wxPyPrintout *GetPrintoutForPrinting();
537
538 void SetFrame(wxFrame *frame);
539 void SetCanvas(wxPreviewCanvas *canvas);
540
541 virtual wxFrame *GetFrame();
542 virtual wxPreviewCanvas *GetCanvas();
543
544 // The preview canvas should call this from OnPaint
545 virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
546
547 // This draws a blank page onto the preview canvas
548 virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
549
550 // This is called by wxPrintPreview to render a page into a wxMemoryDC.
551 virtual bool RenderPage(int pageNum);
552
553 // Adjusts the scrollbars for the current scale
554 virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
555
556 wxPrintDialogData& GetPrintDialogData();
557
558 virtual void SetZoom(int percent);
559 int GetZoom();
560
561 int GetMaxPage();
562 int GetMinPage();
563
564 bool Ok();
565 void SetOk(bool ok);
566
567 virtual bool Print(bool interactive);
568 virtual void DetermineScaling();
569
570 %pythoncode { def __nonzero__(self): return self.Ok() }
571 };
572
573
574
575 //---------------------------------------------------------------------------
576
577 // Python-derivable versions of the above preview classes
578
579 %{
580
581 #define DEC_PYCALLBACK_BOOL_PREWINDC(CBNAME) \
582 bool CBNAME(wxPreviewCanvas* a, wxDC& b); \
583 bool base_##CBNAME(wxPreviewCanvas* a, wxDC& b)
584
585
586 #define IMP_PYCALLBACK_BOOL_PREWINDC(CLASS, PCLASS, CBNAME) \
587 bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \
588 bool rval=false; \
589 bool found; \
590 bool blocked = wxPyBeginBlockThreads(); \
591 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
592 PyObject* win = wxPyMake_wxObject(a,false); \
593 PyObject* dc = wxPyMake_wxObject(&b,false); \
594 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc)); \
595 Py_DECREF(win); \
596 Py_DECREF(dc); \
597 } \
598 wxPyEndBlockThreads(blocked); \
599 if (! found) \
600 rval = PCLASS::CBNAME(a, b); \
601 return rval; \
602 } \
603 bool CLASS::base_##CBNAME(wxPreviewCanvas* a, wxDC& b) { \
604 return PCLASS::CBNAME(a, b); \
605 }
606
607
608
609
610 class wxPyPrintPreview : public wxPrintPreview
611 {
612 DECLARE_CLASS(wxPyPrintPreview)
613 public:
614 wxPyPrintPreview(wxPyPrintout* printout,
615 wxPyPrintout* printoutForPrinting,
616 wxPrintDialogData* data=NULL)
617 : wxPrintPreview(printout, printoutForPrinting, data)
618 {}
619 wxPyPrintPreview(wxPyPrintout* printout,
620 wxPyPrintout* printoutForPrinting,
621 wxPrintData* data=NULL)
622 : wxPrintPreview(printout, printoutForPrinting, data)
623 {}
624
625 DEC_PYCALLBACK_BOOL_INT(SetCurrentPage);
626 DEC_PYCALLBACK_BOOL_PREWINDC(PaintPage);
627 DEC_PYCALLBACK_BOOL_PREWINDC(DrawBlankPage);
628 DEC_PYCALLBACK_BOOL_INT(RenderPage);
629 DEC_PYCALLBACK_VOID_INT(SetZoom);
630 DEC_PYCALLBACK_BOOL_BOOL(Print);
631 DEC_PYCALLBACK_VOID_(DetermineScaling);
632
633 PYPRIVATE;
634 };
635
636 // Stupid renamed classes... Fix this in 2.5...
637 #if defined(__WXMSW__)
638 IMPLEMENT_CLASS( wxPyPrintPreview, wxWindowsPrintPreview );
639 #elif defined(__WXMAC__)
640 IMPLEMENT_CLASS( wxPyPrintPreview, wxMacPrintPreview );
641 #else
642 IMPLEMENT_CLASS( wxPyPrintPreview, wxPostScriptPrintPreview );
643 #endif
644
645 IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, SetCurrentPage);
646 IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, PaintPage);
647 IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, DrawBlankPage);
648 IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, RenderPage);
649 IMP_PYCALLBACK_VOID_INT (wxPyPrintPreview, wxPrintPreview, SetZoom);
650 IMP_PYCALLBACK_BOOL_BOOL (wxPyPrintPreview, wxPrintPreview, Print);
651 IMP_PYCALLBACK_VOID_ (wxPyPrintPreview, wxPrintPreview, DetermineScaling);
652 %}
653
654
655 MustHaveApp(wxPyPrintPreview);
656
657 class wxPyPrintPreview : public wxPrintPreview
658 {
659 public:
660 %pythonAppend wxPyPrintPreview "self._setCallbackInfo(self, PyPrintPreview)"
661 %nokwargs wxPyPrintPreview;
662 wxPyPrintPreview(wxPyPrintout* printout,
663 wxPyPrintout* printoutForPrinting,
664 wxPrintDialogData* data=NULL);
665 wxPyPrintPreview(wxPyPrintout* printout,
666 wxPyPrintout* printoutForPrinting,
667 wxPrintData* data);
668
669 void _setCallbackInfo(PyObject* self, PyObject* _class);
670
671 bool base_SetCurrentPage(int pageNum);
672 bool base_PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
673 bool base_DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
674 bool base_RenderPage(int pageNum);
675 void base_SetZoom(int percent);
676 bool base_Print(bool interactive);
677 void base_DetermineScaling();
678 };
679
680
681
682
683 %{
684 class wxPyPreviewFrame : public wxPreviewFrame
685 {
686 DECLARE_CLASS(wxPyPreviewFrame);
687 public:
688 wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent,
689 const wxString& title,
690 const wxPoint& pos = wxDefaultPosition,
691 const wxSize& size = wxDefaultSize,
692 long style = wxDEFAULT_FRAME_STYLE,
693 const wxString& name = wxPyFrameNameStr)
694 : wxPreviewFrame(preview, parent, title, pos, size, style, name)
695 {}
696
697 void SetPreviewCanvas(wxPreviewCanvas* canvas) { m_previewCanvas = canvas; }
698 void SetControlBar(wxPreviewControlBar* bar) { m_controlBar = bar; }
699
700 DEC_PYCALLBACK_VOID_(Initialize);
701 DEC_PYCALLBACK_VOID_(CreateCanvas);
702 DEC_PYCALLBACK_VOID_(CreateControlBar);
703
704 PYPRIVATE;
705 };
706
707 IMPLEMENT_CLASS(wxPyPreviewFrame, wxPreviewFrame);
708
709 IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, Initialize);
710 IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateCanvas);
711 IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateControlBar);
712 %}
713
714
715 MustHaveApp(wxPyPreviewFrame);
716
717 class wxPyPreviewFrame : public wxPreviewFrame
718 {
719 public:
720 %pythonAppend wxPyPreviewFrame "self._setCallbackInfo(self, PyPreviewFrame); self._setOORInfo(self)"
721
722 wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent,
723 const wxString& title,
724 const wxPoint& pos = wxDefaultPosition,
725 const wxSize& size = wxDefaultSize,
726 long style = wxDEFAULT_FRAME_STYLE,
727 const wxString& name = wxPyFrameNameStr);
728
729 void _setCallbackInfo(PyObject* self, PyObject* _class);
730
731 void SetPreviewCanvas(wxPreviewCanvas* canvas);
732 void SetControlBar(wxPreviewControlBar* bar);
733
734 void base_Initialize();
735 void base_CreateCanvas();
736 void base_CreateControlBar();
737 };
738
739
740
741
742 %{
743 class wxPyPreviewControlBar : public wxPreviewControlBar
744 {
745 DECLARE_CLASS(wxPyPreviewControlBar);
746 public:
747 wxPyPreviewControlBar(wxPrintPreview *preview,
748 long buttons,
749 wxWindow *parent,
750 const wxPoint& pos = wxDefaultPosition,
751 const wxSize& size = wxDefaultSize,
752 long style = 0,
753 const wxString& name = wxPyPanelNameStr)
754 : wxPreviewControlBar(preview, buttons, parent, pos, size, style, name)
755 {}
756
757 void SetPrintPreview(wxPrintPreview* preview) { m_printPreview = preview; }
758
759 DEC_PYCALLBACK_VOID_(CreateButtons);
760 DEC_PYCALLBACK_VOID_INT(SetZoomControl);
761
762 PYPRIVATE;
763 };
764
765 IMPLEMENT_CLASS(wxPyPreviewControlBar, wxPreviewControlBar);
766 IMP_PYCALLBACK_VOID_(wxPyPreviewControlBar, wxPreviewControlBar, CreateButtons);
767 IMP_PYCALLBACK_VOID_INT(wxPyPreviewControlBar, wxPreviewControlBar, SetZoomControl);
768 %}
769
770
771 MustHaveApp(wxPyPreviewControlBar);
772
773 class wxPyPreviewControlBar : public wxPreviewControlBar
774 {
775 public:
776 %pythonAppend wxPyPreviewControlBar "self._setCallbackInfo(self, PyPreviewControlBar); self._setOORInfo(self)"
777
778 wxPyPreviewControlBar(wxPrintPreview *preview,
779 long buttons,
780 wxWindow *parent,
781 const wxPoint& pos = wxDefaultPosition,
782 const wxSize& size = wxDefaultSize,
783 long style = 0,
784 const wxString& name = wxPyPanelNameStr);
785
786 void _setCallbackInfo(PyObject* self, PyObject* _class);
787
788 void SetPrintPreview(wxPrintPreview* preview);
789
790 void base_CreateButtons();
791 void base_SetZoomControl(int zoom);
792 };
793
794 //---------------------------------------------------------------------------
795 //---------------------------------------------------------------------------
796 %init %{
797 wxPyPtrTypeMap_Add("wxPrintout", "wxPyPrintout");
798 %}
799 //---------------------------------------------------------------------------