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