1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defs for wxDC and releated classes
7 // Created: 7-July-1997
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
17 //---------------------------------------------------------------------------
20 #include "wx/wxPython/pydrawxxx.h"
23 // TODO: 1. wrappers for wxDrawObject and wxDC::DrawObject
26 //---------------------------------------------------------------------------
28 %typemap(in) (int points, wxPoint* points_array ) {
29 $2 = wxPoint_LIST_helper($input, &$1);
30 if ($2 == NULL) SWIG_fail;
32 %typemap(freearg) (int points, wxPoint* points_array ) {
37 //---------------------------------------------------------------------------
41 // wxDC is the device context - object on which any drawing is done
42 class wxDC : public wxObject {
44 // wxDC(); **** abstract base class, can't instantiate.
48 virtual void BeginDrawing();
49 virtual void EndDrawing();
52 // virtual void DrawObject(wxDrawObject* drawobject);
56 #if 1 // The < 2.4 and > 2.5.1.5 way
58 bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
59 %name(FloodFillPoint) bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
61 //bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
63 wxColour GetPixel(wxCoord x, wxCoord y) {
65 self->GetPixel(x, y, &col);
68 wxColour GetPixelPoint(const wxPoint& pt) {
70 self->GetPixel(pt, &col);
75 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
76 %name(DrawLinePoint) void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
78 void CrossHair(wxCoord x, wxCoord y);
79 %name(CrossHairPoint) void CrossHair(const wxPoint& pt);
81 void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
82 %name(DrawArcPoint) void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
84 void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
85 %name(DrawCheckMarkRect) void DrawCheckMark(const wxRect& rect);
87 void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
88 %name(DrawEllipticArcPointSize) void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
90 void DrawPoint(wxCoord x, wxCoord y);
91 %name(DrawPointPoint) void DrawPoint(const wxPoint& pt);
93 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
94 %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
95 %name(DrawRectanglePointSize) void DrawRectangle(const wxPoint& pt, const wxSize& sz);
97 void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
98 %name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
99 %name(DrawRoundedRectanglePointSize) void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
101 void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
102 %name(DrawCirclePoint) void DrawCircle(const wxPoint& pt, wxCoord radius);
104 void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
105 %name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
106 %name(DrawEllipsePointSize) void DrawEllipse(const wxPoint& pt, const wxSize& sz);
108 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
109 %name(DrawIconPoint) void DrawIcon(const wxIcon& icon, const wxPoint& pt);
111 void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
112 %name(DrawBitmapPoint) void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = False);
114 void DrawText(const wxString& text, wxCoord x, wxCoord y);
115 %name(DrawTextPoint) void DrawText(const wxString& text, const wxPoint& pt);
117 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
118 %name(DrawRotatedTextPoint) void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
120 bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
121 wxDC *source, wxCoord xsrc, wxCoord ysrc,
122 int rop = wxCOPY, bool useMask = False,
123 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
124 %name(BlitPointSize) bool Blit(const wxPoint& destPt, const wxSize& sz,
125 wxDC *source, const wxPoint& srcPt,
126 int rop = wxCOPY, bool useMask = False,
127 const wxPoint& srcPtMask = wxDefaultPosition);
130 void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
131 %name(SetClippingRegionPointSize) void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
132 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
133 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
135 #else // The doomed 2.5.1.5
137 %name(FloodFillXY) bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
138 bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
140 //%name(GetPixelXY) bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
141 //bool GetPixel(const wxPoint& pt, wxColour *col) const;
143 wxColour GetPixelXY(wxCoord x, wxCoord y) {
145 self->GetPixel(x, y, &col);
148 wxColour GetPixel(const wxPoint& pt) {
150 self->GetPixel(pt, &col);
155 %name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
156 void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
158 %name(CrossHairXY) void CrossHair(wxCoord x, wxCoord y);
159 void CrossHair(const wxPoint& pt);
161 %name(DrawArcXY) void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
162 void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
164 %name(DrawCheckMarkXY) void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
165 void DrawCheckMark(const wxRect& rect);
167 %name(DrawEllipticArcXY) void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
168 void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
170 %name(DrawPointXY) void DrawPoint(wxCoord x, wxCoord y);
171 void DrawPoint(const wxPoint& pt);
173 %name(DrawRectangleXY) void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
174 void DrawRectangle(const wxPoint& pt, const wxSize& sz);
175 %name(DrawRectangleRect) void DrawRectangle(const wxRect& rect);
177 %name(DrawRoundedRectangleXY) void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
178 void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
179 %name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
181 %name(DrawCircleXY) void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
182 void DrawCircle(const wxPoint& pt, wxCoord radius);
184 %name(DrawEllipseXY) void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
185 void DrawEllipse(const wxPoint& pt, const wxSize& sz);
186 %name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
188 %name(DrawIconXY) void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
189 void DrawIcon(const wxIcon& icon, const wxPoint& pt);
191 %name(DrawBitmapXY) void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
192 void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = False);
194 %name(DrawTextXY) void DrawText(const wxString& text, wxCoord x, wxCoord y);
195 void DrawText(const wxString& text, const wxPoint& pt);
197 %name(DrawRotatedTextXY) void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
198 void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
201 %name(BlitXY) bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
202 wxDC *source, wxCoord xsrc, wxCoord ysrc,
203 int rop = wxCOPY, bool useMask = False,
204 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
205 bool Blit(const wxPoint& destPt, const wxSize& sz,
206 wxDC *source, const wxPoint& srcPt,
207 int rop = wxCOPY, bool useMask = False,
208 const wxPoint& srcPtMask = wxDefaultPosition);
211 %name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
212 void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
213 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
214 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
218 void DrawLines(int points, wxPoint* points_array, wxCoord xoffset = 0, wxCoord yoffset = 0);
220 void DrawPolygon(int points, wxPoint* points_array,
221 wxCoord xoffset = 0, wxCoord yoffset = 0,
222 int fillStyle = wxODDEVEN_RULE);
224 // TODO: Figure out a good typemap for this...
225 // Convert the first 3 args from a sequence of sequences?
226 // void DrawPolyPolygon(int n, int count[], wxPoint points[],
227 // wxCoord xoffset = 0, wxCoord yoffset = 0,
228 // int fillStyle = wxODDEVEN_RULE);
231 // this version puts both optional bitmap and the text into the given
232 // rectangle and aligns is as specified by alignment parameter; it also
233 // will emphasize the character with the given index if it is != -1 and
234 // return the bounding rectangle if required
235 void DrawLabel(const wxString& text, const wxRect& rect,
236 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
237 int indexAccel = -1);
239 wxRect DrawImageLabel(const wxString& text,
240 const wxBitmap& image,
242 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
243 int indexAccel = -1) {
245 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
252 void DrawSpline(int points, wxPoint* points_array);
256 // global DC operations
257 // --------------------
259 virtual void Clear();
261 virtual bool StartDoc(const wxString& message);
262 virtual void EndDoc();
264 virtual void StartPage();
265 virtual void EndPage();
268 // set objects to use for drawing
269 // ------------------------------
271 virtual void SetFont(const wxFont& font);
272 virtual void SetPen(const wxPen& pen);
273 virtual void SetBrush(const wxBrush& brush);
274 virtual void SetBackground(const wxBrush& brush);
275 virtual void SetBackgroundMode(int mode);
276 virtual void SetPalette(const wxPalette& palette);
279 virtual void DestroyClippingRegion();
282 void, GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT) const,
283 "GetClippingBox() -> (x, y, width, height)");
286 wxRect GetClippingRect() {
288 self->GetClippingBox(rect);
298 virtual wxCoord GetCharHeight() const;
299 virtual wxCoord GetCharWidth() const;
303 void, GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT),
304 "GetTextExtent(wxString string) -> (width, height)",
305 "Get the width and height of the text using the current font. Only
306 works for single line strings.", "");
309 void, GetTextExtent(const wxString& string,
310 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
311 wxFont* font = NULL),
312 "GetFullTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
313 "Get the width, height, decent and leading of the text using the
314 current or specified font. Only works for single line strings.", "",
318 // works for single as well as multi-line strings
320 void, GetMultiLineTextExtent(const wxString& text,
321 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
322 wxFont *font = NULL),
323 "GetMultiLineTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
324 "Get the width, height, decent and leading of the text using the
325 current or specified font. Works for single as well as multi-line
330 wxArrayInt GetPartialTextExtents(const wxString& text) {
332 self->GetPartialTextExtents(text, widths);
338 // size and resolution
339 // -------------------
341 DocStr(GetSize, "Get the DC size in device units.", "");
344 void, GetSize( int *OUTPUT, int *OUTPUT ),
345 "GetSizeTuple() -> (width, height)",
349 DocStr(GetSizeMM, "Get the DC size in milimeters.", "");
350 wxSize GetSizeMM() const;
352 void, GetSizeMM( int *OUTPUT, int *OUTPUT ) const,
353 "GetSizeMMTuple() -> (width, height)",
358 // coordinates conversions
359 // -----------------------
361 // This group of functions does actual conversion of the input, as you'd
363 wxCoord DeviceToLogicalX(wxCoord x) const;
364 wxCoord DeviceToLogicalY(wxCoord y) const;
365 wxCoord DeviceToLogicalXRel(wxCoord x) const;
366 wxCoord DeviceToLogicalYRel(wxCoord y) const;
367 wxCoord LogicalToDeviceX(wxCoord x) const;
368 wxCoord LogicalToDeviceY(wxCoord y) const;
369 wxCoord LogicalToDeviceXRel(wxCoord x) const;
370 wxCoord LogicalToDeviceYRel(wxCoord y) const;
372 // query DC capabilities
373 // ---------------------
375 virtual bool CanDrawBitmap() const;
376 virtual bool CanGetTextExtent() const;
379 virtual int GetDepth() const;
381 // Resolution in Pixels per inch
382 virtual wxSize GetPPI() const;
384 virtual bool Ok() const;
388 int GetBackgroundMode() const;
389 const wxBrush& GetBackground() const;
390 const wxBrush& GetBrush() const;
391 const wxFont& GetFont() const;
392 const wxPen& GetPen() const;
393 const wxColour& GetTextBackground() const;
394 const wxColour& GetTextForeground() const;
396 virtual void SetTextForeground(const wxColour& colour);
397 virtual void SetTextBackground(const wxColour& colour);
399 int GetMapMode() const;
400 virtual void SetMapMode(int mode);
404 virtual void, GetUserScale(double *OUTPUT, double *OUTPUT) const,
405 "GetUserScale() -> (xScale, yScale)");
407 virtual void SetUserScale(double x, double y);
411 virtual void, GetLogicalScale(double *OUTPUT, double *OUTPUT),
412 "GetLogicalScale() -> (xScale, yScale)");
414 virtual void SetLogicalScale(double x, double y);
417 wxPoint GetLogicalOrigin() const;
419 void, GetLogicalOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
420 "GetLogicalOriginTuple() -> (x,y)",
421 GetLogicalOriginTuple);
423 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
425 void SetLogicalOriginPoint(const wxPoint& point) {
426 self->SetLogicalOrigin(point.x, point.y);
431 wxPoint GetDeviceOrigin() const;
433 void, GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
434 "GetDeviceOriginTuple() -> (x,y)",
435 GetDeviceOriginTuple);
437 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
439 void SetDeviceOriginPoint(const wxPoint& point) {
440 self->SetDeviceOrigin(point.x, point.y);
444 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
446 int GetLogicalFunction() const;
447 virtual void SetLogicalFunction(int function);
449 virtual void SetOptimization(bool opt);
450 virtual bool GetOptimization();
456 virtual void CalcBoundingBox(wxCoord x, wxCoord y);
458 void CalcBoundingBoxPoint(const wxPoint& point) {
459 self->CalcBoundingBox(point.x, point.y);
463 void ResetBoundingBox();
465 // Get the final bounding box of the PostScript or Metafile picture.
466 wxCoord MinX() const;
467 wxCoord MaxX() const;
468 wxCoord MinY() const;
469 wxCoord MaxY() const;
473 "GetBoundingBox() -> (x1,y1, x2,y2)");
475 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
476 // See below for implementation
478 %pythoncode { def __nonzero__(self): return self.Ok() };
482 %extend { // See drawlist.cpp for impplementaion of these...
483 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
485 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
488 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
490 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
493 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
495 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
498 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
500 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
503 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
505 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
508 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
509 PyObject* foregroundList, PyObject* backgroundList) {
510 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
515 def DrawPointList(self, points, pens=None):
518 elif isinstance(pens, wx.Pen):
520 elif len(pens) != len(points):
521 raise ValueError('points and pens must have same length')
522 return self._DrawPointList(points, pens, [])
525 def DrawLineList(self, lines, pens=None):
528 elif isinstance(pens, wx.Pen):
530 elif len(pens) != len(lines):
531 raise ValueError('lines and pens must have same length')
532 return self._DrawLineList(lines, pens, [])
535 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
538 elif isinstance(pens, wx.Pen):
540 elif len(pens) != len(rectangles):
541 raise ValueError('rectangles and pens must have same length')
544 elif isinstance(brushes, wx.Brush):
546 elif len(brushes) != len(rectangles):
547 raise ValueError('rectangles and brushes must have same length')
548 return self._DrawRectangleList(rectangles, pens, brushes)
551 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
554 elif isinstance(pens, wx.Pen):
556 elif len(pens) != len(ellipses):
557 raise ValueError('ellipses and pens must have same length')
560 elif isinstance(brushes, wx.Brush):
562 elif len(brushes) != len(ellipses):
563 raise ValueError('ellipses and brushes must have same length')
564 return self._DrawEllipseList(ellipses, pens, brushes)
567 def DrawPolygonList(self, polygons, pens=None, brushes=None):
568 %## Note: This does not currently support fill style or offset
569 %## you can always use the non-List version if need be.
572 elif isinstance(pens, wx.Pen):
574 elif len(pens) != len(polygons):
575 raise ValueError('polygons and pens must have same length')
578 elif isinstance(brushes, wx.Brush):
580 elif len(brushes) != len(polygons):
581 raise ValueError('polygons and brushes must have same length')
582 return self._DrawPolygonList(polygons, pens, brushes)
585 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
586 %## NOTE: this does not currently support changing the font
587 %## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
588 %## If you want backgounds to do anything.
589 if type(textList) == type(''):
590 textList = [textList]
591 elif len(textList) != len(coords):
592 raise ValueError('textlist and coords must have same length')
593 if foregrounds is None:
595 elif isinstance(foregrounds, wx.Colour):
596 foregrounds = [foregrounds]
597 elif len(foregrounds) != len(coords):
598 raise ValueError('foregrounds and coords must have same length')
599 if backgrounds is None:
601 elif isinstance(backgrounds, wx.Colour):
602 backgrounds = [backgrounds]
603 elif len(backgrounds) != len(coords):
604 raise ValueError('backgrounds and coords must have same length')
605 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
613 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
622 //---------------------------------------------------------------------------
625 class wxMemoryDC : public wxDC {
628 %name(MemoryDCFromDC) wxMemoryDC(wxDC* oldDC);
630 void SelectObject(const wxBitmap& bitmap);
633 //---------------------------------------------------------------------------
638 #include <wx/dcbuffer.h>
642 class wxBufferedDC : public wxMemoryDC
645 %pythonAppend wxBufferedDC
646 "self._dc = args[0] # save a ref so the other dc will not be deleted before self";
648 %nokwargs wxBufferedDC;
650 // Construct a wxBufferedDC using a user supplied buffer.
651 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
653 // Construct a wxBufferedDC with an internal buffer of 'area'
654 // (where area is usually something like the size of the window
656 wxBufferedDC( wxDC *dc, const wxSize &area );
659 // TODO: Keep this one too?
660 %pythonAppend wxBufferedDC( wxDC *dc, const wxSize &area )
661 "val._dc = args[0] # save a ref so the other dc will not be deleted before self";
662 %name(BufferedDCInternalBuffer) wxBufferedDC( wxDC *dc, const wxSize &area );
665 // The buffer is blit to the real DC when the BufferedDC is destroyed.
669 // Blits the buffer to the dc, and detaches the dc from
670 // the buffer. Usually called in the dtor or by the dtor
671 // of derived classes if the BufferedDC must blit before
672 // the derived class (which may own the dc it's blitting
680 // Creates a double buffered wxPaintDC, optionally allowing the
681 // user to specify their own buffer to use.
682 class wxBufferedPaintDC : public wxBufferedDC
686 // If no bitmap is supplied by the user, a temporary one will be created.
687 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
692 //---------------------------------------------------------------------------
695 class wxScreenDC : public wxDC {
699 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
700 bool StartDrawingOnTop(wxRect* rect = NULL);
701 bool EndDrawingOnTop();
704 //---------------------------------------------------------------------------
707 class wxClientDC : public wxDC {
709 wxClientDC(wxWindow* win);
712 //---------------------------------------------------------------------------
715 class wxPaintDC : public wxDC {
717 wxPaintDC(wxWindow* win);
720 //---------------------------------------------------------------------------
723 class wxWindowDC : public wxDC {
725 wxWindowDC(wxWindow* win);
728 //---------------------------------------------------------------------------
731 class wxMirrorDC : public wxDC
734 // constructs a mirror DC associated with the given real DC
736 // if mirror parameter is True, all vertical and horizontal coordinates are
737 // exchanged, otherwise this class behaves in exactly the same way as a
740 wxMirrorDC(wxDC& dc, bool mirror);
743 //---------------------------------------------------------------------------
750 class wxPostScriptDC : public wxDC {
752 wxPostScriptDC(const wxPrintData& printData);
753 // %name(PostScriptDC2)wxPostScriptDC(const wxString& output,
754 // bool interactive = True,
755 // wxWindow* parent = NULL);
757 wxPrintData& GetPrintData();
758 void SetPrintData(const wxPrintData& data);
760 static void SetResolution(int ppi);
761 static int GetResolution();
764 //---------------------------------------------------------------------------
768 #if defined(__WXMSW__) || defined(__WXMAC__)
771 #include <wx/metafile.h>
774 class wxMetaFile : public wxObject {
776 wxMetaFile(const wxString& filename = wxPyEmptyString);
780 bool SetClipboard(int width = 0, int height = 0);
787 const wxString& GetFileName() const;
790 %pythoncode { def __nonzero__(self): return self.Ok() }
793 // bool wxMakeMetaFilePlaceable(const wxString& filename,
794 // int minX, int minY, int maxX, int maxY, float scale=1.0);
797 class wxMetaFileDC : public wxDC {
799 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
800 int width = 0, int height = 0,
801 const wxString& description = wxPyEmptyString);
807 #else // Make some dummies for the other platforms
810 class wxMetaFile : public wxObject {
812 wxMetaFile(const wxString&)
813 { wxPyRaiseNotImplemented(); }
816 class wxMetaFileDC : public wxClientDC {
818 wxMetaFileDC(const wxString&, int, int, const wxString&)
819 { wxPyRaiseNotImplemented(); }
824 class wxMetaFile : public wxObject {
826 wxMetaFile(const wxString& filename = wxPyEmptyString);
829 class wxMetaFileDC : public wxDC {
831 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
832 int width = 0, int height = 0,
833 const wxString& description = wxPyEmptyString);
840 //---------------------------------------------------------------------------
842 #if defined(__WXMSW__) || defined(__WXMAC__)
844 class wxPrinterDC : public wxDC {
846 wxPrinterDC(const wxPrintData& printData);
847 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
848 // const wxString& device,
849 // const wxString& output,
850 // bool interactive = True,
851 // int orientation = wxPORTRAIT);
856 class wxPrinterDC : public wxClientDC {
858 wxPrinterDC(const wxPrintData&)
859 { wxPyRaiseNotImplemented(); }
861 // wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
862 // { wxPyRaiseNotImplemented(); }
866 class wxPrinterDC : public wxDC {
868 wxPrinterDC(const wxPrintData& printData);
869 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
870 // const wxString& device,
871 // const wxString& output,
872 // bool interactive = True,
873 // int orientation = wxPORTRAIT);
877 //---------------------------------------------------------------------------
878 //---------------------------------------------------------------------------
880 // Now define some Python classes that rename the Draw methods to be
881 // compatible with the DC Draw methods in 2.4. See also wxPython/_wx.py.
886 %define MAKE_OLD_DC_CLASS(classname)
888 class classname##_old(classname):
889 """DC class that has methods with 2.4 compatible parameters."""
890 FloodFill = classname.FloodFillXY
891 GetPixel = classname.GetPixelXY
892 DrawLine = classname.DrawLineXY
893 CrossHair = classname.CrossHairXY
894 DrawArc = classname.DrawArcXY
895 DrawCheckMark = classname.DrawCheckMarkXY
896 DrawEllipticArc = classname.DrawEllipticArcXY
897 DrawPoint = classname.DrawPointXY
898 DrawRectangle = classname.DrawRectangleXY
899 DrawRoundedRectangle = classname.DrawRoundedRectangleXY
900 DrawCircle = classname.DrawCircleXY
901 DrawEllipse = classname.DrawEllipseXY
902 DrawIcon = classname.DrawIconXY
903 DrawBitmap = classname.DrawBitmapXY
904 DrawText = classname.DrawTextXY
905 DrawRotatedText = classname.DrawRotatedTextXY
906 Blit = classname.BlitXY
910 MAKE_OLD_DC_CLASS(DC);
911 MAKE_OLD_DC_CLASS(MemoryDC);
912 MAKE_OLD_DC_CLASS(BufferedDC);
913 MAKE_OLD_DC_CLASS(BufferedPaintDC);
914 MAKE_OLD_DC_CLASS(ScreenDC);
915 MAKE_OLD_DC_CLASS(ClientDC);
916 MAKE_OLD_DC_CLASS(PaintDC);
917 MAKE_OLD_DC_CLASS(WindowDC);
918 MAKE_OLD_DC_CLASS(MirrorDC);
919 MAKE_OLD_DC_CLASS(PostScriptDC);
920 MAKE_OLD_DC_CLASS(MetaFileDC);
921 MAKE_OLD_DC_CLASS(PrinterDC);
925 //---------------------------------------------------------------------------