]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_dc.i
Noted where the documentation was
[wxWidgets.git] / wxPython / src / _dc.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _dc.i
3 // Purpose: SWIG interface defs for wxDC and releated classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 7-July-1997
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 %{
19 #include "wx/wxPython/pydrawxxx.h"
20 %}
21
22 // TODO: 1. wrappers for wxDrawObject and wxDC::DrawObject
23
24
25 //---------------------------------------------------------------------------
26
27 %typemap(in) (int points, wxPoint* points_array ) {
28 $2 = wxPoint_LIST_helper($input, &$1);
29 if ($2 == NULL) SWIG_fail;
30 }
31 %typemap(freearg) (int points, wxPoint* points_array ) {
32 if ($2) delete [] $2;
33 }
34
35
36 //---------------------------------------------------------------------------
37 %newgroup;
38
39
40 // wxDC is the device context - object on which any drawing is done
41 class wxDC : public wxObject {
42 public:
43 // wxDC(); **** abstract base class, can't instantiate.
44 ~wxDC();
45
46
47 virtual void BeginDrawing();
48 virtual void EndDrawing();
49
50
51 // virtual void DrawObject(wxDrawObject* drawobject);
52
53
54
55 #if 0 // The old way
56
57 bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
58 //bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
59 %extend {
60 wxColour GetPixel(wxCoord x, wxCoord y) {
61 wxColour col;
62 self->GetPixel(x, y, &col);
63 return col;
64 }
65 }
66 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
67 void CrossHair(wxCoord x, wxCoord y);
68 void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
69 void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
70 void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
71 void DrawPoint(wxCoord x, wxCoord y);
72 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
73 %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
74 void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
75 void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
76 void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
77 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
78 void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
79 void DrawText(const wxString& text, wxCoord x, wxCoord y);
80 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
81 bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
82 wxDC *source, wxCoord xsrc, wxCoord ysrc,
83 int rop = wxCOPY, bool useMask = False,
84 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
85
86
87
88 #else // The new way
89
90 %name(FloodFillXY) bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
91 bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
92
93 //%name(GetPixelXY) bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
94 //bool GetPixel(const wxPoint& pt, wxColour *col) const;
95 %extend {
96 wxColour GetPixelXY(wxCoord x, wxCoord y) {
97 wxColour col;
98 self->GetPixel(x, y, &col);
99 return col;
100 }
101 wxColour GetPixel(const wxPoint& pt) {
102 wxColour col;
103 self->GetPixel(pt, &col);
104 return col;
105 }
106 }
107 %name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
108 void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
109
110 %name(CrossHairXY) void CrossHair(wxCoord x, wxCoord y);
111 void CrossHair(const wxPoint& pt);
112
113 %name(DrawArcXY) void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
114 void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
115
116 %name(DrawCheckMarkXY) void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
117 void DrawCheckMark(const wxRect& rect);
118
119 %name(DrawEllipticArcXY) void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
120 void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
121
122 %name(DrawPointXY) void DrawPoint(wxCoord x, wxCoord y);
123 void DrawPoint(const wxPoint& pt);
124
125 %name(DrawRectangleXY) void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
126 void DrawRectangle(const wxPoint& pt, const wxSize& sz);
127 %name(DrawRectangleRect) void DrawRectangle(const wxRect& rect);
128
129 %name(DrawRoundedRectangleXY) void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
130 void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
131 %name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
132
133 %name(DrawCircleXY) void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
134 void DrawCircle(const wxPoint& pt, wxCoord radius);
135
136 %name(DrawEllipseXY) void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
137 void DrawEllipse(const wxPoint& pt, const wxSize& sz);
138 %name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
139
140 %name(DrawIconXY) void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
141 void DrawIcon(const wxIcon& icon, const wxPoint& pt);
142
143 %name(DrawBitmapXY) void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
144 void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = False);
145
146 %name(DrawTextXY) void DrawText(const wxString& text, wxCoord x, wxCoord y);
147 void DrawText(const wxString& text, const wxPoint& pt);
148
149 %name(DrawRotatedTextXY) void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
150 void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
151
152
153 %name(BlitXY) bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
154 wxDC *source, wxCoord xsrc, wxCoord ysrc,
155 int rop = wxCOPY, bool useMask = False,
156 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
157 bool Blit(const wxPoint& destPt, const wxSize& sz,
158 wxDC *source, const wxPoint& srcPt,
159 int rop = wxCOPY, bool useMask = False,
160 const wxPoint& srcPtMask = wxDefaultPosition);
161
162 #endif
163
164 void DrawLines(int points, wxPoint* points_array, wxCoord xoffset = 0, wxCoord yoffset = 0);
165
166 void DrawPolygon(int points, wxPoint* points_array,
167 wxCoord xoffset = 0, wxCoord yoffset = 0,
168 int fillStyle = wxODDEVEN_RULE);
169
170
171 // this version puts both optional bitmap and the text into the given
172 // rectangle and aligns is as specified by alignment parameter; it also
173 // will emphasize the character with the given index if it is != -1 and
174 // return the bounding rectangle if required
175 void DrawLabel(const wxString& text, const wxRect& rect,
176 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
177 int indexAccel = -1);
178 %extend {
179 wxRect DrawImageLabel(const wxString& text,
180 const wxBitmap& image,
181 const wxRect& rect,
182 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
183 int indexAccel = -1) {
184 wxRect rv;
185 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
186 return rv;
187 }
188 }
189
190
191
192 void DrawSpline(int points, wxPoint* points_array);
193
194
195
196 // global DC operations
197 // --------------------
198
199 virtual void Clear();
200
201 virtual bool StartDoc(const wxString& message);
202 virtual void EndDoc();
203
204 virtual void StartPage();
205 virtual void EndPage();
206
207
208 // set objects to use for drawing
209 // ------------------------------
210
211 virtual void SetFont(const wxFont& font);
212 virtual void SetPen(const wxPen& pen);
213 virtual void SetBrush(const wxBrush& brush);
214 virtual void SetBackground(const wxBrush& brush);
215 virtual void SetBackgroundMode(int mode);
216 virtual void SetPalette(const wxPalette& palette);
217
218
219 // clipping region
220 // ---------------
221
222 %name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
223 void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
224 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
225 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
226
227 virtual void DestroyClippingRegion();
228
229 DocDeclA(
230 void, GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT) const,
231 "GetClippingBox() -> (x, y, width, height)");
232
233 %extend {
234 wxRect GetClippingRect() {
235 wxRect rect;
236 self->GetClippingBox(rect);
237 return rect;
238 }
239 }
240
241
242
243 // text extent
244 // -----------
245
246 virtual wxCoord GetCharHeight() const;
247 virtual wxCoord GetCharWidth() const;
248
249
250 DocDeclAStr(
251 void, GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT),
252 "GetTextExtent(wxString string) -> (width, height)",
253 "Get the width and height of the text using the current font.\n"
254 "Only works for single line strings.");
255 DocDeclAStrName(
256 void, GetTextExtent(const wxString& string,
257 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
258 wxFont* font = NULL),
259 "GetFullTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
260 "Get the width, height, decent and leading of the text using the current or specified font.\n"
261 "Only works for single line strings.",
262 GetFullTextExtent);
263
264
265 // works for single as well as multi-line strings
266 DocDeclAStr(
267 void, GetMultiLineTextExtent(const wxString& text,
268 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
269 wxFont *font = NULL),
270 "GetMultiLineTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
271 "Get the width, height, decent and leading of the text using the current or specified font.\n"
272 "Works for single as well as multi-line strings.");
273
274
275 // size and resolution
276 // -------------------
277
278 DocStr(GetSize, "Get the DC size in device units.");
279 wxSize GetSize();
280 DocDeclAName(
281 void, GetSize( int *OUTPUT, int *OUTPUT ),
282 "GetSizeTuple() -> (width, height)",
283 GetSizeTuple);
284
285
286 DocStr(GetSizeMM, "Get the DC size in milimeters.");
287 wxSize GetSizeMM() const;
288 DocDeclAName(
289 void, GetSizeMM( int *OUTPUT, int *OUTPUT ) const,
290 "GetSizeMMTuple() -> (width, height)",
291 GetSizeMMTuple);
292
293
294
295 // coordinates conversions
296 // -----------------------
297
298 // This group of functions does actual conversion of the input, as you'd
299 // expect.
300 wxCoord DeviceToLogicalX(wxCoord x) const;
301 wxCoord DeviceToLogicalY(wxCoord y) const;
302 wxCoord DeviceToLogicalXRel(wxCoord x) const;
303 wxCoord DeviceToLogicalYRel(wxCoord y) const;
304 wxCoord LogicalToDeviceX(wxCoord x) const;
305 wxCoord LogicalToDeviceY(wxCoord y) const;
306 wxCoord LogicalToDeviceXRel(wxCoord x) const;
307 wxCoord LogicalToDeviceYRel(wxCoord y) const;
308
309 // query DC capabilities
310 // ---------------------
311
312 virtual bool CanDrawBitmap() const;
313 virtual bool CanGetTextExtent() const;
314
315 // colour depth
316 virtual int GetDepth() const;
317
318 // Resolution in Pixels per inch
319 virtual wxSize GetPPI() const;
320
321 virtual bool Ok() const;
322
323
324
325 int GetBackgroundMode() const;
326 const wxBrush& GetBackground() const;
327 const wxBrush& GetBrush() const;
328 const wxFont& GetFont() const;
329 const wxPen& GetPen() const;
330 const wxColour& GetTextBackground() const;
331 const wxColour& GetTextForeground() const;
332
333 virtual void SetTextForeground(const wxColour& colour);
334 virtual void SetTextBackground(const wxColour& colour);
335
336 int GetMapMode() const;
337 virtual void SetMapMode(int mode);
338
339
340 DocDeclA(
341 virtual void, GetUserScale(double *OUTPUT, double *OUTPUT) const,
342 "GetUserScale() -> (xScale, yScale)");
343
344 virtual void SetUserScale(double x, double y);
345
346
347 DocDeclA(
348 virtual void, GetLogicalScale(double *OUTPUT, double *OUTPUT),
349 "GetLogicalScale() -> (xScale, yScale)");
350
351 virtual void SetLogicalScale(double x, double y);
352
353
354 wxPoint GetLogicalOrigin() const;
355 DocDeclAName(
356 void, GetLogicalOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
357 "GetLogicalOriginTuple() -> (x,y)",
358 GetLogicalOriginTuple);
359
360 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
361
362
363 wxPoint GetDeviceOrigin() const;
364 DocDeclAName(
365 void, GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
366 "GetDeviceOriginTuple() -> (x,y)",
367 GetDeviceOriginTuple);
368
369 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
370
371 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
372
373 int GetLogicalFunction() const;
374 virtual void SetLogicalFunction(int function);
375
376 virtual void SetOptimization(bool opt);
377 virtual bool GetOptimization();
378
379
380 // bounding box
381 // ------------
382
383 virtual void CalcBoundingBox(wxCoord x, wxCoord y);
384 void ResetBoundingBox();
385
386 // Get the final bounding box of the PostScript or Metafile picture.
387 wxCoord MinX() const;
388 wxCoord MaxX() const;
389 wxCoord MinY() const;
390 wxCoord MaxY() const;
391
392
393 DocA(GetBoundingBox,
394 "GetBoundingBox() -> (x1,y1, x2,y2)");
395 %extend {
396 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
397 // See below for implementation
398 }
399 %pythoncode { def __nonzero__(self): return self.Ok() };
400
401
402
403 %extend { // See drawlist.cpp for impplementaion of these...
404 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
405 {
406 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
407 }
408
409 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
410 {
411 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
412 }
413
414 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
415 {
416 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
417 }
418
419 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
420 {
421 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
422 }
423
424 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
425 {
426 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
427 }
428
429 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
430 PyObject* foregroundList, PyObject* backgroundList) {
431 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
432 }
433 }
434
435 %pythoncode {
436 def DrawPointList(self, points, pens=None):
437 if pens is None:
438 pens = []
439 elif isinstance(pens, wx.Pen):
440 pens = [pens]
441 elif len(pens) != len(points):
442 raise ValueError('points and pens must have same length')
443 return self._DrawPointList(points, pens, [])
444
445
446 def DrawLineList(self, lines, pens=None):
447 if pens is None:
448 pens = []
449 elif isinstance(pens, wx.Pen):
450 pens = [pens]
451 elif len(pens) != len(lines):
452 raise ValueError('lines and pens must have same length')
453 return self._DrawLineList(lines, pens, [])
454
455
456 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
457 if pens is None:
458 pens = []
459 elif isinstance(pens, wx.Pen):
460 pens = [pens]
461 elif len(pens) != len(rectangles):
462 raise ValueError('rectangles and pens must have same length')
463 if brushes is None:
464 brushes = []
465 elif isinstance(brushes, wx.Brush):
466 brushes = [brushes]
467 elif len(brushes) != len(rectangles):
468 raise ValueError('rectangles and brushes must have same length')
469 return self._DrawRectangleList(rectangles, pens, brushes)
470
471
472 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
473 if pens is None:
474 pens = []
475 elif isinstance(pens, wx.Pen):
476 pens = [pens]
477 elif len(pens) != len(ellipses):
478 raise ValueError('ellipses and pens must have same length')
479 if brushes is None:
480 brushes = []
481 elif isinstance(brushes, wx.Brush):
482 brushes = [brushes]
483 elif len(brushes) != len(ellipses):
484 raise ValueError('ellipses and brushes must have same length')
485 return self._DrawEllipseList(ellipses, pens, brushes)
486
487
488 def DrawPolygonList(self, polygons, pens=None, brushes=None):
489 ## Note: This does not currently support fill style or offset
490 ## you can always use the non-List version if need be.
491 if pens is None:
492 pens = []
493 elif isinstance(pens, wx.Pen):
494 pens = [pens]
495 elif len(pens) != len(polygons):
496 raise ValueError('polygons and pens must have same length')
497 if brushes is None:
498 brushes = []
499 elif isinstance(brushes, wx.Brush):
500 brushes = [brushes]
501 elif len(brushes) != len(polygons):
502 raise ValueError('polygons and brushes must have same length')
503 return self._DrawPolygonList(polygons, pens, brushes)
504
505
506 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
507 ## NOTE: this does not currently support changing the font
508 ## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
509 ## If you want backgounds to do anything.
510 if type(textList) == type(''):
511 textList = [textList]
512 elif len(textList) != len(coords):
513 raise ValueError('textlist and coords must have same length')
514 if foregrounds is None:
515 foregrounds = []
516 elif isinstance(foregrounds, wx.Colour):
517 foregrounds = [foregrounds]
518 elif len(foregrounds) != len(coords):
519 raise ValueError('foregrounds and coords must have same length')
520 if backgrounds is None:
521 backgrounds = []
522 elif isinstance(backgrounds, wx.Colour):
523 backgrounds = [backgrounds]
524 elif len(backgrounds) != len(coords):
525 raise ValueError('backgrounds and coords must have same length')
526 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
527 }
528
529 };
530
531
532
533 %{
534 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
535 *x1 = dc->MinX();
536 *y1 = dc->MinY();
537 *x2 = dc->MaxX();
538 *y2 = dc->MaxY();
539 }
540 %}
541
542
543 //---------------------------------------------------------------------------
544 %newgroup
545
546 class wxMemoryDC : public wxDC {
547 public:
548 wxMemoryDC();
549 %name(MemoryDCFromDC) wxMemoryDC(wxDC* oldDC);
550
551 void SelectObject(const wxBitmap& bitmap);
552 };
553
554 //---------------------------------------------------------------------------
555 %newgroup
556
557 class wxBufferedDC : public wxMemoryDC
558 {
559 public:
560 %addtofunc wxBufferedDC( wxDC *dc, const wxBitmap &buffer )
561 "self._dc = args[0] # save a ref so the other dc will not be deleted before self";
562 %addtofunc wxBufferedDC( wxDC *dc, const wxSize &area )
563 "val._dc = args[0] # save a ref so the other dc will not be deleted before self";
564
565 // Construct a wxBufferedDC using a user supplied buffer.
566 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
567
568 // Construct a wxBufferedDC with an internal buffer of 'area'
569 // (where area is usually something like the size of the window
570 // being buffered)
571 %name(BufferedDCInternalBuffer) wxBufferedDC( wxDC *dc, const wxSize &area );
572
573 // Blits the buffer to the dc, and detaches the dc from
574 // the buffer. Usually called in the dtor or by the dtor
575 // of derived classes if the BufferedDC must blit before
576 // the derived class (which may own the dc it's blitting
577 // to) is destroyed.
578 void UnMask();
579 };
580
581
582 class wxBufferedPaintDC : public wxBufferedDC
583 {
584 public:
585 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
586 };
587
588
589 //---------------------------------------------------------------------------
590 %newgroup
591
592 class wxScreenDC : public wxDC {
593 public:
594 wxScreenDC();
595
596 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
597 bool StartDrawingOnTop(wxRect* rect = NULL);
598 bool EndDrawingOnTop();
599 };
600
601 //---------------------------------------------------------------------------
602 %newgroup
603
604 class wxClientDC : public wxDC {
605 public:
606 wxClientDC(wxWindow* win);
607 };
608
609 //---------------------------------------------------------------------------
610 %newgroup
611
612 class wxPaintDC : public wxDC {
613 public:
614 wxPaintDC(wxWindow* win);
615 };
616
617 //---------------------------------------------------------------------------
618 %newgroup
619
620 class wxWindowDC : public wxDC {
621 public:
622 wxWindowDC(wxWindow* win);
623 };
624
625 //---------------------------------------------------------------------------
626 %newgroup
627
628 class wxMirrorDC : public wxDC
629 {
630 public:
631 // constructs a mirror DC associated with the given real DC
632 //
633 // if mirror parameter is True, all vertical and horizontal coordinates are
634 // exchanged, otherwise this class behaves in exactly the same way as a
635 // plain DC
636 //
637 wxMirrorDC(wxDC& dc, bool mirror);
638 };
639
640 //---------------------------------------------------------------------------
641 %newgroup
642
643 %{
644 #include <wx/dcps.h>
645 %}
646
647 class wxPostScriptDC : public wxDC {
648 public:
649 wxPostScriptDC(const wxPrintData& printData);
650 // %name(PostScriptDC2)wxPostScriptDC(const wxString& output,
651 // bool interactive = True,
652 // wxWindow* parent = NULL);
653
654 wxPrintData& GetPrintData();
655 void SetPrintData(const wxPrintData& data);
656
657 static void SetResolution(int ppi);
658 static int GetResolution();
659 };
660
661 //---------------------------------------------------------------------------
662 %newgroup
663
664
665 #ifdef __WXMSW__
666
667 %{
668 #include <wx/metafile.h>
669 %}
670
671 class wxMetaFile : public wxObject {
672 public:
673 wxMetaFile(const wxString& filename = wxPyEmptyString);
674 ~wxMetaFile();
675
676 bool Ok();
677 bool SetClipboard(int width = 0, int height = 0);
678
679 wxSize GetSize();
680 int GetWidth();
681 int GetHeight();
682
683 const wxString& GetFileName() const;
684
685 %pythoncode { def __nonzero__(self): return self.Ok() }
686 };
687
688 // bool wxMakeMetaFilePlaceable(const wxString& filename,
689 // int minX, int minY, int maxX, int maxY, float scale=1.0);
690
691
692 class wxMetaFileDC : public wxDC {
693 public:
694 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
695 int width = 0, int height = 0,
696 const wxString& description = wxPyEmptyString);
697 wxMetaFile* Close();
698 };
699
700
701
702 #else // Make some dummies for the other platforms
703
704 %{
705 class wxMetaFile : public wxObject {
706 public:
707 wxMetaFile(const wxString&)
708 { PyErr_SetNone(PyExc_NotImplementedError); }
709 };
710
711 class wxMetaFileDC : public wxClientDC {
712 public:
713 wxMetaFileDC(const wxString&, int, int, const wxString&)
714 { PyErr_SetNone(PyExc_NotImplementedError); }
715 };
716
717 %}
718
719 class wxMetaFile : public wxObject {
720 public:
721 wxMetaFile(const wxString& filename = wxPyEmptyString);
722 };
723
724 class wxMetaFileDC : public wxDC {
725 public:
726 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
727 int width = 0, int height = 0,
728 const wxString& description = wxPyEmptyString);
729 };
730
731
732 #endif
733
734
735 //---------------------------------------------------------------------------
736
737 #if defined(__WXMSW__) || defined(__WXMAC__)
738
739 class wxPrinterDC : public wxDC {
740 public:
741 wxPrinterDC(const wxPrintData& printData);
742 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
743 // const wxString& device,
744 // const wxString& output,
745 // bool interactive = True,
746 // int orientation = wxPORTRAIT);
747 };
748
749 #else
750 %{
751 class wxPrinterDC : public wxClientDC {
752 public:
753 wxPrinterDC(const wxPrintData&)
754 { PyErr_SetNone(PyExc_NotImplementedError); }
755
756 // wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
757 // { PyErr_SetNone(PyExc_NotImplementedError); }
758 };
759 %}
760
761 class wxPrinterDC : public wxDC {
762 public:
763 wxPrinterDC(const wxPrintData& printData);
764 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
765 // const wxString& device,
766 // const wxString& output,
767 // bool interactive = True,
768 // int orientation = wxPORTRAIT);
769 };
770 #endif
771
772 //---------------------------------------------------------------------------