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 defined(wxUSE_DC_OLD_METHODS)
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(DrawEllipticArcPtSz) 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(DrawRectanglePtSz) 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(DrawRoundedRectanglePtSz) 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(DrawEllipsePtSz) 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(BlitPtSz) 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);
133 %name(FloodFillXY) bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
134 bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
136 //%name(GetPixelXY) bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
137 //bool GetPixel(const wxPoint& pt, wxColour *col) const;
139 wxColour GetPixelXY(wxCoord x, wxCoord y) {
141 self->GetPixel(x, y, &col);
144 wxColour GetPixel(const wxPoint& pt) {
146 self->GetPixel(pt, &col);
151 %name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
152 void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
154 %name(CrossHairXY) void CrossHair(wxCoord x, wxCoord y);
155 void CrossHair(const wxPoint& pt);
157 %name(DrawArcXY) void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
158 void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
160 %name(DrawCheckMarkXY) void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
161 void DrawCheckMark(const wxRect& rect);
163 %name(DrawEllipticArcXY) void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
164 void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
166 %name(DrawPointXY) void DrawPoint(wxCoord x, wxCoord y);
167 void DrawPoint(const wxPoint& pt);
169 %name(DrawRectangleXY) void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
170 void DrawRectangle(const wxPoint& pt, const wxSize& sz);
171 %name(DrawRectangleRect) void DrawRectangle(const wxRect& rect);
173 %name(DrawRoundedRectangleXY) void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
174 void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
175 %name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
177 %name(DrawCircleXY) void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
178 void DrawCircle(const wxPoint& pt, wxCoord radius);
180 %name(DrawEllipseXY) void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
181 void DrawEllipse(const wxPoint& pt, const wxSize& sz);
182 %name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
184 %name(DrawIconXY) void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
185 void DrawIcon(const wxIcon& icon, const wxPoint& pt);
187 %name(DrawBitmapXY) void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
188 void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = False);
190 %name(DrawTextXY) void DrawText(const wxString& text, wxCoord x, wxCoord y);
191 void DrawText(const wxString& text, const wxPoint& pt);
193 %name(DrawRotatedTextXY) void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
194 void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
197 %name(BlitXY) bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
198 wxDC *source, wxCoord xsrc, wxCoord ysrc,
199 int rop = wxCOPY, bool useMask = False,
200 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
201 bool Blit(const wxPoint& destPt, const wxSize& sz,
202 wxDC *source, const wxPoint& srcPt,
203 int rop = wxCOPY, bool useMask = False,
204 const wxPoint& srcPtMask = wxDefaultPosition);
208 void DrawLines(int points, wxPoint* points_array, wxCoord xoffset = 0, wxCoord yoffset = 0);
210 void DrawPolygon(int points, wxPoint* points_array,
211 wxCoord xoffset = 0, wxCoord yoffset = 0,
212 int fillStyle = wxODDEVEN_RULE);
214 // TODO: Figure out a good typemap for this...
215 // Convert the first 3 args from a sequence of sequences?
216 // void DrawPolyPolygon(int n, int count[], wxPoint points[],
217 // wxCoord xoffset = 0, wxCoord yoffset = 0,
218 // int fillStyle = wxODDEVEN_RULE);
221 // this version puts both optional bitmap and the text into the given
222 // rectangle and aligns is as specified by alignment parameter; it also
223 // will emphasize the character with the given index if it is != -1 and
224 // return the bounding rectangle if required
225 void DrawLabel(const wxString& text, const wxRect& rect,
226 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
227 int indexAccel = -1);
229 wxRect DrawImageLabel(const wxString& text,
230 const wxBitmap& image,
232 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
233 int indexAccel = -1) {
235 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
242 void DrawSpline(int points, wxPoint* points_array);
246 // global DC operations
247 // --------------------
249 virtual void Clear();
251 virtual bool StartDoc(const wxString& message);
252 virtual void EndDoc();
254 virtual void StartPage();
255 virtual void EndPage();
258 // set objects to use for drawing
259 // ------------------------------
261 virtual void SetFont(const wxFont& font);
262 virtual void SetPen(const wxPen& pen);
263 virtual void SetBrush(const wxBrush& brush);
264 virtual void SetBackground(const wxBrush& brush);
265 virtual void SetBackgroundMode(int mode);
266 virtual void SetPalette(const wxPalette& palette);
272 %name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
273 void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
274 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
275 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
277 virtual void DestroyClippingRegion();
280 void, GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT) const,
281 "GetClippingBox() -> (x, y, width, height)");
284 wxRect GetClippingRect() {
286 self->GetClippingBox(rect);
296 virtual wxCoord GetCharHeight() const;
297 virtual wxCoord GetCharWidth() const;
301 void, GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT),
302 "GetTextExtent(wxString string) -> (width, height)",
303 "Get the width and height of the text using the current font.\n"
304 "Only works for single line strings.");
306 void, GetTextExtent(const wxString& string,
307 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
308 wxFont* font = NULL),
309 "GetFullTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
310 "Get the width, height, decent and leading of the text using the current or specified font.\n"
311 "Only works for single line strings.",
315 // works for single as well as multi-line strings
317 void, GetMultiLineTextExtent(const wxString& text,
318 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
319 wxFont *font = NULL),
320 "GetMultiLineTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
321 "Get the width, height, decent and leading of the text using the current or specified font.\n"
322 "Works for single as well as multi-line strings.");
326 wxArrayInt GetPartialTextExtents(const wxString& text) {
328 self->GetPartialTextExtents(text, widths);
334 // size and resolution
335 // -------------------
337 DocStr(GetSize, "Get the DC size in device units.");
340 void, GetSize( int *OUTPUT, int *OUTPUT ),
341 "GetSizeTuple() -> (width, height)",
345 DocStr(GetSizeMM, "Get the DC size in milimeters.");
346 wxSize GetSizeMM() const;
348 void, GetSizeMM( int *OUTPUT, int *OUTPUT ) const,
349 "GetSizeMMTuple() -> (width, height)",
354 // coordinates conversions
355 // -----------------------
357 // This group of functions does actual conversion of the input, as you'd
359 wxCoord DeviceToLogicalX(wxCoord x) const;
360 wxCoord DeviceToLogicalY(wxCoord y) const;
361 wxCoord DeviceToLogicalXRel(wxCoord x) const;
362 wxCoord DeviceToLogicalYRel(wxCoord y) const;
363 wxCoord LogicalToDeviceX(wxCoord x) const;
364 wxCoord LogicalToDeviceY(wxCoord y) const;
365 wxCoord LogicalToDeviceXRel(wxCoord x) const;
366 wxCoord LogicalToDeviceYRel(wxCoord y) const;
368 // query DC capabilities
369 // ---------------------
371 virtual bool CanDrawBitmap() const;
372 virtual bool CanGetTextExtent() const;
375 virtual int GetDepth() const;
377 // Resolution in Pixels per inch
378 virtual wxSize GetPPI() const;
380 virtual bool Ok() const;
384 int GetBackgroundMode() const;
385 const wxBrush& GetBackground() const;
386 const wxBrush& GetBrush() const;
387 const wxFont& GetFont() const;
388 const wxPen& GetPen() const;
389 const wxColour& GetTextBackground() const;
390 const wxColour& GetTextForeground() const;
392 virtual void SetTextForeground(const wxColour& colour);
393 virtual void SetTextBackground(const wxColour& colour);
395 int GetMapMode() const;
396 virtual void SetMapMode(int mode);
400 virtual void, GetUserScale(double *OUTPUT, double *OUTPUT) const,
401 "GetUserScale() -> (xScale, yScale)");
403 virtual void SetUserScale(double x, double y);
407 virtual void, GetLogicalScale(double *OUTPUT, double *OUTPUT),
408 "GetLogicalScale() -> (xScale, yScale)");
410 virtual void SetLogicalScale(double x, double y);
413 wxPoint GetLogicalOrigin() const;
415 void, GetLogicalOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
416 "GetLogicalOriginTuple() -> (x,y)",
417 GetLogicalOriginTuple);
419 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
422 wxPoint GetDeviceOrigin() const;
424 void, GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
425 "GetDeviceOriginTuple() -> (x,y)",
426 GetDeviceOriginTuple);
428 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
430 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
432 int GetLogicalFunction() const;
433 virtual void SetLogicalFunction(int function);
435 virtual void SetOptimization(bool opt);
436 virtual bool GetOptimization();
442 virtual void CalcBoundingBox(wxCoord x, wxCoord y);
443 void ResetBoundingBox();
445 // Get the final bounding box of the PostScript or Metafile picture.
446 wxCoord MinX() const;
447 wxCoord MaxX() const;
448 wxCoord MinY() const;
449 wxCoord MaxY() const;
453 "GetBoundingBox() -> (x1,y1, x2,y2)");
455 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
456 // See below for implementation
458 %pythoncode { def __nonzero__(self): return self.Ok() };
462 %extend { // See drawlist.cpp for impplementaion of these...
463 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
465 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
468 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
470 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
473 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
475 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
478 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
480 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
483 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
485 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
488 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
489 PyObject* foregroundList, PyObject* backgroundList) {
490 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
495 def DrawPointList(self, points, pens=None):
498 elif isinstance(pens, wx.Pen):
500 elif len(pens) != len(points):
501 raise ValueError('points and pens must have same length')
502 return self._DrawPointList(points, pens, [])
505 def DrawLineList(self, lines, pens=None):
508 elif isinstance(pens, wx.Pen):
510 elif len(pens) != len(lines):
511 raise ValueError('lines and pens must have same length')
512 return self._DrawLineList(lines, pens, [])
515 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
518 elif isinstance(pens, wx.Pen):
520 elif len(pens) != len(rectangles):
521 raise ValueError('rectangles and pens must have same length')
524 elif isinstance(brushes, wx.Brush):
526 elif len(brushes) != len(rectangles):
527 raise ValueError('rectangles and brushes must have same length')
528 return self._DrawRectangleList(rectangles, pens, brushes)
531 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
534 elif isinstance(pens, wx.Pen):
536 elif len(pens) != len(ellipses):
537 raise ValueError('ellipses and pens must have same length')
540 elif isinstance(brushes, wx.Brush):
542 elif len(brushes) != len(ellipses):
543 raise ValueError('ellipses and brushes must have same length')
544 return self._DrawEllipseList(ellipses, pens, brushes)
547 def DrawPolygonList(self, polygons, pens=None, brushes=None):
548 %## Note: This does not currently support fill style or offset
549 %## you can always use the non-List version if need be.
552 elif isinstance(pens, wx.Pen):
554 elif len(pens) != len(polygons):
555 raise ValueError('polygons and pens must have same length')
558 elif isinstance(brushes, wx.Brush):
560 elif len(brushes) != len(polygons):
561 raise ValueError('polygons and brushes must have same length')
562 return self._DrawPolygonList(polygons, pens, brushes)
565 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
566 %## NOTE: this does not currently support changing the font
567 %## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
568 %## If you want backgounds to do anything.
569 if type(textList) == type(''):
570 textList = [textList]
571 elif len(textList) != len(coords):
572 raise ValueError('textlist and coords must have same length')
573 if foregrounds is None:
575 elif isinstance(foregrounds, wx.Colour):
576 foregrounds = [foregrounds]
577 elif len(foregrounds) != len(coords):
578 raise ValueError('foregrounds and coords must have same length')
579 if backgrounds is None:
581 elif isinstance(backgrounds, wx.Colour):
582 backgrounds = [backgrounds]
583 elif len(backgrounds) != len(coords):
584 raise ValueError('backgrounds and coords must have same length')
585 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
593 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
602 //---------------------------------------------------------------------------
605 class wxMemoryDC : public wxDC {
608 %name(MemoryDCFromDC) wxMemoryDC(wxDC* oldDC);
610 void SelectObject(const wxBitmap& bitmap);
613 //---------------------------------------------------------------------------
618 #include <wx/dcbuffer.h>
622 class wxBufferedDC : public wxMemoryDC
625 %pythonAppend wxBufferedDC
626 "self._dc = args[0] # save a ref so the other dc will not be deleted before self";
628 %nokwargs wxBufferedDC;
630 // Construct a wxBufferedDC using a user supplied buffer.
631 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
633 // Construct a wxBufferedDC with an internal buffer of 'area'
634 // (where area is usually something like the size of the window
636 wxBufferedDC( wxDC *dc, const wxSize &area );
639 // TODO: Keep this one too?
640 %pythonAppend wxBufferedDC( wxDC *dc, const wxSize &area )
641 "val._dc = args[0] # save a ref so the other dc will not be deleted before self";
642 %name(BufferedDCInternalBuffer) wxBufferedDC( wxDC *dc, const wxSize &area );
645 // The buffer is blit to the real DC when the BufferedDC is destroyed.
649 // Blits the buffer to the dc, and detaches the dc from
650 // the buffer. Usually called in the dtor or by the dtor
651 // of derived classes if the BufferedDC must blit before
652 // the derived class (which may own the dc it's blitting
660 // Creates a double buffered wxPaintDC, optionally allowing the
661 // user to specify their own buffer to use.
662 class wxBufferedPaintDC : public wxBufferedDC
666 // If no bitmap is supplied by the user, a temporary one will be created.
667 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
672 //---------------------------------------------------------------------------
675 class wxScreenDC : public wxDC {
679 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
680 bool StartDrawingOnTop(wxRect* rect = NULL);
681 bool EndDrawingOnTop();
684 //---------------------------------------------------------------------------
687 class wxClientDC : public wxDC {
689 wxClientDC(wxWindow* win);
692 //---------------------------------------------------------------------------
695 class wxPaintDC : public wxDC {
697 wxPaintDC(wxWindow* win);
700 //---------------------------------------------------------------------------
703 class wxWindowDC : public wxDC {
705 wxWindowDC(wxWindow* win);
708 //---------------------------------------------------------------------------
711 class wxMirrorDC : public wxDC
714 // constructs a mirror DC associated with the given real DC
716 // if mirror parameter is True, all vertical and horizontal coordinates are
717 // exchanged, otherwise this class behaves in exactly the same way as a
720 wxMirrorDC(wxDC& dc, bool mirror);
723 //---------------------------------------------------------------------------
730 class wxPostScriptDC : public wxDC {
732 wxPostScriptDC(const wxPrintData& printData);
733 // %name(PostScriptDC2)wxPostScriptDC(const wxString& output,
734 // bool interactive = True,
735 // wxWindow* parent = NULL);
737 wxPrintData& GetPrintData();
738 void SetPrintData(const wxPrintData& data);
740 static void SetResolution(int ppi);
741 static int GetResolution();
744 //---------------------------------------------------------------------------
748 #if defined(__WXMSW__) || defined(__WXMAC__)
751 #include <wx/metafile.h>
754 class wxMetaFile : public wxObject {
756 wxMetaFile(const wxString& filename = wxPyEmptyString);
760 bool SetClipboard(int width = 0, int height = 0);
767 const wxString& GetFileName() const;
770 %pythoncode { def __nonzero__(self): return self.Ok() }
773 // bool wxMakeMetaFilePlaceable(const wxString& filename,
774 // int minX, int minY, int maxX, int maxY, float scale=1.0);
777 class wxMetaFileDC : public wxDC {
779 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
780 int width = 0, int height = 0,
781 const wxString& description = wxPyEmptyString);
787 #else // Make some dummies for the other platforms
790 class wxMetaFile : public wxObject {
792 wxMetaFile(const wxString&)
793 { wxPyRaiseNotImplemented(); }
796 class wxMetaFileDC : public wxClientDC {
798 wxMetaFileDC(const wxString&, int, int, const wxString&)
799 { wxPyRaiseNotImplemented(); }
804 class wxMetaFile : public wxObject {
806 wxMetaFile(const wxString& filename = wxPyEmptyString);
809 class wxMetaFileDC : public wxDC {
811 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
812 int width = 0, int height = 0,
813 const wxString& description = wxPyEmptyString);
820 //---------------------------------------------------------------------------
822 #if defined(__WXMSW__) || defined(__WXMAC__)
824 class wxPrinterDC : public wxDC {
826 wxPrinterDC(const wxPrintData& printData);
827 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
828 // const wxString& device,
829 // const wxString& output,
830 // bool interactive = True,
831 // int orientation = wxPORTRAIT);
836 class wxPrinterDC : public wxClientDC {
838 wxPrinterDC(const wxPrintData&)
839 { wxPyRaiseNotImplemented(); }
841 // wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
842 // { wxPyRaiseNotImplemented(); }
846 class wxPrinterDC : public wxDC {
848 wxPrinterDC(const wxPrintData& printData);
849 // %name(PrinterDC2) wxPrinterDC(const wxString& driver,
850 // const wxString& device,
851 // const wxString& output,
852 // bool interactive = True,
853 // int orientation = wxPORTRAIT);
857 //---------------------------------------------------------------------------
858 //---------------------------------------------------------------------------
860 // Now define some Python classes that rename the Draw methods to be
861 // compatible with the DC Draw methods in 2.4. See also wxPython/_wx.py.
864 %define MAKE_OLD_DC_CLASS(classname)
866 class classname##_old(classname):
867 """DC class that has methods with 2.4 compatible parameters."""
868 FloodFill = classname.FloodFillXY
869 GetPixel = classname.GetPixelXY
870 DrawLine = classname.DrawLineXY
871 CrossHair = classname.CrossHairXY
872 DrawArc = classname.DrawArcXY
873 DrawCheckMark = classname.DrawCheckMarkXY
874 DrawEllipticArc = classname.DrawEllipticArcXY
875 DrawPoint = classname.DrawPointXY
876 DrawRectangle = classname.DrawRectangleXY
877 DrawRoundedRectangle = classname.DrawRoundedRectangleXY
878 DrawCircle = classname.DrawCircleXY
879 DrawEllipse = classname.DrawEllipseXY
880 DrawIcon = classname.DrawIconXY
881 DrawBitmap = classname.DrawBitmapXY
882 DrawText = classname.DrawTextXY
883 DrawRotatedText = classname.DrawRotatedTextXY
884 Blit = classname.BlitXY
888 MAKE_OLD_DC_CLASS(DC);
889 MAKE_OLD_DC_CLASS(MemoryDC);
890 MAKE_OLD_DC_CLASS(BufferedDC);
891 MAKE_OLD_DC_CLASS(BufferedPaintDC);
892 MAKE_OLD_DC_CLASS(ScreenDC);
893 MAKE_OLD_DC_CLASS(ClientDC);
894 MAKE_OLD_DC_CLASS(PaintDC);
895 MAKE_OLD_DC_CLASS(WindowDC);
896 MAKE_OLD_DC_CLASS(MirrorDC);
897 MAKE_OLD_DC_CLASS(PostScriptDC);
898 MAKE_OLD_DC_CLASS(MetaFileDC);
899 MAKE_OLD_DC_CLASS(PrinterDC);
902 //---------------------------------------------------------------------------