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