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