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 //---------------------------------------------------------------------------
 
  42 "A wx.DC is a device context onto which graphics and text can be
 
  43 drawn. It is intended to represent a number of output devices in a
 
  44 generic way, so a window can have a device context associated with it,
 
  45 and a printer also has a device context. In this way, the same piece
 
  46 of code may write to a number of different devices, if the device
 
  47 context is used as a parameter.
 
  49 Derived types of wxDC have documentation for specific features only,
 
  50 so refer to this section for most device context information.
 
  52 The wx.DC class is abstract and can not be instantiated, you must use
 
  53 one of the derived classes instead.  Which one will depend on the
 
  54 situation in which it is used.", "");
 
  56 class wxDC : public wxObject {
 
  58 //    wxDC(); **** abstract base class, can't instantiate.
 
  63         virtual void , BeginDrawing(),
 
  64         "Allows for optimization of drawing code on platforms that need it.  On
 
  65 other platforms this is just an empty function and is harmless.  To
 
  66 take advantage of this postential optimization simply enclose each
 
  67 group of calls to the drawing primitives within calls to
 
  68 `BeginDrawing` and `EndDrawing`.", "");
 
  71         virtual void , EndDrawing(),
 
  72         "Ends the group of drawing primitives started with `BeginDrawing`, and
 
  73 invokes whatever optimization is available for this DC type on the
 
  74 current platform.", "");
 
  78 // TODO    virtual void DrawObject(wxDrawObject* drawobject);
 
  83         "Flood fills the device context starting from the given point, using
 
  84 the current brush colour, and using a style:
 
  86     - **wxFLOOD_SURFACE**: the flooding occurs until a colour other than
 
  87       the given colour is encountered.
 
  89     - **wxFLOOD_BORDER**: the area to be flooded is bounded by the given
 
  92 Returns False if the operation failed.
 
  94 Note: The present implementation for non-Windows platforms may fail to
 
  95 find colour borders if the pixels do not match the colour
 
  96 exactly. However the function will still return true.", "");
 
  97     bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
 
  98     %name(FloodFillPoint) bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
 
 103         "Gets the colour at the specified location on the DC.","");
 
 105         wxColour GetPixel(wxCoord x, wxCoord y) {
 
 107             self->GetPixel(x, y, &col);
 
 110         wxColour GetPixelPoint(const wxPoint& pt) {
 
 112             self->GetPixel(pt, &col);
 
 120         "Draws a line from the first point to the second. The current pen is
 
 121 used for drawing the line. Note that the second point is *not* part of
 
 122 the line and is not drawn by this function (this is consistent with
 
 123 the behaviour of many other toolkits).", "");
 
 124     void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
 
 125     %name(DrawLinePoint) void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
 
 130         "Displays a cross hair using the current pen. This is a vertical and
 
 131 horizontal line the height and width of the window, centred on the
 
 133     void CrossHair(wxCoord x, wxCoord y);
 
 134     %name(CrossHairPoint) void CrossHair(const wxPoint& pt);
 
 139         "Draws an arc of a circle, centred on the *center* point (xc, yc), from
 
 140 the first point to the second. The current pen is used for the outline
 
 141 and the current brush for filling the shape.
 
 143 The arc is drawn in an anticlockwise direction from the start point to
 
 144 the end point.", "");
 
 145     void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
 
 146     %name(DrawArcPoint) void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& center);
 
 151         "Draws a check mark inside the given rectangle.", "");
 
 152     void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
 153     %name(DrawCheckMarkRect) void DrawCheckMark(const wxRect& rect);
 
 157         "Draws an arc of an ellipse, with the given rectangle defining the
 
 158 bounds of the ellipse. The current pen is used for drawing the arc and
 
 159 the current brush is used for drawing the pie.
 
 161 The *start* and *end* parameters specify the start and end of the arc
 
 162 relative to the three-o'clock position from the center of the
 
 163 rectangle. Angles are specified in degrees (360 is a complete
 
 164 circle). Positive values mean counter-clockwise motion. If start is
 
 165 equal to end, a complete ellipse will be drawn.", "");
 
 166     void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double start, double end);
 
 167     %name(DrawEllipticArcPointSize) void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double start, double end);
 
 172         "Draws a point using the current pen.", "");
 
 173     void DrawPoint(wxCoord x, wxCoord y);
 
 174     %name(DrawPointPoint) void DrawPoint(const wxPoint& pt);
 
 179         "Draws a rectangle with the given top left corner, and with the given
 
 180 size. The current pen is used for the outline and the current brush
 
 181 for filling the shape.", "");
 
 182     void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
 183     %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
 
 184     %name(DrawRectanglePointSize) void DrawRectangle(const wxPoint& pt, const wxSize& sz);
 
 188         DrawRoundedRectangle,
 
 189         "Draws a rectangle with the given top left corner, and with the given
 
 190 size. The corners are quarter-circles using the given radius. The
 
 191 current pen is used for the outline and the current brush for filling
 
 194 If radius is positive, the value is assumed to be the radius of the
 
 195 rounded corner. If radius is negative, the absolute value is assumed
 
 196 to be the proportion of the smallest dimension of the rectangle. This
 
 197 means that the corner can be a sensible size relative to the size of
 
 198 the rectangle, and also avoids the strange effects X produces when the
 
 199 corners are too big for the rectangle.", "");
 
 200     void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
 
 201     %name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
 
 202     %name(DrawRoundedRectanglePointSize) void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
 
 207         "Draws a circle with the given center point and radius.  The current
 
 208 pen is used for the outline and the current brush for filling the
 
 211 :see: `DrawEllipse`");
 
 212     void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
 
 213     %name(DrawCirclePoint) void DrawCircle(const wxPoint& pt, wxCoord radius);
 
 218         "Draws an ellipse contained in the specified rectangle. The current pen
 
 219 is used for the outline and the current brush for filling the shape.", "
 
 221 :see: `DrawCircle`");
 
 222     void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
 223     %name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
 
 224     %name(DrawEllipsePointSize) void DrawEllipse(const wxPoint& pt, const wxSize& sz);
 
 229         "Draw an icon on the display (does nothing if the device context is
 
 230 PostScript). This can be the simplest way of drawing bitmaps on a
 
 232     void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
 
 233     %name(DrawIconPoint) void DrawIcon(const wxIcon& icon, const wxPoint& pt);
 
 238         "Draw a bitmap on the device context at the specified point. If
 
 239 *transparent* is true and the bitmap has a transparency mask, (or
 
 240 alpha channel on the platforms that support it) then the bitmap will
 
 241 be drawn transparently.", "
 
 243 When drawing a mono-bitmap, the current text foreground colour will be
 
 244 used to draw the foreground of the bitmap (all bits set to 1), and the
 
 245 current text background colour to draw the background (all bits set to
 
 248 :see: `SetTextForeground`, `SetTextBackground` and `wx.MemoryDC`");
 
 249     void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = false);
 
 250     %name(DrawBitmapPoint) void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = false);
 
 255         "Draws a text string at the specified point, using the current text
 
 256 font, and the current text foreground and background colours.
 
 258 The coordinates refer to the top-left corner of the rectangle bounding
 
 259 the string. See `GetTextExtent` for how to get the dimensions of a
 
 260 text string, which can be used to position the text more precisely.
 
 262 **NOTE**: under wxGTK the current logical function is used by this
 
 263 function but it is ignored by wxMSW. Thus, you should avoid using
 
 264 logical functions with this function in portable programs.", "
 
 266 :see: `DrawRotatedText`");
 
 267     void DrawText(const wxString& text, wxCoord x, wxCoord y);
 
 268     %name(DrawTextPoint) void DrawText(const wxString& text, const wxPoint& pt);
 
 273         "Draws the text rotated by *angle* degrees, if supported by the platform.
 
 275 **NOTE**: Under Win9x only TrueType fonts can be drawn by this
 
 276 function. In particular, a font different from ``wx.NORMAL_FONT``
 
 277 should be used as the it is not normally a TrueType
 
 278 font. ``wx.SWISS_FONT`` is an example of a font which is.","
 
 281     void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
 
 282     %name(DrawRotatedTextPoint) void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
 
 286         bool , Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
 
 287                     wxDC *source, wxCoord xsrc, wxCoord ysrc,
 
 288                     int rop = wxCOPY, bool useMask = false,
 
 289                     wxCoord xsrcMask = -1, wxCoord ysrcMask = -1),
 
 290         "Copy from a source DC to this DC.  Parameters specify the destination
 
 291 coordinates, size of area to copy, source DC, source coordinates,
 
 292 logical function, whether to use a bitmap mask, and mask source
 
 295     :param xdest:       Destination device context x position.
 
 296     :param ydest:       Destination device context y position.
 
 297     :param width:       Width of source area to be copied.
 
 298     :param height:      Height of source area to be copied.
 
 299     :param source:      Source device context.
 
 300     :param xsrc:        Source device context x position.
 
 301     :param ysrc:        Source device context y position.
 
 302     :param rop:         Logical function to use: see `SetLogicalFunction`.
 
 303     :param useMask:     If true, Blit does a transparent blit using the mask
 
 304                         that is associated with the bitmap selected into the
 
 305                         source device context.
 
 306     :param xsrcMask:    Source x position on the mask. If both xsrcMask and
 
 307                         ysrcMask are -1, xsrc and ysrc will be assumed for
 
 308                         the mask source position.
 
 309     :param ysrcMask:    Source y position on the mask. 
 
 313         bool , Blit(const wxPoint& destPt, const wxSize& sz,
 
 314                     wxDC *source, const wxPoint& srcPt,
 
 315                     int rop = wxCOPY, bool useMask = false,
 
 316                     const wxPoint& srcPtMask = wxDefaultPosition),
 
 317         "Copy from a source DC to this DC.  Parameters specify the destination
 
 318 coordinates, size of area to copy, source DC, source coordinates,
 
 319 logical function, whether to use a bitmap mask, and mask source
 
 322     :param destPt:      Destination device context position.
 
 323     :param sz:          Size of source area to be copied.
 
 324     :param source:      Source device context.
 
 325     :param srcPt:       Source device context position.
 
 326     :param rop:         Logical function to use: see `SetLogicalFunction`.
 
 327     :param useMask:     If true, Blit does a transparent blit using the mask
 
 328                         that is associated with the bitmap selected into the
 
 329                         source device context.
 
 330     :param srcPtMask:   Source position on the mask. 
 
 337         "Sets the clipping region for this device context to the intersection
 
 338 of the given region described by the parameters of this method and the
 
 339 previously set clipping region. You should call `DestroyClippingRegion`
 
 340 if you want to set the clipping region exactly to the region
 
 343 The clipping region is an area to which drawing is
 
 344 restricted. Possible uses for the clipping region are for clipping
 
 345 text or for speeding up window redraws when only a known area of the
 
 346 screen is damaged.", "
 
 348 :see: `DestroyClippingRegion`, `wx.Region`");
 
 349     void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
 
 350     %name(SetClippingRegionPointSize) void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
 
 351     %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
 
 352     %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
 
 357         void , DrawLines(int points, wxPoint* points_array,
 
 358                          wxCoord xoffset = 0, wxCoord yoffset = 0),
 
 359         "DrawLines(self, List points, int xoffset=0, int yoffset=0)",
 
 360         "Draws lines using a sequence of `wx.Point` objects, adding the
 
 361 optional offset coordinate. The current pen is used for drawing the
 
 366         void , DrawPolygon(int points, wxPoint* points_array,
 
 367                      wxCoord xoffset = 0, wxCoord yoffset = 0,
 
 368                            int fillStyle = wxODDEVEN_RULE),
 
 369         "DrawPolygon(self, List points, int xoffset=0, int yoffset=0,
 
 370     int fillStyle=ODDEVEN_RULE)",
 
 371         "Draws a filled polygon using a sequence of `wx.Point` objects, adding
 
 372 the optional offset coordinate.  The last argument specifies the fill
 
 373 rule: ``wx.ODDEVEN_RULE`` (the default) or ``wx.WINDING_RULE``.
 
 375 The current pen is used for drawing the outline, and the current brush
 
 376 for filling the shape. Using a transparent brush suppresses
 
 377 filling. Note that wxWidgets automatically closes the first and last
 
 381     // TODO:  Figure out a good typemap for this...
 
 382     //        Convert the first 3 args from a sequence of sequences?
 
 383 //     void DrawPolyPolygon(int n, int count[], wxPoint points[],
 
 384 //                           wxCoord xoffset = 0, wxCoord yoffset = 0,
 
 385 //                           int fillStyle = wxODDEVEN_RULE);
 
 389         void , DrawLabel(const wxString& text, const wxRect& rect,
 
 390                          int alignment = wxALIGN_LEFT | wxALIGN_TOP,
 
 391                          int indexAccel = -1),
 
 392         "Draw *text* within the specified rectangle, abiding by the alignment
 
 393 flags.  Will additionally emphasize the character at *indexAccel* if
 
 396 :see: `DrawImageLabel`");
 
 400         DocStr(DrawImageLabel,
 
 401                "Draw *text* and an image (which may be ``wx.NullBitmap`` to skip
 
 402 drawing it) within the specified rectangle, abiding by the alignment
 
 403 flags.  Will additionally emphasize the character at *indexAccel* if
 
 404 it is not -1.  Returns the bounding rectangle.", "");
 
 405         wxRect DrawImageLabel(const wxString& text,
 
 406                               const wxBitmap& image,
 
 408                               int alignment = wxALIGN_LEFT | wxALIGN_TOP,
 
 409                               int indexAccel = -1) {
 
 411             self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
 
 419         void , DrawSpline(int points, wxPoint* points_array),
 
 420         "DrawSpline(self, List points)",
 
 421         "Draws a spline between all given control points, (a list of `wx.Point`
 
 422 objects) using the current pen. The spline is drawn using a series of
 
 423 lines, using an algorithm taken from the X drawing program 'XFIG'.", "");
 
 428     // global DC operations
 
 429     // --------------------
 
 432         virtual void , Clear(),
 
 433         "Clears the device context using the current background brush.", "");
 
 437         virtual bool , StartDoc(const wxString& message),
 
 438         "Starts a document (only relevant when outputting to a
 
 439 printer). *Message* is a message to show whilst printing.", "");
 
 442         virtual void , EndDoc(),
 
 443         "Ends a document (only relevant when outputting to a printer).", "");
 
 447         virtual void , StartPage(),
 
 448         "Starts a document page (only relevant when outputting to a printer).", "");
 
 451         virtual void , EndPage(),
 
 452         "Ends a document page (only relevant when outputting to a printer).", "");
 
 456     // set objects to use for drawing
 
 457     // ------------------------------
 
 460         virtual void , SetFont(const wxFont& font),
 
 461         "Sets the current font for the DC. It must be a valid font, in
 
 462 particular you should not pass ``wx.NullFont`` to this method.","
 
 467         virtual void , SetPen(const wxPen& pen),
 
 468         "Sets the current pen for the DC.
 
 470 If the argument is ``wx.NullPen``, the current pen is selected out of the
 
 471 device context, and the original pen restored.", "
 
 476         virtual void , SetBrush(const wxBrush& brush),
 
 477         "Sets the current brush for the DC.
 
 479 If the argument is ``wx.NullBrush``, the current brush is selected out
 
 480 of the device context, and the original brush restored, allowing the
 
 481 current brush to be destroyed safely.","
 
 486         virtual void , SetBackground(const wxBrush& brush),
 
 487         "Sets the current background brush for the DC.", "");
 
 490         virtual void , SetBackgroundMode(int mode),
 
 491         "*mode* may be one of ``wx.SOLID`` and ``wx.TRANSPARENT``. This setting
 
 492 determines whether text will be drawn with a background colour or
 
 496         virtual void , SetPalette(const wxPalette& palette),
 
 497         "If this is a window DC or memory DC, assigns the given palette to the
 
 498 window or bitmap associated with the DC. If the argument is
 
 499 ``wx.NullPalette``, the current palette is selected out of the device
 
 500 context, and the original palette restored.", "
 
 502 :see: `wx.Palette`");
 
 507         virtual void , DestroyClippingRegion(),
 
 508         "Destroys the current clipping region so that none of the DC is
 
 511 :see: `SetClippingRegion`");
 
 515         void, GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT) const,
 
 516         "GetClippingBox() -> (x, y, width, height)",
 
 517         "Gets the rectangle surrounding the current clipping region.", "");
 
 522             "Gets the rectangle surrounding the current clipping region.", "");
 
 523         wxRect GetClippingRect() {
 
 525             self->GetClippingBox(rect);
 
 536         virtual wxCoord , GetCharHeight() const,
 
 537         "Gets the character height of the currently set font.", "");
 
 540         virtual wxCoord , GetCharWidth() const,
 
 541         "Gets the average character width of the currently set font.", "");
 
 546         void, GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT),
 
 547         "GetTextExtent(wxString string) -> (width, height)",
 
 548         "Get the width and height of the text using the current font. Only
 
 549 works for single line strings.", "");
 
 552         void, GetTextExtent(const wxString& string,
 
 553                             wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
 
 554                             wxFont* font = NULL),
 
 555         "GetFullTextExtent(wxString string, Font font=None) ->\n   (width, height, descent, externalLeading)",
 
 556         "Get the width, height, decent and leading of the text using the
 
 557 current or specified font. Only works for single line strings.", "",
 
 561     // works for single as well as multi-line strings
 
 563         void, GetMultiLineTextExtent(const wxString& text,
 
 564                                      wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
 
 565                                      wxFont *font = NULL),
 
 566         "GetMultiLineTextExtent(wxString string, Font font=None) ->\n   (width, height, descent, externalLeading)",
 
 567         "Get the width, height, decent and leading of the text using the
 
 568 current or specified font. Works for single as well as multi-line
 
 573         DocAStr(GetPartialTextExtents,
 
 574                 "GetPartialTextExtents(self, text) -> [widths]",
 
 575                 "Returns a list of integers such that each value is the distance in
 
 576 pixels from the begining of text to the coresponding character of
 
 577 *text*. The generic version simply builds a running total of the widths
 
 578 of each character using GetTextExtent, however if the various
 
 579 platforms have a native API function that is faster or more accurate
 
 580 than the generic implementaiton then it will be used instead.", "");
 
 581         wxArrayInt GetPartialTextExtents(const wxString& text) {
 
 583             self->GetPartialTextExtents(text, widths);
 
 589     // size and resolution
 
 590     // -------------------
 
 594         "This gets the horizontal and vertical resolution in device units. It
 
 595 can be used to scale graphics to fit the page. For example, if *maxX*
 
 596 and *maxY* represent the maximum horizontal and vertical 'pixel' values
 
 597 used in your application, the following code will scale the graphic to
 
 598 fit on the printer page::
 
 601       scaleX = maxX*1.0 / w
 
 602       scaleY = maxY*1.0 / h
 
 603       dc.SetUserScale(min(scaleX,scaleY),min(scaleX,scaleY))
 
 607         void, GetSize( int *OUTPUT, int *OUTPUT ),
 
 608         "GetSizeTuple() -> (width, height)",
 
 612     DocStr(GetSizeMM, "Get the DC size in milimeters.", "");
 
 613     wxSize GetSizeMM() const;
 
 615         void, GetSizeMM( int *OUTPUT, int *OUTPUT ) const,
 
 616         "GetSizeMMTuple() -> (width, height)",
 
 621     // coordinates conversions
 
 622     // -----------------------
 
 625         wxCoord , DeviceToLogicalX(wxCoord x) const,
 
 626         "Convert device X coordinate to logical coordinate, using the current
 
 630         wxCoord , DeviceToLogicalY(wxCoord y) const,
 
 631         "Converts device Y coordinate to logical coordinate, using the current
 
 635         wxCoord , DeviceToLogicalXRel(wxCoord x) const,
 
 636         "Convert device X coordinate to relative logical coordinate, using the
 
 637 current mapping mode but ignoring the x axis orientation. Use this
 
 638 function for converting a width, for example.", "");
 
 641         wxCoord , DeviceToLogicalYRel(wxCoord y) const,
 
 642         "Convert device Y coordinate to relative logical coordinate, using the
 
 643 current mapping mode but ignoring the y axis orientation. Use this
 
 644 function for converting a height, for example.", "");
 
 647         wxCoord , LogicalToDeviceX(wxCoord x) const,
 
 648         "Converts logical X coordinate to device coordinate, using the current
 
 652         wxCoord , LogicalToDeviceY(wxCoord y) const,
 
 653         "Converts logical Y coordinate to device coordinate, using the current
 
 657         wxCoord , LogicalToDeviceXRel(wxCoord x) const,
 
 658         "Converts logical X coordinate to relative device coordinate, using the
 
 659 current mapping mode but ignoring the x axis orientation. Use this for
 
 660 converting a width, for example.", "");
 
 663         wxCoord , LogicalToDeviceYRel(wxCoord y) const,
 
 664         "Converts logical Y coordinate to relative device coordinate, using the
 
 665 current mapping mode but ignoring the y axis orientation. Use this for
 
 666 converting a height, for example.", "");
 
 670     // query DC capabilities
 
 671     // ---------------------
 
 673     virtual bool CanDrawBitmap() const;
 
 674     virtual bool CanGetTextExtent() const;
 
 678         virtual int , GetDepth() const,
 
 679         "Returns the colour depth of the DC.", "");
 
 683         virtual wxSize , GetPPI() const,
 
 684         "Resolution in Pixels per inch", "");
 
 688         virtual bool , Ok() const,
 
 689         "Returns true if the DC is ok to use.", "");
 
 694         int , GetBackgroundMode() const,
 
 695         "Returns the current background mode, either ``wx.SOLID`` or
 
 696 ``wx.TRANSPARENT``.","
 
 698 :see: `SetBackgroundMode`");
 
 701         const wxBrush&  , GetBackground() const,
 
 702         "Gets the brush used for painting the background.","
 
 704 :see: `SetBackground`");
 
 707         const wxBrush&  , GetBrush() const,
 
 708         "Gets the current brush", "");
 
 711         const wxFont&   , GetFont() const,
 
 712         "Gets the current font", "");
 
 715         const wxPen&    , GetPen() const,
 
 716         "Gets the current pen", "");
 
 719         const wxColour& , GetTextBackground() const,
 
 720         "Gets the current text background colour", "");
 
 723         const wxColour& , GetTextForeground() const,
 
 724         "Gets the current text foreground colour", "");
 
 728         virtual void , SetTextForeground(const wxColour& colour),
 
 729         "Sets the current text foreground colour for the DC.", "");
 
 732         virtual void , SetTextBackground(const wxColour& colour),
 
 733         "Sets the current text background colour for the DC.", "");
 
 737         int , GetMapMode() const,
 
 738         "Gets the current *mapping mode* for the device context ", "");
 
 741         virtual void , SetMapMode(int mode),
 
 742         "The *mapping mode* of the device context defines the unit of
 
 743 measurement used to convert logical units to device units.  The
 
 744 mapping mode can be one of the following:
 
 746     ================    =============================================
 
 747     wx.MM_TWIPS         Each logical unit is 1/20 of a point, or 1/1440
 
 749     wx.MM_POINTS        Each logical unit is a point, or 1/72 of an inch.
 
 750     wx.MM_METRIC        Each logical unit is 1 mm.
 
 751     wx.MM_LOMETRIC      Each logical unit is 1/10 of a mm.
 
 752     wx.MM_TEXT          Each logical unit is 1 pixel.
 
 753     ================    =============================================
 
 755 Note that in X, text drawing isn't handled consistently with the
 
 756 mapping mode; a font is always specified in point size. However,
 
 757 setting the user scale (see `SetUserScale`) scales the text
 
 758 appropriately. In Windows, scalable TrueType fonts are always used; in
 
 759 X, results depend on availability of fonts, but usually a reasonable
 
 762 The coordinate origin is always at the top left of the screen/printer.
 
 764 Drawing to a Windows printer device context uses the current mapping
 
 765 mode, but mapping mode is currently ignored for PostScript output.
 
 771         virtual void, GetUserScale(double *OUTPUT, double *OUTPUT) const,
 
 772         "GetUserScale(self) -> (xScale, yScale)",
 
 773         "Gets the current user scale factor (set by `SetUserScale`).", "");
 
 776         virtual void , SetUserScale(double x, double y),
 
 777         "Sets the user scaling factor, useful for applications which require
 
 783         virtual void, GetLogicalScale(double *OUTPUT, double *OUTPUT),
 
 784         "GetLogicalScale() -> (xScale, yScale)");
 
 786     virtual void SetLogicalScale(double x, double y);
 
 789     wxPoint GetLogicalOrigin() const;
 
 791         void, GetLogicalOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
 
 792         "GetLogicalOriginTuple() -> (x,y)",
 
 793         GetLogicalOriginTuple);
 
 795     virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
 
 797         void SetLogicalOriginPoint(const wxPoint& point) {
 
 798             self->SetLogicalOrigin(point.x, point.y);
 
 803     wxPoint GetDeviceOrigin() const;
 
 805         void, GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
 
 806         "GetDeviceOriginTuple() -> (x,y)",
 
 807         GetDeviceOriginTuple);
 
 809     virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
 
 811         void SetDeviceOriginPoint(const wxPoint& point) {
 
 812             self->SetDeviceOrigin(point.x, point.y);
 
 817         virtual void , SetAxisOrientation(bool xLeftRight, bool yBottomUp),
 
 818         "Sets the x and y axis orientation (i.e., the direction from lowest to
 
 819 highest values on the axis). The default orientation is the natural
 
 820 orientation, e.g. x axis from left to right and y axis from bottom up.", "");
 
 824         int , GetLogicalFunction() const,
 
 825         "Gets the current logical function (set by `SetLogicalFunction`).", "");
 
 828         virtual void , SetLogicalFunction(int function),
 
 829         "Sets the current logical function for the device context. This
 
 830 determines how a source pixel (from a pen or brush colour, or source
 
 831 device context if using `Blit`) combines with a destination pixel in
 
 832 the current device context.
 
 834 The possible values and their meaning in terms of source and
 
 835 destination pixel values are as follows:
 
 837     ================       ==========================
 
 839     wx.AND_INVERT          (NOT src) AND dst
 
 840     wx.AND_REVERSE         src AND (NOT dst)
 
 843     wx.EQUIV               (NOT src) XOR dst
 
 845     wx.NAND                (NOT src) OR (NOT dst)
 
 846     wx.NOR                 (NOT src) AND (NOT dst)
 
 849     wx.OR_INVERT           (NOT src) OR dst
 
 850     wx.OR_REVERSE          src OR (NOT dst)
 
 852     wx.SRC_INVERT          NOT src
 
 854     ================       ==========================
 
 856 The default is wx.COPY, which simply draws with the current
 
 857 colour. The others combine the current colour and the background using
 
 858 a logical operation. wx.INVERT is commonly used for drawing rubber
 
 859 bands or moving outlines, since drawing twice reverts to the original
 
 865         void , ComputeScaleAndOrigin(),
 
 866         "Performs all necessary computations for given platform and context
 
 867 type after each change of scale and origin parameters. Usually called
 
 868 automatically internally after such changes.
 
 874 //         virtual void , SetOptimization(bool optimize),
 
 875 //         "If *optimize* is true this function sets optimization mode on. This
 
 876 // currently means that under X, the device context will not try to set a
 
 877 // pen or brush property if it is known to be set already. This approach
 
 878 // can fall down if non-wxWidgets code is using the same device context
 
 879 // or window, for example when the window is a panel on which the
 
 880 // windowing system draws panel items. The wxWidgets device context
 
 881 // 'memory' will now be out of step with reality.
 
 883 // Setting optimization off, drawing, then setting it back on again, is a
 
 884 // trick that must occasionally be employed.", "");
 
 887 //         virtual bool , GetOptimization(),
 
 888 //         "Returns true if device context optimization is on. See
 
 889 // `SetOptimization` for details.", "");
 
 892         def SetOptimization(self, optimize):
 
 894         def GetOptimization(self):
 
 897         SetOptimization = wx._deprecated(SetOptimization)
 
 898         GetOptimization = wx._deprecated(GetOptimization)
 
 906         virtual void , CalcBoundingBox(wxCoord x, wxCoord y),
 
 907         "Adds the specified point to the bounding box which can be retrieved
 
 908 with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions.", "");
 
 911         DocStr(CalcBoundingBoxPoint,
 
 912                "Adds the specified point to the bounding box which can be retrieved
 
 913 with `MinX`, `MaxX` and `MinY`, `MaxY` or `GetBoundingBox` functions.","");
 
 914         void CalcBoundingBoxPoint(const wxPoint& point) {
 
 915             self->CalcBoundingBox(point.x, point.y);
 
 920         void , ResetBoundingBox(),
 
 921         "Resets the bounding box: after a call to this function, the bounding
 
 922 box doesn't contain anything.", "");
 
 925     // Get the final bounding box of the PostScript or Metafile picture.
 
 927         wxCoord , MinX() const,
 
 928         "Gets the minimum horizontal extent used in drawing commands so far.", "");
 
 931         wxCoord , MaxX() const,
 
 932         "Gets the maximum horizontal extent used in drawing commands so far.", "");
 
 935         wxCoord , MinY() const,
 
 936         "Gets the minimum vertical extent used in drawing commands so far.", "");
 
 939         wxCoord , MaxY() const,
 
 940         "Gets the maximum vertical extent used in drawing commands so far.", "");
 
 944     DocAStr(GetBoundingBox,
 
 945             "GetBoundingBox() -> (x1,y1, x2,y2)",
 
 946             "Returns the min and max points used in drawing commands so far.", "");
 
 948         void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
 
 949         // See below for implementation
 
 952     %pythoncode { def __nonzero__(self): return self.Ok() };
 
 960     %extend { // See drawlist.cpp for impplementaion of these...
 
 961         PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
 
 963             return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
 
 966         PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
 
 968             return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
 
 971         PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
 
 973             return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
 
 976         PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
 
 978             return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
 
 981         PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
 
 983             return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
 
 986         PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
 
 987                                 PyObject* foregroundList, PyObject* backgroundList) {
 
 988             return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
 
 993     def DrawPointList(self, points, pens=None):
 
 995         Draw a list of points as quickly as possible.
 
 997             :param points:  A sequence of 2-element sequences representing
 
 998                             each point to draw, (x,y).
 
 999             :param pens:    If None, then the current pen is used.  If a
 
1000                             single pen then it will be used for all points.  If
 
1001                             a list of pens then there should be one for each point
 
1006         elif isinstance(pens, wx.Pen):
 
1008         elif len(pens) != len(points):
 
1009            raise ValueError('points and pens must have same length')
 
1010         return self._DrawPointList(points, pens, [])
 
1013     def DrawLineList(self, lines, pens=None):
 
1015         Draw a list of lines as quickly as possible.
 
1017             :param lines:  A sequence of 4-element sequences representing
 
1018                             each line to draw, (x1,y1, x2,y2).
 
1019             :param pens:    If None, then the current pen is used.  If a
 
1020                             single pen then it will be used for all lines.  If
 
1021                             a list of pens then there should be one for each line
 
1026         elif isinstance(pens, wx.Pen):
 
1028         elif len(pens) != len(lines):
 
1029            raise ValueError('lines and pens must have same length')
 
1030         return self._DrawLineList(lines, pens, [])
 
1033     def DrawRectangleList(self, rectangles, pens=None, brushes=None):
 
1035         Draw a list of rectangles as quickly as possible.
 
1037             :param rectangles:  A sequence of 4-element sequences representing
 
1038                             each rectangle to draw, (x,y, w,h).
 
1039             :param pens:    If None, then the current pen is used.  If a
 
1040                             single pen then it will be used for all rectangles.
 
1041                             If a list of pens then there should be one for each 
 
1042                             rectangle in rectangles.
 
1043             :param brushes: A brush or brushes to be used to fill the rectagles,
 
1044                             with similar semantics as the pens parameter.
 
1048         elif isinstance(pens, wx.Pen):
 
1050         elif len(pens) != len(rectangles):
 
1051            raise ValueError('rectangles and pens must have same length')
 
1054         elif isinstance(brushes, wx.Brush):
 
1056         elif len(brushes) != len(rectangles):
 
1057            raise ValueError('rectangles and brushes must have same length')
 
1058         return self._DrawRectangleList(rectangles, pens, brushes)
 
1061     def DrawEllipseList(self, ellipses, pens=None, brushes=None):
 
1063         Draw a list of ellipses as quickly as possible.
 
1065             :param ellipses: A sequence of 4-element sequences representing
 
1066                             each ellipse to draw, (x,y, w,h).
 
1067             :param pens:    If None, then the current pen is used.  If a
 
1068                             single pen then it will be used for all ellipses.
 
1069                             If a list of pens then there should be one for each 
 
1070                             ellipse in ellipses.
 
1071             :param brushes: A brush or brushes to be used to fill the ellipses,
 
1072                             with similar semantics as the pens parameter.
 
1076         elif isinstance(pens, wx.Pen):
 
1078         elif len(pens) != len(ellipses):
 
1079            raise ValueError('ellipses and pens must have same length')
 
1082         elif isinstance(brushes, wx.Brush):
 
1084         elif len(brushes) != len(ellipses):
 
1085            raise ValueError('ellipses and brushes must have same length')
 
1086         return self._DrawEllipseList(ellipses, pens, brushes)
 
1089     def DrawPolygonList(self, polygons, pens=None, brushes=None):
 
1091         Draw a list of polygons, each of which is a list of points.
 
1093             :param polygons: A sequence of sequences of sequences.
 
1094                              [[(x1,y1),(x2,y2),(x3,y3)...],
 
1095                              [(x1,y1),(x2,y2),(x3,y3)...]]
 
1097             :param pens:    If None, then the current pen is used.  If a
 
1098                             single pen then it will be used for all polygons.
 
1099                             If a list of pens then there should be one for each 
 
1101             :param brushes: A brush or brushes to be used to fill the polygons,
 
1102                             with similar semantics as the pens parameter.
 
1106         elif isinstance(pens, wx.Pen):
 
1108         elif len(pens) != len(polygons):
 
1109            raise ValueError('polygons and pens must have same length')
 
1112         elif isinstance(brushes, wx.Brush):
 
1114         elif len(brushes) != len(polygons):
 
1115            raise ValueError('polygons and brushes must have same length')
 
1116         return self._DrawPolygonList(polygons, pens, brushes)
 
1119     def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None):
 
