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