]>
Commit | Line | Data |
---|---|---|
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 |
24 | MAKE_CONST_WXSTRING2(PrintoutTitleStr, wxT("Printout")); |
25 | MAKE_CONST_WXSTRING2(PreviewCanvasNameStr, wxT("previewcanvas")); | |
26 | ||
bb0054cd | 27 | |
d14a1e28 | 28 | //--------------------------------------------------------------------------- |
bb0054cd | 29 | |
1fded56b RD |
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 | |
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 | ||
3077d123 RD |
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 | }; | |
bb0054cd RD |
59 | |
60 | ||
9416aa89 | 61 | class wxPrintData : public wxObject { |
bb0054cd | 62 | public: |
356f3c65 | 63 | %nokwargs wxPrintData; |
bb0054cd | 64 | wxPrintData(); |
356f3c65 RD |
65 | wxPrintData(const wxPrintData& data); // for making copies |
66 | ||
bb0054cd RD |
67 | ~wxPrintData(); |
68 | ||
69 | int GetNoCopies(); | |
70 | bool GetCollate(); | |
71 | int GetOrientation(); | |
72 | ||
b7fc54be RD |
73 | bool Ok(); |
74 | ||
bb0054cd RD |
75 | const wxString& GetPrinterName(); |
76 | bool GetColour(); | |
77 | wxDuplexMode GetDuplex(); | |
78 | wxPaperSize GetPaperId(); | |
79 | const wxSize& GetPaperSize(); | |
80 | ||
b2dc1044 | 81 | int GetQuality(); |
3077d123 | 82 | wxPrintBin GetBin(); |
7aada1e0 | 83 | wxPrintMode GetPrintMode() const; |
3077d123 | 84 | |
bb0054cd RD |
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); | |
b2dc1044 | 94 | void SetQuality(int quality); |
3077d123 | 95 | void SetBin(wxPrintBin bin); |
7aada1e0 RD |
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 | ||
a62e4b56 RD |
103 | //char* GetPrivData() const; |
104 | //int GetPrivDataLen() const; | |
105 | //void SetPrivData( char *privData, int len ); | |
106 | ||
107 | %extend { | |
108 | PyObject* GetPrivData() { | |
109 | PyObject* data; | |
6e6b3557 | 110 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
a62e4b56 RD |
111 | data = PyString_FromStringAndSize(self->GetPrivData(), |
112 | self->GetPrivDataLen()); | |
113 | wxPyEndBlockThreads(blocked); | |
114 | return data; | |
115 | } | |
116 | ||
117 | void SetPrivData(PyObject* data) { | |
118 | if (! PyString_Check(data)) { | |
119 | wxPyBLOCK_THREADS(PyErr_SetString(PyExc_TypeError, | |
120 | "Expected string object")); | |
121 | return /* NULL */ ; | |
122 | } | |
123 | ||
6e6b3557 | 124 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
a62e4b56 RD |
125 | self->SetPrivData(PyString_AS_STRING(data), PyString_GET_SIZE(data)); |
126 | wxPyEndBlockThreads(blocked); | |
127 | } | |
128 | } | |
129 | ||
7aada1e0 RD |
130 | |
131 | // NOTE: These are now inside of #if WXWIN_COMPATIBILITY_2_4, so be | |
132 | // prepared to remove them... | |
133 | ||
926bb76c | 134 | // PostScript-specific data |
2f91e3df KO |
135 | // WXWIN_COMPATIBILITY_2_4 |
136 | #if 0 | |
926bb76c RD |
137 | const wxString& GetPrinterCommand(); |
138 | const wxString& GetPrinterOptions(); | |
139 | const wxString& GetPreviewCommand(); | |
926bb76c RD |
140 | const wxString& GetFontMetricPath(); |
141 | double GetPrinterScaleX(); | |
142 | double GetPrinterScaleY(); | |
143 | long GetPrinterTranslateX(); | |
144 | long GetPrinterTranslateY(); | |
926bb76c RD |
145 | void SetPrinterCommand(const wxString& command); |
146 | void SetPrinterOptions(const wxString& options); | |
147 | void SetPreviewCommand(const wxString& command); | |
926bb76c RD |
148 | void SetFontMetricPath(const wxString& path); |
149 | void SetPrinterScaleX(double x); | |
150 | void SetPrinterScaleY(double y); | |
151 | void SetPrinterScaling(double x, double y); | |
152 | void SetPrinterTranslateX(long x); | |
153 | void SetPrinterTranslateY(long y); | |
154 | void SetPrinterTranslation(long x, long y); | |
2f91e3df | 155 | #endif |
4cc5453b | 156 | |
7012bb9f RD |
157 | %property(Bin, GetBin, SetBin, doc="See `GetBin` and `SetBin`"); |
158 | %property(Collate, GetCollate, SetCollate, doc="See `GetCollate` and `SetCollate`"); | |
159 | %property(Colour, GetColour, SetColour, doc="See `GetColour` and `SetColour`"); | |
160 | %property(Duplex, GetDuplex, SetDuplex, doc="See `GetDuplex` and `SetDuplex`"); | |
161 | %property(Filename, GetFilename, SetFilename, doc="See `GetFilename` and `SetFilename`"); | |
162 | %property(NoCopies, GetNoCopies, SetNoCopies, doc="See `GetNoCopies` and `SetNoCopies`"); | |
163 | %property(Orientation, GetOrientation, SetOrientation, doc="See `GetOrientation` and `SetOrientation`"); | |
164 | %property(PaperId, GetPaperId, SetPaperId, doc="See `GetPaperId` and `SetPaperId`"); | |
165 | %property(PaperSize, GetPaperSize, SetPaperSize, doc="See `GetPaperSize` and `SetPaperSize`"); | |
166 | %property(PrintMode, GetPrintMode, SetPrintMode, doc="See `GetPrintMode` and `SetPrintMode`"); | |
167 | %property(PrinterName, GetPrinterName, SetPrinterName, doc="See `GetPrinterName` and `SetPrinterName`"); | |
168 | %property(PrivData, GetPrivData, SetPrivData, doc="See `GetPrivData` and `SetPrivData`"); | |
169 | %property(Quality, GetQuality, SetQuality, doc="See `GetQuality` and `SetQuality`"); | |
eedf876b RD |
170 | }; |
171 | ||
172 | //--------------------------------------------------------------------------- | |
173 | ||
9416aa89 | 174 | class wxPageSetupDialogData : public wxObject { |
bb0054cd | 175 | public: |
356f3c65 | 176 | %nokwargs wxPageSetupDialogData; |
bb0054cd | 177 | wxPageSetupDialogData(); |
356f3c65 | 178 | wxPageSetupDialogData(const wxPageSetupDialogData& data); // for making copies |
e5bc90ee | 179 | wxPageSetupDialogData(const wxPrintData& data); |
bb0054cd RD |
180 | ~wxPageSetupDialogData(); |
181 | ||
182 | void EnableHelp(bool flag); | |
183 | void EnableMargins(bool flag); | |
184 | void EnableOrientation(bool flag); | |
185 | void EnablePaper(bool flag); | |
186 | void EnablePrinter(bool flag); | |
e5bc90ee | 187 | |
bb0054cd RD |
188 | bool GetDefaultMinMargins(); |
189 | bool GetEnableMargins(); | |
190 | bool GetEnableOrientation(); | |
191 | bool GetEnablePaper(); | |
192 | bool GetEnablePrinter(); | |
193 | bool GetEnableHelp(); | |
194 | bool GetDefaultInfo(); | |
195 | wxPoint GetMarginTopLeft(); | |
196 | wxPoint GetMarginBottomRight(); | |
197 | wxPoint GetMinMarginTopLeft(); | |
198 | wxPoint GetMinMarginBottomRight(); | |
199 | wxPaperSize GetPaperId(); | |
200 | wxSize GetPaperSize(); | |
d14a1e28 RD |
201 | |
202 | wxPrintData& GetPrintData(); | |
b7fc54be RD |
203 | |
204 | bool Ok(); | |
205 | ||
bb0054cd RD |
206 | void SetDefaultInfo(bool flag); |
207 | void SetDefaultMinMargins(bool flag); | |
208 | void SetMarginTopLeft(const wxPoint& pt); | |
209 | void SetMarginBottomRight(const wxPoint& pt); | |
210 | void SetMinMarginTopLeft(const wxPoint& pt); | |
211 | void SetMinMarginBottomRight(const wxPoint& pt); | |
3ca6a5f0 | 212 | void SetPaperId(wxPaperSize id); |
bb0054cd | 213 | void SetPaperSize(const wxSize& size); |
e5bc90ee | 214 | |
bb0054cd | 215 | void SetPrintData(const wxPrintData& printData); |
1fded56b | 216 | |
e5bc90ee RD |
217 | // Use paper size defined in this object to set the wxPrintData |
218 | // paper id | |
219 | void CalculateIdFromPaperSize(); | |
220 | ||
221 | // Use paper id in wxPrintData to set this object's paper size | |
222 | void CalculatePaperSizeFromId(); | |
223 | ||
d14a1e28 | 224 | %pythoncode { def __nonzero__(self): return self.Ok() } |
7012bb9f RD |
225 | |
226 | %property(DefaultInfo, GetDefaultInfo, SetDefaultInfo, doc="See `GetDefaultInfo` and `SetDefaultInfo`"); | |
227 | %property(DefaultMinMargins, GetDefaultMinMargins, SetDefaultMinMargins, doc="See `GetDefaultMinMargins` and `SetDefaultMinMargins`"); | |
228 | ||
229 | // %property(EnableHelp, GetEnableHelp, doc="See `GetEnableHelp`"); | |
230 | // %property(EnableMargins, GetEnableMargins, doc="See `GetEnableMargins`"); | |
231 | // %property(EnableOrientation, GetEnableOrientation, doc="See `GetEnableOrientation`"); | |
232 | // %property(EnablePaper, GetEnablePaper, doc="See `GetEnablePaper`"); | |
233 | // %property(EnablePrinter, GetEnablePrinter, doc="See `GetEnablePrinter`"); | |
234 | ||
235 | %property(MarginBottomRight, GetMarginBottomRight, SetMarginBottomRight, doc="See `GetMarginBottomRight` and `SetMarginBottomRight`"); | |
236 | %property(MarginTopLeft, GetMarginTopLeft, SetMarginTopLeft, doc="See `GetMarginTopLeft` and `SetMarginTopLeft`"); | |
237 | %property(MinMarginBottomRight, GetMinMarginBottomRight, SetMinMarginBottomRight, doc="See `GetMinMarginBottomRight` and `SetMinMarginBottomRight`"); | |
238 | %property(MinMarginTopLeft, GetMinMarginTopLeft, SetMinMarginTopLeft, doc="See `GetMinMarginTopLeft` and `SetMinMarginTopLeft`"); | |
239 | %property(PaperId, GetPaperId, SetPaperId, doc="See `GetPaperId` and `SetPaperId`"); | |
240 | %property(PaperSize, GetPaperSize, SetPaperSize, doc="See `GetPaperSize` and `SetPaperSize`"); | |
241 | %property(PrintData, GetPrintData, SetPrintData, doc="See `GetPrintData` and `SetPrintData`"); | |
242 | ||
bb0054cd RD |
243 | }; |
244 | ||
245 | ||
d14a1e28 | 246 | |
32bf5e4a RD |
247 | // NOTE: Contrary to it's name, this class doesn't derive from wxDialog. It |
248 | // is a facade in front of a platform-specific (native dialog) provided by the | |
249 | // wxPrintFactory. | |
250 | ||
ab1f7d2a RD |
251 | MustHaveApp(wxPageSetupDialog); |
252 | ||
32bf5e4a RD |
253 | class wxPageSetupDialog : public wxObject |
254 | { | |
bb0054cd | 255 | public: |
d14a1e28 | 256 | wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL); |
7847dc50 RD |
257 | ~wxPageSetupDialog(); |
258 | ||
bb0054cd | 259 | wxPageSetupDialogData& GetPageSetupData(); |
32bf5e4a | 260 | wxPageSetupDialogData& GetPageSetupDialogData(); |
bb0054cd | 261 | int ShowModal(); |
7847dc50 RD |
262 | |
263 | %pythoncode { def Destroy(self): pass } | |
7012bb9f RD |
264 | |
265 | %property(PageSetupData, GetPageSetupData, doc="See `GetPageSetupData`"); | |
266 | %property(PageSetupDialogData, GetPageSetupDialogData, doc="See `GetPageSetupDialogData`"); | |
267 | ||
bb0054cd RD |
268 | }; |
269 | ||
d14a1e28 | 270 | //--------------------------------------------------------------------------- |
bb0054cd RD |
271 | |
272 | ||
9416aa89 | 273 | class wxPrintDialogData : public wxObject { |
bb0054cd | 274 | public: |
d88d4683 | 275 | %nokwargs wxPrintDialogData; |
bb0054cd | 276 | wxPrintDialogData(); |
e5bc90ee RD |
277 | wxPrintDialogData(const wxPrintData& printData); |
278 | wxPrintDialogData(const wxPrintDialogData& printData); // for making copies | |
bb0054cd RD |
279 | ~wxPrintDialogData(); |
280 | ||
1fded56b RD |
281 | int GetFromPage() const; |
282 | int GetToPage() const; | |
283 | int GetMinPage() const; | |
284 | int GetMaxPage() const; | |
285 | int GetNoCopies() const; | |
286 | bool GetAllPages() const; | |
287 | bool GetSelection() const; | |
288 | bool GetCollate() const; | |
289 | bool GetPrintToFile() const; | |
7aada1e0 RD |
290 | |
291 | // WXWIN_COMPATIBILITY_2_4 | |
2f91e3df | 292 | #if 0 |
1fded56b | 293 | bool GetSetupDialog() const; |
7aada1e0 | 294 | void SetSetupDialog(bool flag); |
2f91e3df | 295 | #endif |
1fded56b RD |
296 | void SetFromPage(int v); |
297 | void SetToPage(int v); | |
298 | void SetMinPage(int v); | |
299 | void SetMaxPage(int v); | |
300 | void SetNoCopies(int v); | |
301 | void SetAllPages(bool flag); | |
302 | void SetSelection(bool flag); | |
303 | void SetCollate(bool flag); | |
304 | void SetPrintToFile(bool flag); | |
1fded56b | 305 | |
bb0054cd RD |
306 | void EnablePrintToFile(bool flag); |
307 | void EnableSelection(bool flag); | |
1fded56b RD |
308 | void EnablePageNumbers(bool flag); |
309 | void EnableHelp(bool flag); | |
310 | ||
311 | bool GetEnablePrintToFile() const; | |
312 | bool GetEnableSelection() const; | |
313 | bool GetEnablePageNumbers() const; | |
314 | bool GetEnableHelp() const; | |
315 | ||
316 | // Is this data OK for showing the print dialog? | |
317 | bool Ok() const; | |
318 | ||
d14a1e28 RD |
319 | |
320 | wxPrintData& GetPrintData(); | |
bb0054cd | 321 | void SetPrintData(const wxPrintData& printData); |
1fded56b | 322 | |
d14a1e28 | 323 | %pythoncode { def __nonzero__(self): return self.Ok() } |
7012bb9f RD |
324 | |
325 | %property(AllPages, GetAllPages, SetAllPages, doc="See `GetAllPages` and `SetAllPages`"); | |
326 | %property(Collate, GetCollate, SetCollate, doc="See `GetCollate` and `SetCollate`"); | |
327 | // %property(EnableHelp, GetEnableHelp, doc="See `GetEnableHelp`"); | |
328 | // %property(EnablePageNumbers, GetEnablePageNumbers, doc="See `GetEnablePageNumbers`"); | |
329 | // %property(EnablePrintToFile, GetEnablePrintToFile, doc="See `GetEnablePrintToFile`"); | |
330 | // %property(EnableSelection, GetEnableSelection, doc="See `GetEnableSelection`"); | |
331 | %property(FromPage, GetFromPage, SetFromPage, doc="See `GetFromPage` and `SetFromPage`"); | |
332 | %property(MaxPage, GetMaxPage, SetMaxPage, doc="See `GetMaxPage` and `SetMaxPage`"); | |
333 | %property(MinPage, GetMinPage, SetMinPage, doc="See `GetMinPage` and `SetMinPage`"); | |
334 | %property(NoCopies, GetNoCopies, SetNoCopies, doc="See `GetNoCopies` and `SetNoCopies`"); | |
335 | %property(PrintData, GetPrintData, SetPrintData, doc="See `GetPrintData` and `SetPrintData`"); | |
336 | %property(PrintToFile, GetPrintToFile, SetPrintToFile, doc="See `GetPrintToFile` and `SetPrintToFile`"); | |
337 | %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`"); | |
338 | %property(ToPage, GetToPage, SetToPage, doc="See `GetToPage` and `SetToPage`"); | |
bb0054cd RD |
339 | }; |
340 | ||
341 | ||
6b9f434e | 342 | |
ab1f7d2a RD |
343 | MustHaveApp(wxPrintDialog); |
344 | ||
d14a1e28 | 345 | |
6b9f434e RD |
346 | // NOTE: Contrary to it's name, this class doesn't derive from wxDialog. It |
347 | // is a facade in front of a platform-specific (native dialog) provided by the | |
348 | // wxPrintFactory. | |
349 | ||
350 | class wxPrintDialog : public wxObject { | |
351 | public: | |
bb0054cd RD |
352 | wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL); |
353 | ||
7aada1e0 | 354 | // TODO?: wxPrintDialog(wxWindow *parent, wxPrintData* data); |
7847dc50 RD |
355 | |
356 | ~wxPrintDialog(); | |
7aada1e0 RD |
357 | |
358 | virtual int ShowModal(); | |
359 | ||
360 | virtual wxPrintDialogData& GetPrintDialogData(); | |
361 | virtual wxPrintData& GetPrintData(); | |
d14a1e28 RD |
362 | |
363 | %newobject GetPrintDC; | |
7aada1e0 RD |
364 | virtual wxDC *GetPrintDC(); |
365 | ||
7847dc50 | 366 | %pythoncode { def Destroy(self): pass } |
7012bb9f RD |
367 | |
368 | %property(PrintDC, GetPrintDC, doc="See `GetPrintDC`"); | |
369 | %property(PrintData, GetPrintData, doc="See `GetPrintData`"); | |
370 | %property(PrintDialogData, GetPrintDialogData, doc="See `GetPrintDialogData`"); | |
bb0054cd RD |
371 | }; |
372 | ||
d14a1e28 RD |
373 | |
374 | //--------------------------------------------------------------------------- | |
375 | //--------------------------------------------------------------------------- | |
376 | ||
377 | ||
378 | enum wxPrinterError | |
379 | { | |
380 | wxPRINTER_NO_ERROR = 0, | |
381 | wxPRINTER_CANCELLED, | |
382 | wxPRINTER_ERROR | |
383 | }; | |
384 | ||
385 | ||
ab1f7d2a RD |
386 | MustHaveApp(wxPrinter); |
387 | ||
d14a1e28 RD |
388 | class wxPrinter : public wxObject { |
389 | public: | |
390 | wxPrinter(wxPrintDialogData* data = NULL); | |
391 | ~wxPrinter(); | |
392 | ||
6b9f434e RD |
393 | virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPyPrintout *printout); |
394 | virtual void ReportError(wxWindow *parent, wxPyPrintout *printout, const wxString& message); | |
7aada1e0 RD |
395 | |
396 | virtual bool Setup(wxWindow *parent); | |
6b9f434e | 397 | virtual bool Print(wxWindow *parent, wxPyPrintout *printout, bool prompt = true); |
7aada1e0 RD |
398 | virtual wxDC* PrintDialog(wxWindow *parent); |
399 | ||
400 | virtual wxPrintDialogData& GetPrintDialogData() const; | |
d14a1e28 | 401 | |
7aada1e0 | 402 | bool GetAbort(); |
d14a1e28 | 403 | static wxPrinterError GetLastError(); |
c5633576 | 404 | |
7012bb9f RD |
405 | %property(Abort, GetAbort, doc="See `GetAbort`"); |
406 | %property(PrintDialogData, GetPrintDialogData, doc="See `GetPrintDialogData`"); | |
d14a1e28 RD |
407 | }; |
408 | ||
409 | ||
410 | //--------------------------------------------------------------------------- | |
6b9f434e RD |
411 | // Custom wxPrintout class that knows how to call python, See implementation in |
412 | // include/sx/wxPython/printfw.h | |
413 | ||
bb0054cd | 414 | %{ |
2abc0a0f | 415 | |
6b9f434e | 416 | IMPLEMENT_ABSTRACT_CLASS(wxPyPrintout, wxPrintout); |
2abc0a0f RD |
417 | |
418 | // Since this one would be tough and ugly to do with the Macros... | |
419 | void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) { | |
a72f4631 | 420 | bool hadErr = false; |
19a97bd6 | 421 | bool found; |
2abc0a0f | 422 | |
6e6b3557 | 423 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
d14a1e28 RD |
424 | if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) { |
425 | PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); | |
2abc0a0f RD |
426 | if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) { |
427 | PyObject* val; | |
428 | ||
429 | val = PyTuple_GetItem(result, 0); | |
430 | if (PyInt_Check(val)) *minPage = PyInt_AsLong(val); | |
a72f4631 | 431 | else hadErr = true; |
2abc0a0f RD |
432 | |
433 | val = PyTuple_GetItem(result, 1); | |
434 | if (PyInt_Check(val)) *maxPage = PyInt_AsLong(val); | |
a72f4631 | 435 | else hadErr = true; |
2abc0a0f RD |
436 | |
437 | val = PyTuple_GetItem(result, 2); | |
438 | if (PyInt_Check(val)) *pageFrom = PyInt_AsLong(val); | |
a72f4631 | 439 | else hadErr = true; |
2abc0a0f RD |
440 | |
441 | val = PyTuple_GetItem(result, 3); | |
442 | if (PyInt_Check(val)) *pageTo = PyInt_AsLong(val); | |
a72f4631 | 443 | else hadErr = true; |
bb0054cd RD |
444 | } |
445 | else | |
a72f4631 | 446 | hadErr = true; |
1afc06c2 | 447 | |
2abc0a0f RD |
448 | if (hadErr) { |
449 | PyErr_SetString(PyExc_TypeError, "GetPageInfo should return a tuple of 4 integers."); | |
450 | PyErr_Print(); | |
451 | } | |
452 | Py_DECREF(result); | |
bb0054cd | 453 | } |
da32eb53 | 454 | wxPyEndBlockThreads(blocked); |
19a97bd6 | 455 | if (! found) |
bb0054cd | 456 | wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo); |
2abc0a0f RD |
457 | } |
458 | ||
2abc0a0f | 459 | |
1afc06c2 RD |
460 | |
461 | IMP_PYCALLBACK_BOOL_INTINT(wxPyPrintout, wxPrintout, OnBeginDocument); | |
462 | IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndDocument); | |
463 | IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnBeginPrinting); | |
464 | IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndPrinting); | |
465 | IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnPreparePrinting); | |
466 | IMP_PYCALLBACK_BOOL_INT_pure(wxPyPrintout, wxPrintout, OnPrintPage); | |
467 | IMP_PYCALLBACK_BOOL_INT(wxPyPrintout, wxPrintout, HasPage); | |
468 | ||
469 | ||
bb0054cd RD |
470 | %} |
471 | ||
472 | ||
ab1f7d2a RD |
473 | MustHaveApp(wxPyPrintout); |
474 | ||
bb0054cd | 475 | // Now define the custom class for SWIGging |
1b8c7ba6 RD |
476 | %rename(Printout) wxPyPrintout; |
477 | class wxPyPrintout : public wxObject { | |
bb0054cd | 478 | public: |
2b9048c5 | 479 | %pythonAppend wxPyPrintout "self._setCallbackInfo(self, Printout)" |
c5633576 | 480 | %typemap(out) wxPyPrintout*; // turn off this typemap |
bb0054cd | 481 | |
d14a1e28 | 482 | wxPyPrintout(const wxString& title = wxPyPrintoutTitleStr); |
c5633576 | 483 | ~wxPyPrintout(); |
d14a1e28 | 484 | |
c5633576 RD |
485 | // Turn it back on again |
486 | %typemap(out) wxPyPrintout* { $result = wxPyMake_wxObject($1, $owner); } | |
487 | ||
0122b7e3 | 488 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
bb0054cd | 489 | |
d14a1e28 RD |
490 | |
491 | wxString GetTitle() const; | |
bb0054cd | 492 | wxDC* GetDC(); |
d14a1e28 RD |
493 | void SetDC(wxDC *dc); |
494 | ||
d14a1e28 | 495 | void SetPageSizePixels(int w, int h); |
322913ce RD |
496 | DocDeclA( |
497 | void, GetPageSizePixels(int *OUTPUT, int *OUTPUT), | |
498 | "GetPageSizePixels() -> (w, h)"); | |
d14a1e28 RD |
499 | |
500 | void SetPageSizeMM(int w, int h); | |
322913ce RD |
501 | DocDeclA( |
502 | void, GetPageSizeMM(int *OUTPUT, int *OUTPUT), | |
503 | "GetPageSizeMM() -> (w, h)"); | |
d14a1e28 RD |
504 | |
505 | void SetPPIScreen(int x, int y); | |
322913ce RD |
506 | DocDeclA( |
507 | void, GetPPIScreen(int *OUTPUT, int *OUTPUT), | |
508 | "GetPPIScreen() -> (x,y)"); | |
d14a1e28 RD |
509 | |
510 | void SetPPIPrinter(int x, int y); | |
322913ce RD |
511 | DocDeclA( |
512 | void, GetPPIPrinter(int *OUTPUT, int *OUTPUT), | |
513 | "GetPPIPrinter() -> (x,y)"); | |
d14a1e28 | 514 | |
bb0054cd | 515 | bool IsPreview(); |
d14a1e28 | 516 | void SetIsPreview(bool p); |
bb0054cd | 517 | |
d14a1e28 | 518 | |
a7a01418 RD |
519 | bool OnBeginDocument(int startPage, int endPage); |
520 | void OnEndDocument(); | |
521 | void OnBeginPrinting(); | |
522 | void OnEndPrinting(); | |
523 | void OnPreparePrinting(); | |
524 | bool HasPage(int page); | |
322913ce | 525 | DocDeclA( |
a7a01418 RD |
526 | void, GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT), |
527 | "GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)"); | |
528 | ||
529 | %MAKE_BASE_FUNC(Printout, OnBeginDocument); | |
530 | %MAKE_BASE_FUNC(Printout, OnEndDocument); | |
531 | %MAKE_BASE_FUNC(Printout, OnBeginPrinting); | |
532 | %MAKE_BASE_FUNC(Printout, OnEndPrinting); | |
533 | %MAKE_BASE_FUNC(Printout, OnPreparePrinting); | |
534 | %MAKE_BASE_FUNC(Printout, GetPageInfo); | |
7012bb9f RD |
535 | |
536 | ||
537 | %property(DC, GetDC, SetDC, doc="See `GetDC` and `SetDC`"); | |
538 | %property(PPIPrinter, GetPPIPrinter, SetPPIPrinter, doc="See `GetPPIPrinter` and `SetPPIPrinter`"); | |
539 | %property(PPIScreen, GetPPIScreen, SetPPIScreen, doc="See `GetPPIScreen` and `SetPPIScreen`"); | |
540 | %property(PageSizeMM, GetPageSizeMM, SetPageSizeMM, doc="See `GetPageSizeMM` and `SetPageSizeMM`"); | |
541 | %property(PageSizePixels, GetPageSizePixels, SetPageSizePixels, doc="See `GetPageSizePixels` and `SetPageSizePixels`"); | |
542 | %property(Title, GetTitle, doc="See `GetTitle`"); | |
bb0054cd RD |
543 | }; |
544 | ||
d14a1e28 | 545 | //--------------------------------------------------------------------------- |
1fded56b | 546 | |
1fded56b | 547 | |
1fded56b | 548 | |
ab1f7d2a RD |
549 | MustHaveApp(wxPreviewCanvas); |
550 | ||
d14a1e28 | 551 | class wxPreviewCanvas: public wxScrolledWindow |
1fded56b RD |
552 | { |
553 | public: | |
2b9048c5 | 554 | %pythonAppend wxPreviewCanvas "self._setOORInfo(self)" |
bb0054cd | 555 | |
d14a1e28 RD |
556 | wxPreviewCanvas(wxPrintPreview *preview, |
557 | wxWindow *parent, | |
558 | const wxPoint& pos = wxDefaultPosition, | |
559 | const wxSize& size = wxDefaultSize, | |
560 | long style = 0, | |
561 | const wxString& name = wxPyPreviewCanvasNameStr); | |
bb0054cd RD |
562 | }; |
563 | ||
bb0054cd | 564 | |
ab1f7d2a RD |
565 | MustHaveApp(wxPreviewFrame); |
566 | ||
bb0054cd RD |
567 | class wxPreviewFrame : public wxFrame { |
568 | public: | |
c5633576 RD |
569 | %disownarg(wxPrintPreview*); |
570 | ||
2b9048c5 | 571 | %pythonAppend wxPreviewFrame "self._setOORInfo(self)" |
bb0054cd | 572 | wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title, |
b68dc582 RD |
573 | const wxPoint& pos = wxDefaultPosition, |
574 | const wxSize& size = wxDefaultSize, | |
bb0054cd | 575 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 576 | const wxString& name = wxPyFrameNameStr); |
bb0054cd | 577 | |
c5633576 RD |
578 | %cleardisown(wxPrintPreview*); |
579 | ||
bb0054cd | 580 | void Initialize(); |
1fded56b RD |
581 | void CreateControlBar(); |
582 | void CreateCanvas(); | |
3ef86e32 RD |
583 | |
584 | wxPreviewControlBar* GetControlBar() const; | |
7012bb9f RD |
585 | |
586 | %property(ControlBar, GetControlBar, doc="See `GetControlBar`"); | |
1fded56b RD |
587 | }; |
588 | ||
589 | ||
1fded56b RD |
590 | |
591 | enum { | |
592 | wxPREVIEW_PRINT, | |
593 | wxPREVIEW_PREVIOUS, | |
594 | wxPREVIEW_NEXT, | |
595 | wxPREVIEW_ZOOM, | |
596 | wxPREVIEW_FIRST, | |
597 | wxPREVIEW_LAST, | |
598 | wxPREVIEW_GOTO, | |
599 | wxPREVIEW_DEFAULT, | |
600 | ||
601 | wxID_PREVIEW_CLOSE, | |
602 | wxID_PREVIEW_NEXT, | |
603 | wxID_PREVIEW_PREVIOUS, | |
604 | wxID_PREVIEW_PRINT, | |
605 | wxID_PREVIEW_ZOOM, | |
606 | wxID_PREVIEW_FIRST, | |
607 | wxID_PREVIEW_LAST, | |
608 | wxID_PREVIEW_GOTO | |
609 | }; | |
610 | ||
ab1f7d2a RD |
611 | MustHaveApp(wxPreviewControlBar); |
612 | ||
1fded56b RD |
613 | class wxPreviewControlBar: public wxPanel |
614 | { | |
615 | public: | |
2b9048c5 | 616 | %pythonAppend wxPreviewControlBar "self._setOORInfo(self)" |
d14a1e28 | 617 | |
1fded56b RD |
618 | wxPreviewControlBar(wxPrintPreview *preview, |
619 | long buttons, | |
620 | wxWindow *parent, | |
621 | const wxPoint& pos = wxDefaultPosition, | |
622 | const wxSize& size = wxDefaultSize, | |
3ef86e32 | 623 | long style = wxTAB_TRAVERSAL, |
1fded56b | 624 | const wxString& name = wxPyPanelNameStr); |
1fded56b RD |
625 | |
626 | int GetZoomControl(); | |
627 | void SetZoomControl(int zoom); | |
628 | wxPrintPreview* GetPrintPreview(); | |
629 | ||
630 | void OnNext(); | |
631 | void OnPrevious(); | |
632 | void OnFirst(); | |
633 | void OnLast(); | |
634 | void OnGoto(); | |
7012bb9f RD |
635 | |
636 | %property(PrintPreview, GetPrintPreview, doc="See `GetPrintPreview`"); | |
637 | %property(ZoomControl, GetZoomControl, SetZoomControl, doc="See `GetZoomControl` and `SetZoomControl`"); | |
1fded56b RD |
638 | }; |
639 | ||
640 | ||
d14a1e28 RD |
641 | |
642 | //--------------------------------------------------------------------------- | |
643 | ||
ab1f7d2a RD |
644 | MustHaveApp(wxPrintPreview); |
645 | ||
d14a1e28 RD |
646 | class wxPrintPreview : public wxObject { |
647 | public: | |
c5633576 RD |
648 | %disownarg(wxPyPrintout*); |
649 | ||
d88d4683 | 650 | %nokwargs wxPrintPreview; |
d14a1e28 RD |
651 | wxPrintPreview(wxPyPrintout* printout, |
652 | wxPyPrintout* printoutForPrinting, | |
d88d4683 RD |
653 | wxPrintDialogData *data=NULL); |
654 | wxPrintPreview(wxPyPrintout* printout, | |
655 | wxPyPrintout* printoutForPrinting, | |
656 | wxPrintData* data); | |
d14a1e28 | 657 | |
c5633576 RD |
658 | ~wxPrintPreview(); |
659 | ||
d14a1e28 RD |
660 | virtual bool SetCurrentPage(int pageNum); |
661 | int GetCurrentPage(); | |
662 | ||
663 | void SetPrintout(wxPyPrintout *printout); | |
664 | wxPyPrintout *GetPrintout(); | |
665 | wxPyPrintout *GetPrintoutForPrinting(); | |
666 | ||
c5633576 RD |
667 | %cleardisown(wxPyPrintout*); |
668 | ||
d14a1e28 RD |
669 | void SetFrame(wxFrame *frame); |
670 | void SetCanvas(wxPreviewCanvas *canvas); | |
671 | ||
672 | virtual wxFrame *GetFrame(); | |
673 | virtual wxPreviewCanvas *GetCanvas(); | |
674 | ||
675 | // The preview canvas should call this from OnPaint | |
676 | virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); | |
677 | ||
678 | // This draws a blank page onto the preview canvas | |
679 | virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); | |
680 | ||
681 | // This is called by wxPrintPreview to render a page into a wxMemoryDC. | |
682 | virtual bool RenderPage(int pageNum); | |
683 | ||
684 | // Adjusts the scrollbars for the current scale | |
685 | virtual void AdjustScrollbars(wxPreviewCanvas *canvas); | |
686 | ||
687 | wxPrintDialogData& GetPrintDialogData(); | |
688 | ||
689 | virtual void SetZoom(int percent); | |
690 | int GetZoom(); | |
691 | ||
692 | int GetMaxPage(); | |
693 | int GetMinPage(); | |
694 | ||
695 | bool Ok(); | |
696 | void SetOk(bool ok); | |
697 | ||
698 | virtual bool Print(bool interactive); | |
699 | virtual void DetermineScaling(); | |
700 | ||
701 | %pythoncode { def __nonzero__(self): return self.Ok() } | |
7012bb9f RD |
702 | |
703 | %property(Canvas, GetCanvas, SetCanvas, doc="See `GetCanvas` and `SetCanvas`"); | |
704 | %property(CurrentPage, GetCurrentPage, SetCurrentPage, doc="See `GetCurrentPage` and `SetCurrentPage`"); | |
705 | %property(Frame, GetFrame, SetFrame, doc="See `GetFrame` and `SetFrame`"); | |
706 | %property(MaxPage, GetMaxPage, doc="See `GetMaxPage`"); | |
707 | %property(MinPage, GetMinPage, doc="See `GetMinPage`"); | |
708 | %property(PrintDialogData, GetPrintDialogData, doc="See `GetPrintDialogData`"); | |
709 | %property(Printout, GetPrintout, SetPrintout, doc="See `GetPrintout` and `SetPrintout`"); | |
710 | %property(PrintoutForPrinting, GetPrintoutForPrinting, doc="See `GetPrintoutForPrinting`"); | |
711 | %property(Zoom, GetZoom, SetZoom, doc="See `GetZoom` and `SetZoom`"); | |
d14a1e28 RD |
712 | }; |
713 | ||
714 | ||
715 | ||
716 | //--------------------------------------------------------------------------- | |
717 | ||
1fded56b RD |
718 | // Python-derivable versions of the above preview classes |
719 | ||
720 | %{ | |
3ef86e32 | 721 | |
a72f4631 | 722 | #define DEC_PYCALLBACK_BOOL_PREWINDC(CBNAME) \ |
a7a01418 | 723 | bool CBNAME(wxPreviewCanvas* a, wxDC& b) |
3ef86e32 RD |
724 | |
725 | ||
a72f4631 RD |
726 | #define IMP_PYCALLBACK_BOOL_PREWINDC(CLASS, PCLASS, CBNAME) \ |
727 | bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \ | |
728 | bool rval=false; \ | |
729 | bool found; \ | |
893d597c | 730 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ |
a72f4631 RD |
731 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
732 | PyObject* win = wxPyMake_wxObject(a,false); \ | |
733 | PyObject* dc = wxPyMake_wxObject(&b,false); \ | |
734 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc)); \ | |
735 | Py_DECREF(win); \ | |
736 | Py_DECREF(dc); \ | |
737 | } \ | |
738 | wxPyEndBlockThreads(blocked); \ | |
739 | if (! found) \ | |
740 | rval = PCLASS::CBNAME(a, b); \ | |
741 | return rval; \ | |
a7a01418 | 742 | } |
3ef86e32 RD |
743 | |
744 | ||
745 | ||
746 | ||
1fded56b RD |
747 | class wxPyPrintPreview : public wxPrintPreview |
748 | { | |
749 | DECLARE_CLASS(wxPyPrintPreview) | |
750 | public: | |
d88d4683 RD |
751 | wxPyPrintPreview(wxPyPrintout* printout, |
752 | wxPyPrintout* printoutForPrinting, | |
753 | wxPrintDialogData* data=NULL) | |
754 | : wxPrintPreview(printout, printoutForPrinting, data) | |
755 | {} | |
1fded56b RD |
756 | wxPyPrintPreview(wxPyPrintout* printout, |
757 | wxPyPrintout* printoutForPrinting, | |
893d597c | 758 | wxPrintData* data) |
1fded56b RD |
759 | : wxPrintPreview(printout, printoutForPrinting, data) |
760 | {} | |
761 | ||
762 | DEC_PYCALLBACK_BOOL_INT(SetCurrentPage); | |
3ef86e32 RD |
763 | DEC_PYCALLBACK_BOOL_PREWINDC(PaintPage); |
764 | DEC_PYCALLBACK_BOOL_PREWINDC(DrawBlankPage); | |
1fded56b RD |
765 | DEC_PYCALLBACK_BOOL_INT(RenderPage); |
766 | DEC_PYCALLBACK_VOID_INT(SetZoom); | |
767 | DEC_PYCALLBACK_BOOL_BOOL(Print); | |
768 | DEC_PYCALLBACK_VOID_(DetermineScaling); | |
769 | ||
770 | PYPRIVATE; | |
771 | }; | |
772 | ||
773 | // Stupid renamed classes... Fix this in 2.5... | |
774 | #if defined(__WXMSW__) | |
775 | IMPLEMENT_CLASS( wxPyPrintPreview, wxWindowsPrintPreview ); | |
776 | #elif defined(__WXMAC__) | |
777 | IMPLEMENT_CLASS( wxPyPrintPreview, wxMacPrintPreview ); | |
778 | #else | |
779 | IMPLEMENT_CLASS( wxPyPrintPreview, wxPostScriptPrintPreview ); | |
780 | #endif | |
781 | ||
3ef86e32 RD |
782 | IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, SetCurrentPage); |
783 | IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, PaintPage); | |
784 | IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, DrawBlankPage); | |
785 | IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, RenderPage); | |
786 | IMP_PYCALLBACK_VOID_INT (wxPyPrintPreview, wxPrintPreview, SetZoom); | |
787 | IMP_PYCALLBACK_BOOL_BOOL (wxPyPrintPreview, wxPrintPreview, Print); | |
788 | IMP_PYCALLBACK_VOID_ (wxPyPrintPreview, wxPrintPreview, DetermineScaling); | |
1fded56b RD |
789 | %} |
790 | ||
791 | ||
ab1f7d2a RD |
792 | MustHaveApp(wxPyPrintPreview); |
793 | ||
1fded56b RD |
794 | class wxPyPrintPreview : public wxPrintPreview |
795 | { | |
796 | public: | |
c5633576 RD |
797 | %disownarg(wxPyPrintout*); |
798 | ||
2b9048c5 | 799 | %pythonAppend wxPyPrintPreview "self._setCallbackInfo(self, PyPrintPreview)" |
d88d4683 RD |
800 | %nokwargs wxPyPrintPreview; |
801 | wxPyPrintPreview(wxPyPrintout* printout, | |
802 | wxPyPrintout* printoutForPrinting, | |
803 | wxPrintDialogData* data=NULL); | |
1fded56b RD |
804 | wxPyPrintPreview(wxPyPrintout* printout, |
805 | wxPyPrintout* printoutForPrinting, | |
d88d4683 | 806 | wxPrintData* data); |
1fded56b | 807 | |
c5633576 RD |
808 | %cleardisown(wxPyPrintout*); |
809 | ||
1fded56b | 810 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
d14a1e28 | 811 | |
a7a01418 RD |
812 | bool SetCurrentPage(int pageNum); |
813 | bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); | |
814 | bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); | |
815 | bool RenderPage(int pageNum); | |
816 | void SetZoom(int percent); | |
817 | bool Print(bool interactive); | |
818 | void DetermineScaling(); | |
819 | ||
820 | %MAKE_BASE_FUNC(PyPrintPreview, SetCurrentPage); | |
821 | %MAKE_BASE_FUNC(PyPrintPreview, PaintPage); | |
822 | %MAKE_BASE_FUNC(PyPrintPreview, DrawBlankPage); | |
823 | %MAKE_BASE_FUNC(PyPrintPreview, RenderPage); | |
824 | %MAKE_BASE_FUNC(PyPrintPreview, SetZoom); | |
825 | %MAKE_BASE_FUNC(PyPrintPreview, Print); | |
826 | %MAKE_BASE_FUNC(PyPrintPreview, DetermineScaling); | |
1fded56b RD |
827 | }; |
828 | ||
829 | ||
bb0054cd | 830 | |
bb0054cd | 831 | |
1fded56b RD |
832 | %{ |
833 | class wxPyPreviewFrame : public wxPreviewFrame | |
834 | { | |
4617be08 | 835 | DECLARE_CLASS(wxPyPreviewFrame) |
1fded56b RD |
836 | public: |
837 | wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent, | |
838 | const wxString& title, | |
839 | const wxPoint& pos = wxDefaultPosition, | |
840 | const wxSize& size = wxDefaultSize, | |
841 | long style = wxDEFAULT_FRAME_STYLE, | |
842 | const wxString& name = wxPyFrameNameStr) | |
843 | : wxPreviewFrame(preview, parent, title, pos, size, style, name) | |
844 | {} | |
845 | ||
3ef86e32 | 846 | void SetPreviewCanvas(wxPreviewCanvas* canvas) { m_previewCanvas = canvas; } |
1fded56b RD |
847 | void SetControlBar(wxPreviewControlBar* bar) { m_controlBar = bar; } |
848 | ||
849 | DEC_PYCALLBACK_VOID_(Initialize); | |
850 | DEC_PYCALLBACK_VOID_(CreateCanvas); | |
851 | DEC_PYCALLBACK_VOID_(CreateControlBar); | |
852 | ||
853 | PYPRIVATE; | |
854 | }; | |
855 | ||
856 | IMPLEMENT_CLASS(wxPyPreviewFrame, wxPreviewFrame); | |
857 | ||
858 | IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, Initialize); | |
859 | IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateCanvas); | |
860 | IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateControlBar); | |
861 | %} | |
862 | ||
d14a1e28 | 863 | |
ab1f7d2a RD |
864 | MustHaveApp(wxPyPreviewFrame); |
865 | ||
1fded56b RD |
866 | class wxPyPreviewFrame : public wxPreviewFrame |
867 | { | |
868 | public: | |
2b9048c5 | 869 | %pythonAppend wxPyPreviewFrame "self._setCallbackInfo(self, PyPreviewFrame); self._setOORInfo(self)" |
d14a1e28 | 870 | |
1fded56b RD |
871 | wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent, |
872 | const wxString& title, | |
873 | const wxPoint& pos = wxDefaultPosition, | |
874 | const wxSize& size = wxDefaultSize, | |
875 | long style = wxDEFAULT_FRAME_STYLE, | |
876 | const wxString& name = wxPyFrameNameStr); | |
877 | ||
878 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
1fded56b | 879 | |
3ef86e32 | 880 | void SetPreviewCanvas(wxPreviewCanvas* canvas); |
1fded56b RD |
881 | void SetControlBar(wxPreviewControlBar* bar); |
882 | ||
a7a01418 RD |
883 | void Initialize(); |
884 | void CreateCanvas(); | |
885 | void CreateControlBar(); | |
886 | ||
887 | %MAKE_BASE_FUNC(PyPreviewFrame, Initialize); | |
888 | %MAKE_BASE_FUNC(PyPreviewFrame, CreateCanvas); | |
889 | %MAKE_BASE_FUNC(PyPreviewFrame, CreateControlBar); | |
bb0054cd RD |
890 | }; |
891 | ||
1fded56b RD |
892 | |
893 | ||
894 | ||
895 | %{ | |
896 | class wxPyPreviewControlBar : public wxPreviewControlBar | |
897 | { | |
4617be08 | 898 | DECLARE_CLASS(wxPyPreviewControlBar) |
1fded56b RD |
899 | public: |
900 | wxPyPreviewControlBar(wxPrintPreview *preview, | |
901 | long buttons, | |
902 | wxWindow *parent, | |
903 | const wxPoint& pos = wxDefaultPosition, | |
904 | const wxSize& size = wxDefaultSize, | |
905 | long style = 0, | |
906 | const wxString& name = wxPyPanelNameStr) | |
907 | : wxPreviewControlBar(preview, buttons, parent, pos, size, style, name) | |
908 | {} | |
909 | ||
910 | void SetPrintPreview(wxPrintPreview* preview) { m_printPreview = preview; } | |
911 | ||
912 | DEC_PYCALLBACK_VOID_(CreateButtons); | |
913 | DEC_PYCALLBACK_VOID_INT(SetZoomControl); | |
914 | ||
915 | PYPRIVATE; | |
916 | }; | |
917 | ||
918 | IMPLEMENT_CLASS(wxPyPreviewControlBar, wxPreviewControlBar); | |
919 | IMP_PYCALLBACK_VOID_(wxPyPreviewControlBar, wxPreviewControlBar, CreateButtons); | |
920 | IMP_PYCALLBACK_VOID_INT(wxPyPreviewControlBar, wxPreviewControlBar, SetZoomControl); | |
921 | %} | |
922 | ||
d14a1e28 | 923 | |
ab1f7d2a RD |
924 | MustHaveApp(wxPyPreviewControlBar); |
925 | ||
1fded56b RD |
926 | class wxPyPreviewControlBar : public wxPreviewControlBar |
927 | { | |
928 | public: | |
2b9048c5 | 929 | %pythonAppend wxPyPreviewControlBar "self._setCallbackInfo(self, PyPreviewControlBar); self._setOORInfo(self)" |
d14a1e28 | 930 | |
1fded56b RD |
931 | wxPyPreviewControlBar(wxPrintPreview *preview, |
932 | long buttons, | |
933 | wxWindow *parent, | |
934 | const wxPoint& pos = wxDefaultPosition, | |
935 | const wxSize& size = wxDefaultSize, | |
936 | long style = 0, | |
937 | const wxString& name = wxPyPanelNameStr); | |
938 | ||
939 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
1fded56b RD |
940 | |
941 | void SetPrintPreview(wxPrintPreview* preview); | |
942 | ||
a7a01418 RD |
943 | void CreateButtons(); |
944 | void SetZoomControl(int zoom); | |
945 | ||
946 | %MAKE_BASE_FUNC(PreviewControlBar, CreateButtons); | |
947 | %MAKE_BASE_FUNC(PreviewControlBar, SetZoomControl); | |
1fded56b RD |
948 | }; |
949 | ||
d14a1e28 RD |
950 | //--------------------------------------------------------------------------- |
951 | //--------------------------------------------------------------------------- | |
9416aa89 RD |
952 | %init %{ |
953 | wxPyPtrTypeMap_Add("wxPrintout", "wxPyPrintout"); | |
954 | %} | |
d14a1e28 | 955 | //--------------------------------------------------------------------------- |