1121         Draw a list of strings using a list of coordinants for positioning each string.
 
1123             :param textList:    A list of strings
 
1124             :param coords:      A list of (x,y) positions
 
1125             :param foregrounds: A list of `wx.Colour` objects to use for the
 
1126                                 foregrounds of the strings.
 
1127             :param backgrounds: A list of `wx.Colour` objects to use for the
 
1128                                 backgrounds of the strings.
 
1130         NOTE: Make sure you set Background mode to wx.Solid (DC.SetBackgroundMode)
 
1131               If you want backgrounds to do anything.
 
1133         if type(textList) == type(''):
 
1134            textList = [textList]
 
1135         elif len(textList) != len(coords):
 
1136            raise ValueError('textlist and coords must have same length')
 
1137         if foregrounds is None:
 
1139         elif isinstance(foregrounds, wx.Colour):
 
1140            foregrounds = [foregrounds]
 
1141         elif len(foregrounds) != len(coords):
 
1142            raise ValueError('foregrounds and coords must have same length')
 
1143         if backgrounds is None:
 
1145         elif isinstance(backgrounds, wx.Colour):
 
1146            backgrounds = [backgrounds]
 
1147         elif len(backgrounds) != len(coords):
 
1148            raise ValueError('backgrounds and coords must have same length')
 
