]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_printfw.i
Fixed OOR typo
[wxWidgets.git] / wxPython / src / _printfw.i
CommitLineData
bb0054cd 1/////////////////////////////////////////////////////////////////////////////
d14a1e28
RD
2// Name: _????.i
3// Purpose: SWIG interface for wx????
bb0054cd
RD
4//
5// Author: Robin Dunn
6//
d14a1e28 7// Created: 9-Aug-2003
bb0054cd 8// RCS-ID: $Id$
d14a1e28 9// Copyright: (c) 2003 by Total Control Software
bb0054cd
RD
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
d14a1e28 13// Not a %module
bb0054cd 14
bb0054cd 15
d14a1e28
RD
16//---------------------------------------------------------------------------
17%newgroup
bb0054cd 18
137b5242 19%{
d14a1e28
RD
20#include "wx/wxPython/printfw.h"
21
137b5242
RD
22%}
23
b2dc1044
RD
24MAKE_CONST_WXSTRING2(PrintoutTitleStr, wxT("Printout"));
25MAKE_CONST_WXSTRING2(PreviewCanvasNameStr, wxT("previewcanvas"));
26
bb0054cd 27
d14a1e28 28//---------------------------------------------------------------------------
bb0054cd 29
1fded56b
RD
30enum wxPrintMode
31{
32 wxPRINT_MODE_NONE = 0,
33 wxPRINT_MODE_PREVIEW = 1, // Preview in external application
34 wxPRINT_MODE_FILE = 2, // Print to file
4cc5453b
RD
35 wxPRINT_MODE_PRINTER = 3, // Send to printer
36 wxPRINT_MODE_STREAM = 4 // Send postscript data into a stream
1fded56b
RD
37};
38
bb0054cd
RD
39
40
9416aa89 41class wxPrintData : public wxObject {
bb0054cd
RD
42public:
43 wxPrintData();
44 ~wxPrintData();
45
46 int GetNoCopies();
47 bool GetCollate();
48 int GetOrientation();
49
b7fc54be
RD
50 bool Ok();
51
bb0054cd
RD
52 const wxString& GetPrinterName();
53 bool GetColour();
54 wxDuplexMode GetDuplex();
55 wxPaperSize GetPaperId();
56 const wxSize& GetPaperSize();
57
b2dc1044 58 int GetQuality();
bb0054cd
RD
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);
b2dc1044 69 void SetQuality(int quality);
bb0054cd 70
926bb76c
RD
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);
bb0054cd 95
4cc5453b
RD
96 wxOutputStream* GetOutputStream();
97 void SetOutputStream(wxOutputStream* outputstream);
98
d14a1e28 99 %pythoncode { def __nonzero__(self): return self.Ok() }
eedf876b
RD
100};
101
102//---------------------------------------------------------------------------
103
9416aa89 104class wxPageSetupDialogData : public wxObject {
bb0054cd
RD
105public:
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();
d14a1e28
RD
127
128 wxPrintData& GetPrintData();
129// %addmethods {
130// %new wxPrintData* GetPrintData() {
131// return new wxPrintData(self->GetPrintData()); // force a copy
132// }
133// }
b7fc54be
RD
134
135 bool Ok();
136
bb0054cd
RD
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);
3ca6a5f0 143 void SetPaperId(wxPaperSize id);
bb0054cd
RD
144 void SetPaperSize(const wxSize& size);
145 void SetPrintData(const wxPrintData& printData);
1fded56b 146
d14a1e28 147 %pythoncode { def __nonzero__(self): return self.Ok() }
bb0054cd
RD
148};
149
150
d14a1e28 151
bb0054cd
RD
152class wxPageSetupDialog : public wxDialog {
153public:
2b9048c5 154 %pythonAppend wxPageSetupDialog "self._setOORInfo(self)"
bb0054cd 155
d14a1e28 156 wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL);
bb0054cd
RD
157
158 wxPageSetupDialogData& GetPageSetupData();
159 int ShowModal();
160};
161
d14a1e28 162//---------------------------------------------------------------------------
bb0054cd
RD
163
164
9416aa89 165class wxPrintDialogData : public wxObject {
bb0054cd 166public:
d88d4683 167 %nokwargs wxPrintDialogData;
bb0054cd 168 wxPrintDialogData();
d88d4683 169 wxPrintDialogData(const wxPrintData& printData);
bb0054cd
RD
170 ~wxPrintDialogData();
171
1fded56b
RD
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
bb0054cd
RD
194 void EnablePrintToFile(bool flag);
195 void EnableSelection(bool flag);
1fded56b
RD
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
d14a1e28
RD
207
208 wxPrintData& GetPrintData();
209// %addmethods {
210// %new wxPrintData* GetPrintData() {
211// return new wxPrintData(self->GetPrintData()); // force a copy
212// }
213// }
bb0054cd 214 void SetPrintData(const wxPrintData& printData);
1fded56b 215
d14a1e28 216 %pythoncode { def __nonzero__(self): return self.Ok() }
bb0054cd
RD
217};
218
219
220class wxPrintDialog : public wxDialog {
221public:
2b9048c5 222 %pythonAppend wxPrintDialog "self._setOORInfo(self)"
d14a1e28 223
bb0054cd
RD
224 wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL);
225
bb0054cd 226 wxPrintDialogData& GetPrintDialogData();
d14a1e28
RD
227
228 %newobject GetPrintDC;
229 wxDC* GetPrintDC();
bb0054cd
RD
230 int ShowModal();
231};
232
d14a1e28
RD
233
234//---------------------------------------------------------------------------
235//---------------------------------------------------------------------------
236
237
238enum wxPrinterError
239{
240 wxPRINTER_NO_ERROR = 0,
241 wxPRINTER_CANCELLED,
242 wxPRINTER_ERROR
243};
244
245
246class wxPrinter : public wxObject {
247public:
248 wxPrinter(wxPrintDialogData* data = NULL);
249 ~wxPrinter();
250
251 void CreateAbortWindow(wxWindow* parent, wxPyPrintout* printout);
252 wxPrintDialogData& GetPrintDialogData();
dd9f7fea 253 bool Print(wxWindow *parent, wxPyPrintout *printout, int prompt=True);
d14a1e28
RD
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//---------------------------------------------------------------------------
bb0054cd
RD
264// Custom wxPrintout class that knows how to call python
265%{
2abc0a0f
RD
266
267
268// Since this one would be tough and ugly to do with the Macros...
269void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
dd9f7fea 270 bool hadErr = False;
19a97bd6 271 bool found;
2abc0a0f 272
da32eb53 273 bool blocked = wxPyBeginBlockThreads();
d14a1e28
RD
274 if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) {
275 PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
2abc0a0f
RD
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);
dd9f7fea 281 else hadErr = True;
2abc0a0f
RD
282
283 val = PyTuple_GetItem(result, 1);
284 if (PyInt_Check(val)) *maxPage = PyInt_AsLong(val);
dd9f7fea 285 else hadErr = True;
2abc0a0f
RD
286
287 val = PyTuple_GetItem(result, 2);
288 if (PyInt_Check(val)) *pageFrom = PyInt_AsLong(val);
dd9f7fea 289 else hadErr = True;
2abc0a0f
RD
290
291 val = PyTuple_GetItem(result, 3);
292 if (PyInt_Check(val)) *pageTo = PyInt_AsLong(val);
dd9f7fea 293 else hadErr = True;
bb0054cd
RD
294 }
295 else
dd9f7fea 296 hadErr = True;
1afc06c2 297
2abc0a0f
RD
298 if (hadErr) {
299 PyErr_SetString(PyExc_TypeError, "GetPageInfo should return a tuple of 4 integers.");
300 PyErr_Print();
301 }
302 Py_DECREF(result);
bb0054cd 303 }
da32eb53 304 wxPyEndBlockThreads(blocked);
19a97bd6 305 if (! found)
bb0054cd 306 wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
2abc0a0f
RD
307}
308
309void wxPyPrintout::base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
310 wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
311}
312
1afc06c2
RD
313
314IMP_PYCALLBACK_BOOL_INTINT(wxPyPrintout, wxPrintout, OnBeginDocument);
315IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndDocument);
316IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnBeginPrinting);
317IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndPrinting);
318IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnPreparePrinting);
319IMP_PYCALLBACK_BOOL_INT_pure(wxPyPrintout, wxPrintout, OnPrintPage);
320IMP_PYCALLBACK_BOOL_INT(wxPyPrintout, wxPrintout, HasPage);
321
322
bb0054cd
RD
323%}
324
325
326// Now define the custom class for SWIGging
d14a1e28 327%name(Printout) class wxPyPrintout : public wxObject {
bb0054cd 328public:
2b9048c5 329 %pythonAppend wxPyPrintout "self._setCallbackInfo(self, Printout)"
bb0054cd 330
d14a1e28
RD
331 wxPyPrintout(const wxString& title = wxPyPrintoutTitleStr);
332 //~wxPyPrintout(); wxPrintPreview object takes ownership...
333
0122b7e3 334 void _setCallbackInfo(PyObject* self, PyObject* _class);
bb0054cd 335
d14a1e28
RD
336
337 wxString GetTitle() const;
bb0054cd 338 wxDC* GetDC();
d14a1e28
RD
339 void SetDC(wxDC *dc);
340
d14a1e28 341 void SetPageSizePixels(int w, int h);
322913ce
RD
342 DocDeclA(
343 void, GetPageSizePixels(int *OUTPUT, int *OUTPUT),
344 "GetPageSizePixels() -> (w, h)");
d14a1e28
RD
345
346 void SetPageSizeMM(int w, int h);
322913ce
RD
347 DocDeclA(
348 void, GetPageSizeMM(int *OUTPUT, int *OUTPUT),
349 "GetPageSizeMM() -> (w, h)");
d14a1e28
RD
350
351 void SetPPIScreen(int x, int y);
322913ce
RD
352 DocDeclA(
353 void, GetPPIScreen(int *OUTPUT, int *OUTPUT),
354 "GetPPIScreen() -> (x,y)");
d14a1e28
RD
355
356 void SetPPIPrinter(int x, int y);
322913ce
RD
357 DocDeclA(
358 void, GetPPIPrinter(int *OUTPUT, int *OUTPUT),
359 "GetPPIPrinter() -> (x,y)");
d14a1e28 360
bb0054cd 361 bool IsPreview();
d14a1e28 362 void SetIsPreview(bool p);
bb0054cd 363
d14a1e28 364
bb0054cd
RD
365 bool base_OnBeginDocument(int startPage, int endPage);
366 void base_OnEndDocument();
367 void base_OnBeginPrinting();
368 void base_OnEndPrinting();
369 void base_OnPreparePrinting();
bb0054cd 370 bool base_HasPage(int page);
322913ce
RD
371 DocDeclA(
372 void, base_GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
373 "base_GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)");
bb0054cd
RD
374};
375
d14a1e28 376//---------------------------------------------------------------------------
1fded56b 377
1fded56b 378
1fded56b 379
d14a1e28 380class wxPreviewCanvas: public wxScrolledWindow
1fded56b
RD
381{
382public:
2b9048c5 383 %pythonAppend wxPreviewCanvas "self._setOORInfo(self)"
bb0054cd 384
d14a1e28
RD
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);
bb0054cd
RD
391};
392
bb0054cd
RD
393
394class wxPreviewFrame : public wxFrame {
395public:
2b9048c5 396 %pythonAppend wxPreviewFrame "self._setOORInfo(self)"
d14a1e28 397
bb0054cd 398 wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title,
b68dc582
RD
399 const wxPoint& pos = wxDefaultPosition,
400 const wxSize& size = wxDefaultSize,
bb0054cd 401 long style = wxDEFAULT_FRAME_STYLE,
137b5242 402 const wxString& name = wxPyFrameNameStr);
bb0054cd 403
bb0054cd 404 void Initialize();
1fded56b
RD
405 void CreateControlBar();
406 void CreateCanvas();
3ef86e32
RD
407
408 wxPreviewControlBar* GetControlBar() const;
1fded56b
RD
409};
410
411
1fded56b
RD
412
413enum {
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
433class wxPreviewControlBar: public wxPanel
434{
435public:
2b9048c5 436 %pythonAppend wxPreviewControlBar "self._setOORInfo(self)"
d14a1e28 437
1fded56b
RD
438 wxPreviewControlBar(wxPrintPreview *preview,
439 long buttons,
440 wxWindow *parent,
441 const wxPoint& pos = wxDefaultPosition,
442 const wxSize& size = wxDefaultSize,
3ef86e32 443 long style = wxTAB_TRAVERSAL,
1fded56b 444 const wxString& name = wxPyPanelNameStr);
1fded56b
RD
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
d14a1e28
RD
458
459//---------------------------------------------------------------------------
460
461class wxPrintPreview : public wxObject {
462public:
d88d4683 463 %nokwargs wxPrintPreview;
d14a1e28
RD
464 wxPrintPreview(wxPyPrintout* printout,
465 wxPyPrintout* printoutForPrinting,
d88d4683
RD
466 wxPrintDialogData *data=NULL);
467 wxPrintPreview(wxPyPrintout* printout,
468 wxPyPrintout* printoutForPrinting,
469 wxPrintData* data);
d14a1e28
RD
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
1fded56b
RD
517// Python-derivable versions of the above preview classes
518
519%{
3ef86e32
RD
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) { \
dd9f7fea 528 bool rval=False; \
3ef86e32 529 bool found; \
da32eb53 530 bool blocked = wxPyBeginBlockThreads(); \
3ef86e32
RD
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 } \
da32eb53 538 wxPyEndBlockThreads(blocked); \
3ef86e32
RD
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
1fded56b
RD
550class wxPyPrintPreview : public wxPrintPreview
551{
552 DECLARE_CLASS(wxPyPrintPreview)
553public:
d88d4683
RD
554 wxPyPrintPreview(wxPyPrintout* printout,
555 wxPyPrintout* printoutForPrinting,
556 wxPrintDialogData* data=NULL)
557 : wxPrintPreview(printout, printoutForPrinting, data)
558 {}
1fded56b
RD
559 wxPyPrintPreview(wxPyPrintout* printout,
560 wxPyPrintout* printoutForPrinting,
561 wxPrintData* data=NULL)
562 : wxPrintPreview(printout, printoutForPrinting, data)
563 {}
564
565 DEC_PYCALLBACK_BOOL_INT(SetCurrentPage);
3ef86e32
RD
566 DEC_PYCALLBACK_BOOL_PREWINDC(PaintPage);
567 DEC_PYCALLBACK_BOOL_PREWINDC(DrawBlankPage);
1fded56b
RD
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__)
578IMPLEMENT_CLASS( wxPyPrintPreview, wxWindowsPrintPreview );
579#elif defined(__WXMAC__)
580IMPLEMENT_CLASS( wxPyPrintPreview, wxMacPrintPreview );
581#else
582IMPLEMENT_CLASS( wxPyPrintPreview, wxPostScriptPrintPreview );
583#endif
584
3ef86e32
RD
585IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, SetCurrentPage);
586IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, PaintPage);
587IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, DrawBlankPage);
588IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, RenderPage);
589IMP_PYCALLBACK_VOID_INT (wxPyPrintPreview, wxPrintPreview, SetZoom);
590IMP_PYCALLBACK_BOOL_BOOL (wxPyPrintPreview, wxPrintPreview, Print);
591IMP_PYCALLBACK_VOID_ (wxPyPrintPreview, wxPrintPreview, DetermineScaling);
1fded56b
RD
592%}
593
594
595class wxPyPrintPreview : public wxPrintPreview
596{
597public:
2b9048c5 598 %pythonAppend wxPyPrintPreview "self._setCallbackInfo(self, PyPrintPreview)"
d88d4683
RD
599 %nokwargs wxPyPrintPreview;
600 wxPyPrintPreview(wxPyPrintout* printout,
601 wxPyPrintout* printoutForPrinting,
602 wxPrintDialogData* data=NULL);
1fded56b
RD
603 wxPyPrintPreview(wxPyPrintout* printout,
604 wxPyPrintout* printoutForPrinting,
d88d4683 605 wxPrintData* data);
1fded56b
RD
606
607 void _setCallbackInfo(PyObject* self, PyObject* _class);
d14a1e28 608
1fded56b 609 bool base_SetCurrentPage(int pageNum);
3ef86e32
RD
610 bool base_PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
611 bool base_DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
1fded56b
RD
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
bb0054cd 619
bb0054cd 620
1fded56b
RD
621%{
622class wxPyPreviewFrame : public wxPreviewFrame
623{
624 DECLARE_CLASS(wxPyPreviewFrame);
625public:
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
3ef86e32 635 void SetPreviewCanvas(wxPreviewCanvas* canvas) { m_previewCanvas = canvas; }
1fded56b
RD
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
645IMPLEMENT_CLASS(wxPyPreviewFrame, wxPreviewFrame);
646
647IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, Initialize);
648IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateCanvas);
649IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateControlBar);
650%}
651
d14a1e28 652
1fded56b
RD
653class wxPyPreviewFrame : public wxPreviewFrame
654{
655public:
2b9048c5 656 %pythonAppend wxPyPreviewFrame "self._setCallbackInfo(self, PyPreviewFrame); self._setOORInfo(self)"
d14a1e28 657
1fded56b
RD
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);
1fded56b 666
3ef86e32 667 void SetPreviewCanvas(wxPreviewCanvas* canvas);
1fded56b
RD
668 void SetControlBar(wxPreviewControlBar* bar);
669
670 void base_Initialize();
671 void base_CreateCanvas();
672 void base_CreateControlBar();
bb0054cd
RD
673};
674
1fded56b
RD
675
676
677
678%{
679class wxPyPreviewControlBar : public wxPreviewControlBar
680{
681 DECLARE_CLASS(wxPyPreviewControlBar);
682public:
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
701IMPLEMENT_CLASS(wxPyPreviewControlBar, wxPreviewControlBar);
702IMP_PYCALLBACK_VOID_(wxPyPreviewControlBar, wxPreviewControlBar, CreateButtons);
703IMP_PYCALLBACK_VOID_INT(wxPyPreviewControlBar, wxPreviewControlBar, SetZoomControl);
704%}
705
d14a1e28 706
1fded56b
RD
707class wxPyPreviewControlBar : public wxPreviewControlBar
708{
709public:
2b9048c5 710 %pythonAppend wxPyPreviewControlBar "self._setCallbackInfo(self, PyPreviewControlBar); self._setOORInfo(self)"
d14a1e28 711
1fded56b
RD
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);
1fded56b
RD
721
722 void SetPrintPreview(wxPrintPreview* preview);
723
724 void base_CreateButtons();
725 void base_SetZoomControl(int zoom);
726};
727
728
d14a1e28
RD
729//---------------------------------------------------------------------------
730//---------------------------------------------------------------------------
9416aa89
RD
731%init %{
732 wxPyPtrTypeMap_Add("wxPrintout", "wxPyPrintout");
733%}
d14a1e28 734//---------------------------------------------------------------------------