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.\n"
306 "Only works for single line strings.");
308 void, GetTextExtent(const wxString& string,
309 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
310 wxFont* font = NULL),
311 "GetFullTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
312 "Get the width, height, decent and leading of the text using the current or specified font.\n"
313 "Only works for single line strings.",
317 // works for single as well as multi-line strings
319 void, GetMultiLineTextExtent(const wxString& text,
320 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
321 wxFont *font = NULL),
322 "GetMultiLineTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
323 "Get the width, height, decent and leading of the text using the current or specified font.\n"
324 "Works for single as well as multi-line strings.");
328 wxArrayInt GetPartialTextExtents(const wxString& text) {
330 self->GetPartialTextExtents(text, widths);
336 // size and resolution
337 // -------------------
339 DocStr(GetSize, "Get the DC size in device units.");
342 void, GetSize( int *OUTPUT, int *OUTPUT ),
343 "GetSizeTuple() -> (width, height)",
347 DocStr(GetSizeMM, "Get the DC size in milimeters.");
348 wxSize GetSizeMM() const;
350 void, GetSizeMM( int *OUTPUT, int *OUTPUT ) const,
351 "GetSizeMMTuple() -> (width, height)",
356 // coordinates conversions
357 // -----------------------
359 // This group of functions does actual conversion of the input, as you'd
361 wxCoord DeviceToLogicalX(wxCoord x) const;
362 wxCoord DeviceToLogicalY(wxCoord y) const;
363 wxCoord DeviceToLogicalXRel(wxCoord x) const;
364 wxCoord DeviceToLogicalYRel(wxCoord y) const;
365 wxCoord LogicalToDeviceX(wxCoord x) const;
366 wxCoord LogicalToDeviceY(wxCoord y) const;
367 wxCoord LogicalToDeviceXRel(wxCoord x) const;
368 wxCoord LogicalToDeviceYRel(wxCoord y) const;
370 // query DC capabilities
371 // ---------------------
373 virtual bool CanDrawBitmap() const;
374 virtual bool CanGetTextExtent() const;
377 virtual int GetDepth() const;
379 // Resolution in Pixels per inch
380 virtual wxSize GetPPI() const;
382 virtual bool Ok() const;
386 int GetBackgroundMode() const;
387 const wxBrush& GetBackground() const;
388 const wxBrush& GetBrush() const;
389 const wxFont& GetFont() const;
390 const wxPen& GetPen() const;
391 const wxColour& GetTextBackground() const;
392 const wxColour& GetTextForeground() const;
394 virtual void SetTextForeground(const wxColour& colour);
395 virtual void SetTextBackground(const wxColour& colour);
397 int GetMapMode() const;
398 virtual void SetMapMode(int mode);
402 virtual void, GetUserScale(double *OUTPUT, double *OUTPUT) const,
403 "GetUserScale() -> (xScale, yScale)");
405 virtual void SetUserScale(double x, double y);
409 virtual void, GetLogicalScale(double *OUTPUT, double *OUTPUT),
410 "GetLogicalScale() -> (xScale, yScale)");
412 virtual void SetLogicalScale(double x, double y);
415 wxPoint GetLogicalOrigin() const;
417 void, GetLogicalOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
418 "GetLogicalOriginTuple() -> (x,y)",
419 GetLogicalOriginTuple);
421 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
423 void SetLogicalOriginPoint(const wxPoint& point) {
424 self->SetLogicalOrigin(point.x, point.y);
429 wxPoint GetDeviceOrigin() const;
431 void, GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
432 "GetDeviceOriginTuple() -> (x,y)",
433 GetDeviceOriginTuple);
435 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
437 void SetDeviceOriginPoint(const wxPoint& point) {
438 self->SetDeviceOrigin(point.x, point.y);
442 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
444 int GetLogicalFunction() const;
445 virtual void SetLogicalFunction(int function);
447 virtual void SetOptimization(bool opt);
448 virtual bool GetOptimization();
454 virtual void CalcBoundingBox(wxCoord x, wxCoord y);
456 void CalcBoundingBoxPoint(const wxPoint& point) {
457 self->CalcBoundingBox(point.x, point.y);
461 void ResetBoundingBox();
463 // Get the final bounding box of the PostScript or Metafile picture.
464 wxCoord MinX() const;
465 wxCoord MaxX() const;
466 wxCoord MinY() const;
467 wxCoord MaxY() const;
471 "GetBoundingBox() -> (x1,y1, x2,y2)");
473 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
474 // See below for implementation
476 %pythoncode { def __nonzero__(self): return self.Ok() };
480 %extend { // See drawlist.cpp for impplementaion of these...
481 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
483 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
486 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
488 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
491 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
493 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
496 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
498 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
501 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
503 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
506 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
507 PyObject* foregroundList, PyObject* backgroundList) {
508 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
513 def DrawPointList(self, points, pens=None):
516 elif isinstance(pens, wx.Pen):
518 elif len(pens) != len(points):
519 raise ValueError('points and pens must have same length')
520 return self._DrawPointList(points, pens, [])
523 def DrawLineList(self, lines, pens=None):
526 elif isinstance(pens, wx.Pen):
528 elif len(pens) != len(lines):
529 raise ValueError('lines and pens must have same length')
530 return self._DrawLineList(lines, pens, [])
533 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
536 elif isinstance(pens, wx.Pen):
538 elif len(pens) != len(rectangles):
539 raise ValueError('rectangles and pens must have same length')
542 elif isinstance(brushes, wx.Brush):
544 elif len(brushes) != len(rectangles):
545 raise ValueError('rectangles and brushes must have same length')
546 return self._DrawRectangleList(rectangles, pens, brushes)
549 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
552 elif isinstance(pens, wx.Pen):
554 elif len(pens) != len(ellipses):
555 raise ValueError('ellipses and pens must have same length')
558 elif isinstance(brushes, wx.Brush):
560 elif len(brushes) != len(ellipses):
561 raise ValueError('ellipses and brushes must have same length')
562 return self._DrawEllipseList(ellipses, pens, brushes)
565 def DrawPolygonList(self, polygons, pens=None, brushes=None):
566 %## Note: This does not currently support fill style or offset
567 %## you can always use the non-List version if need be.
570 elif isinstance(pens, wx.Pen):
572 elif len(pens) != len(polygons):
573 raise ValueError('polygons and pens must have same length')
576 elif isinstance(brushes, wx.Brush):
578 elif len(brushes) != len(polygons):
579 raise ValueError('polygons and brushes must have same length')
580 return self._DrawPolygonList(polygons, pens, brushes)
583 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
584 %## NOTE: this does not currently support changing the font
585 %## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
586 %## If you want backgounds to do anything.
587 if type(textList) == type(''):
588 textList = [textList]
589 elif len(textList) != len(coords):
590 raise ValueError('textlist and coords must have same length')
591 if foregrounds is None:
593 elif isinstance(foregrounds, wx.Colour):
594 foregrounds = [foregrounds]
595 elif len(foregrounds) != len(coords):
596 raise ValueError('foregrounds and coords must have same length')
597 if backgrounds is None:
599 elif isinstance(backgrounds, wx.Colour):
600 backgrounds = [backgrounds]
601 elif len(backgrounds) != len(coords):
602 raise ValueError('backgrounds and coords must have same length')
603 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
611 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
620 //---------------------------------------------------------------------------
623 class wxMemoryDC : public wxDC {
626 %name(MemoryDCFromDC) wxMemoryDC(wxDC* oldDC);
628 void SelectObject(const wxBitmap& bitmap);
631 //---------------------------------------------------------------------------
636 #include <wx/dcbuffer.h>
640 class wxBufferedDC : public wxMemoryDC
643 %pythonAppend wxBufferedDC
644 "self._dc = args[0] # save a ref so the other dc will not be deleted before self";
646 %nokwargs wxBufferedDC;
648 // Construct a wxBufferedDC using a user supplied buffer.
649 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
651 // Construct a wxBufferedDC with an internal buffer of 'area'
652 // (where area is usually something like the size of the window
654 wxBufferedDC( wxDC *dc, const wxSize &area );
657 // TODO: Keep this one too?
658 %pythonAppend wxBufferedDC( wxDC *dc, const wxSize &area )
659 "val._dc = args[0] # save a ref so the other dc will not be deleted before self";
660 %name(BufferedDCInternalBuffer) wxBufferedDC( wxDC *dc, const wxSize &area );
663 // The buffer is blit to the real DC when the BufferedDC is destroyed.
667 // Blits the buffer to the dc, and detaches the dc from
668 // the buffer. Usually called in the dtor or by the dtor
669 // of derived classes if the BufferedDC must blit before
670 // the derived class (which may own the dc it's blitting
678 // Creates a double buffered wxPaintDC, optionally allowing the
679 // user to specify their own buffer to use.
680 class wxBufferedPaintDC : public wxBufferedDC
684 // If no bitmap is supplied by the user, a temporary one will be created.
685 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
690 //---------------------------------------------------------------------------
693 class wxScreenDC : public wxDC {
697 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
698 bool StartDrawingOnTop(wxRect* rect = NULL);
699 bool EndDrawingOnTop();
702 //---------------------------------------------------------------------------
705 class wxClientDC : public wxDC {
707 wxClientDC(wxWindow* win);
710 //---------------------------------------------------------------------------
713 class wxPaintDC : public wxDC {
715 wxPaintDC(wxWindow* win);
718 //---------------------------------------------------------------------------
721 class wxWindowDC : public wxDC {
723 wxWindowDC(wxWindow* win);
726 //---------------------------------------------------------------------------
729 class wxMirrorDC : public wxDC
732 // constructs a mirror DC associated with the given real DC
734 // if mirror parameter is True, all vertical and horizontal coordinates are
735 // exchanged, otherwise this class behaves in exactly the same way as a
738 wxMirrorDC(wxDC& dc, bool mirror);
741 //---------------------------------------------------------------------------
748 class wxPostScriptDC : public wxDC {
750 wxPostScriptDC(const wxPrintData& printData);
751 // %name(PostScriptDC2)wxPostScriptDC(const wxString& output,
752 // bool interactive = True,
753 // wxWindow* parent = NULL);
755 wxPrintData& GetPrintData();
756 void SetPrintData(const wxPrintData& data);
758 static void SetResolution(int ppi);
759 static int GetResolution();
762 //---------------------------------------------------------------------------
766 #if defined(__WXMSW__) || defined(__WXMAC__)
769 #include <wx/metafile.h>
772 class wxMetaFile : public wxObject {
774 wxMetaFile(const wxString& filename = wxPyEmptyString);
778 bool SetClipboard(int width = 0, int height = 0);
785 const wxString& GetFileName() const;
788 %pythoncode { def __nonzero__(self): return self.Ok() }
791 // bool wxMakeMetaFilePlaceable(const wxString& filename,
792 // int minX, int minY, int maxX, int maxY, float scale=1.0);
795 class wxMetaFileDC : public wxDC {
797 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
798 int width = 0, int height = 0,
799 const wxString& description = wxPyEmptyString);
805 #else // Make some dummies for the other platforms
808 class wxMetaFile : public wxObject {
810 wxMetaFile(const wxString&)
811 { wxPyRaiseNotImplemented(); }
814 class wxMetaFileDC : public wxClientDC {
816 wxMetaFileDC(const wxString&, int, int, const wxString&)
817 { wxPyRaiseNotImplemented(); }
822 class wxMetaFile : public wxObject {
824 wxMetaFile(const wxString& filename = wxPyEmptyString);
827 class wxMetaFileDC : public wxDC {
829 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
830 int width = 0, int height = 0,
831 const wxString& description = wxPyEmptyString);
838 //---------------------------------------------------------------------------
840 #if defined(__WXMSW__) || defined(__WXMAC__)
842 class wxPrinterDC : public wxDC {
844 wxPrinterDC(const wxPrintData& printData);
845 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
846 // const wxString& device,
847 // const wxString& output,
848 // bool interactive = True,
849 // int orientation = wxPORTRAIT);
854 class wxPrinterDC : public wxClientDC {
856 wxPrinterDC(const wxPrintData&)
857 { wxPyRaiseNotImplemented(); }
859 // wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
860 // { wxPyRaiseNotImplemented(); }
864 class wxPrinterDC : public wxDC {
866 wxPrinterDC(const wxPrintData& printData);
867 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
868 // const wxString& device,
869 // const wxString& output,
870 // bool interactive = True,
871 // int orientation = wxPORTRAIT);
875 //---------------------------------------------------------------------------
876 //---------------------------------------------------------------------------
878 // Now define some Python classes that rename the Draw methods to be
879 // compatible with the DC Draw methods in 2.4. See also wxPython/_wx.py.
884 %define MAKE_OLD_DC_CLASS(classname)
886 class classname##_old(classname):
887 """DC class that has methods with 2.4 compatible parameters."""
888 FloodFill = classname.FloodFillXY
889 GetPixel = classname.GetPixelXY
890 DrawLine = classname.DrawLineXY
891 CrossHair = classname.CrossHairXY
892 DrawArc = classname.DrawArcXY
893 DrawCheckMark = classname.DrawCheckMarkXY
894 DrawEllipticArc = classname.DrawEllipticArcXY
895 DrawPoint = classname.DrawPointXY
896 DrawRectangle = classname.DrawRectangleXY
897 DrawRoundedRectangle = classname.DrawRoundedRectangleXY
898 DrawCircle = classname.DrawCircleXY
899 DrawEllipse = classname.DrawEllipseXY
900 DrawIcon = classname.DrawIconXY
901 DrawBitmap = classname.DrawBitmapXY
902 DrawText = classname.DrawTextXY
903 DrawRotatedText = classname.DrawRotatedTextXY
904 Blit = classname.BlitXY
908 MAKE_OLD_DC_CLASS(DC);
909 MAKE_OLD_DC_CLASS(MemoryDC);
910 MAKE_OLD_DC_CLASS(BufferedDC);
911 MAKE_OLD_DC_CLASS(BufferedPaintDC);
912 MAKE_OLD_DC_CLASS(ScreenDC);
913 MAKE_OLD_DC_CLASS(ClientDC);
914 MAKE_OLD_DC_CLASS(PaintDC);
915 MAKE_OLD_DC_CLASS(WindowDC);
916 MAKE_OLD_DC_CLASS(MirrorDC);
917 MAKE_OLD_DC_CLASS(PostScriptDC);
918 MAKE_OLD_DC_CLASS(MetaFileDC);
919 MAKE_OLD_DC_CLASS(PrinterDC);
923 //---------------------------------------------------------------------------