1149         return  self._DrawTextList(textList, coords, foregrounds, backgrounds)
 
1157 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
 
1166 //---------------------------------------------------------------------------
 
1169 MustHaveApp(wxMemoryDC);
 
1172 "A memory device context provides a means to draw graphics onto a
 
1173 bitmap. A bitmap must be selected into the new memory DC before it may
 
1174 be used for anything. Typical usage is as follows::
 
1177     dc.SelectObject(bitmap)
 
1178     # draw on the dc usign any of the Draw methods
 
1179     dc.SelectObject(wx.NullBitmap)
 
1180     # the bitmap now contains wahtever was drawn upon it
 
1182 Note that the memory DC *must* be deleted (or the bitmap selected out
 
1183 of it) before a bitmap can be reselected into another memory DC.
 
1186 class wxMemoryDC : public wxDC {
 
1190         "Constructs a new memory device context.
 
1192 Use the Ok member to test whether the constructor was successful in
 
1193 creating a usable device context. Don't forget to select a bitmap into
 
1194 the DC before drawing on it.", "
 
1196 :see: `MemoryDCFromDC`");
 
1199         wxMemoryDC(wxDC* oldDC),
 
1200         "Creates a DC that is compatible with the oldDC.", "",
 
1205         void , SelectObject(const wxBitmap& bitmap),
 
1206         "Selects the bitmap into the device context, to use as the memory
 
1207 bitmap. Selecting the bitmap into a memory DC allows you to draw into
 
1208 the DC, and therefore the bitmap, and also to use Blit to copy the
 
1211 If the argument is wx.NullBitmap (or some other uninitialised
 
1212 `wx.Bitmap`) the current bitmap is selected out of the device context,
 
1213 and the original bitmap restored, allowing the current bitmap to be
 
1214 destroyed safely.", "");
 
1218 //---------------------------------------------------------------------------
 
1223 #include <wx/dcbuffer.h>
 
1227 MustHaveApp(wxBufferedDC);
 
1229 DocStr(wxBufferedDC,
 
1230 "This simple class provides a simple way to avoid flicker: when drawing
 
1231 on it, everything is in fact first drawn on an in-memory buffer (a
 
1232 `wx.Bitmap`) and then copied to the screen only once, when this object
 
1235 It can be used in the same way as any other device
 
1236 context. wx.BufferedDC itself typically replaces `wx.ClientDC`, if you
 
1237 want to use it in your EVT_PAINT handler, you should look at
 
1238 `wx.BufferedPaintDC`.
 
1241 class wxBufferedDC : public wxMemoryDC
 
1244     %pythonAppend wxBufferedDC
 
1245         "self.__dc = args[0] # save a ref so the other dc will not be deleted before self";
 
1246     %nokwargs wxBufferedDC;
 
1250         "Constructs a buffered DC.", "
 
1252     :param dc: The underlying DC: everything drawn to this object will
 
1253         be flushed to this DC when this object is destroyed. You may
 
1254         pass ``None`` in order to just initialize the buffer, and not
 
1257     :param buffer: If a `wx.Size` object is passed as the 2nd arg then
 
1258         it is the size of the bitmap that will be created internally
 
1259         and used for an implicit buffer. If the 2nd arg is a
 
1260         `wx.Bitmap` then it is the explicit buffer that will be
 
1261         used. Using an explicit buffer is the most efficient solution
 
1262         as the bitmap doesn't have to be recreated each time but it
 
1263         also requires more memory as the bitmap is never freed. The
 
1264         bitmap should have appropriate size, anything drawn outside of
 
1265         its bounds is clipped.
 
1267     wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
 
1268     wxBufferedDC( wxDC *dc, const wxSize &area );
 
1272 //     // TODO: Keep this one too?
 
1273 //     %pythonAppend wxBufferedDC( wxDC *dc, const wxSize &area )
 
1274 //         "val.__dc = args[0] # save a ref so the other dc will not be deleted before self";
 
1275 //     %name(BufferedDCInternalBuffer) wxBufferedDC( wxDC *dc, const wxSize &area );
 
1278     // The buffer is blit to the real DC when the BufferedDC is destroyed.
 
1281         "Copies everything drawn on the DC so far to the underlying DC
 
1282 associated with this object, if any.", "");
 
1287         "Blits the buffer to the dc, and detaches the dc from the buffer (so it
 
1288 can be effectively used once only).  This is usually only called in
 
1289 the destructor.", "");
 
1296 MustHaveApp(wxBufferedPaintDC);
 
1298 DocStr(wxBufferedPaintDC,
 
1299 "This is a subclass of `wx.BufferedDC` which can be used inside of an
 
1300 EVT_PAINT event handler. Just create an object of this class instead
 
1301 of `wx.PaintDC` and that's all you have to do to (mostly) avoid
 
1302 flicker. The only thing to watch out for is that if you are using this
 
1303 class together with `wx.ScrolledWindow`, you probably do **not** want
 
1304 to call `wx.Window.PrepareDC` on it as it already does this internally
 
1305 for the real underlying `wx.PaintDC`.
 
1307 If your window is already fully buffered in a `wx.Bitmap` then your
 
1308 EVT_PAINT handler can be as simple as just creating a
 
1309 ``wx.BufferedPaintDC`` as it will `Blit` the buffer to the window
 
1310 automatically when it is destroyed.  For example::
 
1312     def OnPaint(self, event):
 
1313         dc = wx.BufferedPaintDC(self, self.buffer)
 
1318 class wxBufferedPaintDC : public wxBufferedDC
 
1323         wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap ),
 
1324         "Create a buffered paint DC.  As with `wx.BufferedDC`, you may either
 
1325 provide the bitmap to be used for buffering or let this object create
 
1326 one internally (in the latter case, the size of the client part of the
 
1327 window is automatically used).
 
1334 //---------------------------------------------------------------------------
 
1337 MustHaveApp(wxScreenDC);
 
1340 "A wxScreenDC can be used to paint anywhere on the screen. This should
 
1341 normally be constructed as a temporary stack object; don't store a
 
1344 class wxScreenDC : public wxDC {
 
1349         bool , StartDrawingOnTop(wxWindow* window),
 
1350         "Specify that the area of the screen to be drawn upon coincides with
 
1353 :see: `EndDrawingOnTop`", "",
 
1354         StartDrawingOnTopWin);
 
1358         bool , StartDrawingOnTop(wxRect* rect = NULL),
 
1359         "Specify that the area is the given rectangle, or the whole screen if
 
1362 :see: `EndDrawingOnTop`", "");
 
1366         bool , EndDrawingOnTop(),
 
1367         "Use this in conjunction with `StartDrawingOnTop` or
 
1368 `StartDrawingOnTopWin` to ensure that drawing to the screen occurs on
 
1369 top of existing windows. Without this, some window systems (such as X)
 
1370 only allow drawing to take place underneath other windows.
 
1372 You might use this pair of functions when implementing a drag feature,
 
1373 for example as in the `wx.SplitterWindow` implementation.
 
1375 These functions are probably obsolete since the X implementations
 
1376 allow drawing directly on the screen now. However, the fact that this
 
1377 function allows the screen to be refreshed afterwards may be useful
 
1378 to some applications.", "");
 
1382 //---------------------------------------------------------------------------
 
1385 MustHaveApp(wxClientDC);
 
1388 "A wx.ClientDC must be constructed if an application wishes to paint on
 
1389 the client area of a window from outside an EVT_PAINT event. This should
 
1390 normally be constructed as a temporary stack object; don't store a
 
1391 wx.ClientDC object long term.
 
1393 To draw on a window from within an EVT_PAINT handler, construct a
 
1394 `wx.PaintDC` object.
 
1396 To draw on the whole window including decorations, construct a
 
1397 `wx.WindowDC` object (Windows only).
 
1399 class wxClientDC : public wxDC {
 
1402         wxClientDC(wxWindow* win),
 
1403         "Constructor. Pass the window on which you wish to paint.", "");
 
1406 //---------------------------------------------------------------------------
 
1409 MustHaveApp(wxPaintDC);
 
1412 "A wx.PaintDC must be constructed if an application wishes to paint on
 
1413 the client area of a window from within an EVT_PAINT event
 
1414 handler. This should normally be constructed as a temporary stack
 
1415 object; don't store a wx.PaintDC object. If you have an EVT_PAINT
 
1416 handler, you **must** create a wx.PaintDC object within it even if you
 
1417 don't actually use it.
 
1419 Using wx.PaintDC within EVT_PAINT handlers is important because it
 
1420 automatically sets the clipping area to the damaged area of the
 
1421 window. Attempts to draw outside this area do not appear.
 
1423 To draw on a window from outside EVT_PAINT handlers, construct a
 
1424 `wx.ClientDC` object.
 
1426 class wxPaintDC : public wxDC {
 
1429         wxPaintDC(wxWindow* win),
 
1430         "Constructor. Pass the window on which you wish to paint.", "");
 
1433 //---------------------------------------------------------------------------
 
1436 MustHaveApp(wxWindowDC);
 
1439        "A wx.WindowDC must be constructed if an application wishes to paint on
 
1440 the whole area of a window (client and decorations). This should
 
1441 normally be constructed as a temporary stack object; don't store a
 
1442 wx.WindowDC object.","");
 
1443 class wxWindowDC : public wxDC {
 
1446         wxWindowDC(wxWindow* win),
 
1447         "Constructor. Pass the window on which you wish to paint.","");
 
1450 //---------------------------------------------------------------------------
 
1453 MustHaveApp(wxMirrorDC);
 
1456 "wx.MirrorDC is a simple wrapper class which is always associated with a
 
1457 real `wx.DC` object and either forwards all of its operations to it
 
1458 without changes (no mirroring takes place) or exchanges x and y
 
1459 coordinates which makes it possible to reuse the same code to draw a
 
1460 figure and its mirror -- i.e. reflection related to the diagonal line
 
1462 class wxMirrorDC : public wxDC
 
1466         wxMirrorDC(wxDC& dc, bool mirror),
 
1467         "Creates a mirrored DC associated with the real *dc*.  Everything drawn
 
1468 on the wx.MirrorDC will appear on the *dc*, and will be mirrored if
 
1469 *mirror* is True.","");
 
1472 //---------------------------------------------------------------------------
 
1476 #include <wx/dcps.h>
 
1479 MustHaveApp(wxPostScriptDC);
 
1481 DocStr(wxPostScriptDC,
 
1482 "This is a `wx.DC` that can write to PostScript files on any platform.","");
 
1484 class wxPostScriptDC : public wxDC {
 
1487         wxPostScriptDC(const wxPrintData& printData),
 
1488         "Constructs a PostScript printer device context from a `wx.PrintData`
 
1491     wxPrintData& GetPrintData();
 
1492     void SetPrintData(const wxPrintData& data);
 
1495         static void , SetResolution(int ppi),
 
1496         "Set resolution (in pixels per inch) that will be used in PostScript
 
1497 output. Default is 720ppi.", "");
 
1500         static int , GetResolution(),
 
1501         "Return resolution used in PostScript output.", "");
 
1504 //---------------------------------------------------------------------------
 
1508 MustHaveApp(wxMetaFile);
 
1509 MustHaveApp(wxMetaFileDC);
 
1512 #if defined(__WXMSW__) || defined(__WXMAC__)
 
1515 #include <wx/metafile.h>
 
1518 class wxMetaFile : public wxObject {
 
1520     wxMetaFile(const wxString& filename = wxPyEmptyString);
 
1524     bool SetClipboard(int width = 0, int height = 0);
 
1531     const wxString& GetFileName() const;
 
1534     %pythoncode { def __nonzero__(self): return self.Ok() }
 
1537 // bool wxMakeMetaFilePlaceable(const wxString& filename,
 
1538 //                              int minX, int minY, int maxX, int maxY, float scale=1.0);
 
1541 class wxMetaFileDC : public wxDC {
 
1543     wxMetaFileDC(const wxString& filename = wxPyEmptyString,
 
1544                  int width = 0, int height = 0,
 
1545                  const wxString& description = wxPyEmptyString);
 
1546     wxMetaFile* Close();
 
1551 #else  // Make some dummies for the other platforms
 
1554 class wxMetaFile : public wxObject {
 
1556     wxMetaFile(const wxString&)
 
1557         { wxPyRaiseNotImplemented(); }
 
1560 class wxMetaFileDC : public wxClientDC {
 
1562     wxMetaFileDC(const wxString&, int, int, const wxString&)
 
1563         { wxPyRaiseNotImplemented(); }
 
1568 class wxMetaFile : public wxObject {
 
1570     wxMetaFile(const wxString& filename = wxPyEmptyString);
 
1573 class wxMetaFileDC : public wxDC {
 
1575     wxMetaFileDC(const wxString& filename = wxPyEmptyString,
 
1576                  int width = 0, int height = 0,
 
1577                  const wxString& description = wxPyEmptyString);
 
1584 //---------------------------------------------------------------------------
 
1586 MustHaveApp(wxPrinterDC);
 
1588 #if defined(__WXMSW__) || defined(__WXMAC__)
 
1590 class  wxPrinterDC : public wxDC {
 
1592     wxPrinterDC(const wxPrintData& printData);
 
1593 //     %name(PrinterDC2) wxPrinterDC(const wxString& driver,
 
1594 //                                     const wxString& device,
 
1595 //                                     const wxString& output,
 
1596 //                                     bool interactive = true,
 
1597 //                                     int orientation = wxPORTRAIT);
 
1602 class  wxPrinterDC : public wxClientDC {
 
1604     wxPrinterDC(const wxPrintData&)
 
1605         { wxPyRaiseNotImplemented(); }
 
1607 //     wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
 
1608 //         { wxPyRaiseNotImplemented(); }
 
1612 class  wxPrinterDC : public wxDC {
 
1614     wxPrinterDC(const wxPrintData& printData);
 
1615 //     %name(PrinterDC2) wxPrinterDC(const wxString& driver,
 
1616 //                                     const wxString& device,
 
1617 //                                     const wxString& output,
 
1618 //                                     bool interactive = true,
 
1619 //                                     int orientation = wxPORTRAIT);
 
1623 //---------------------------------------------------------------------------
 
1624 //---------------------------------------------------------------------------