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