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