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