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