1 ///////////////////////////////////////////////////////////////////////////// 
   4 // Author:      Vadim Zeitlin 
   8 // Copyright:   (c) wxWidgets team 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #ifndef _WX_DC_H_BASE_ 
  13 #define _WX_DC_H_BASE_ 
  15 // ---------------------------------------------------------------------------- 
  16 // headers which we must include here 
  17 // ---------------------------------------------------------------------------- 
  19 #include "wx/object.h"          // the base class 
  21 #include "wx/intl.h"            // for wxLayoutDirection 
  22 #include "wx/cursor.h"          // we have member variables of these classes 
  23 #include "wx/font.h"            // so we can't do without them 
  24 #include "wx/colour.h" 
  25 #include "wx/bitmap.h"          // for wxNullBitmap 
  28 #include "wx/palette.h" 
  29 #include "wx/dynarray.h" 
  33   // 1 if using the reorganized DC code 
  34 #define wxUSE_NEW_DC 0 
  38 class WXDLLIMPEXP_FWD_CORE wxDC
; 
  39 class WXDLLIMPEXP_FWD_CORE wxClientDC
; 
  40 class WXDLLIMPEXP_FWD_CORE wxPaintDC
; 
  41 class WXDLLIMPEXP_FWD_CORE wxWindowDC
; 
  42 class WXDLLIMPEXP_FWD_CORE wxScreenDC
; 
  43 class WXDLLIMPEXP_FWD_CORE wxMemoryDC
; 
  45 class WXDLLIMPEXP_FWD_CORE wxDCBase
; 
  48 class WXDLLEXPORT wxDrawObject
 
  53         : m_isBBoxValid(false) 
  54         , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) 
  57     virtual ~wxDrawObject() { } 
  60     virtual void Draw(wxDC
&) const { } 
  62     virtual void Draw(wxDCBase
&) const { } 
  65     virtual void CalcBoundingBox(wxCoord x
, wxCoord y
) 
  69          if ( x 
< m_minX 
) m_minX 
= x
; 
  70          if ( y 
< m_minY 
) m_minY 
= y
; 
  71          if ( x 
> m_maxX 
) m_maxX 
= x
; 
  72          if ( y 
> m_maxY 
) m_maxY 
= y
; 
  85     void ResetBoundingBox() 
  87         m_isBBoxValid 
= false; 
  89         m_minX 
= m_maxX 
= m_minY 
= m_maxY 
= 0; 
  92     // Get the final bounding box of the PostScript or Metafile picture. 
  94     wxCoord 
MinX() const { return m_minX
; } 
  95     wxCoord 
MaxX() const { return m_maxX
; } 
  96     wxCoord 
MinY() const { return m_minY
; } 
  97     wxCoord 
MaxY() const { return m_maxY
; } 
  99     //to define the type of object for derived objects 
 100     virtual int GetType()=0; 
 103     //for boundingbox calculation 
 104     bool m_isBBoxValid
:1; 
 105     //for boundingbox calculation 
 106     wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
; 
 112 //----------------------------------------------------------------------------- 
 114 //----------------------------------------------------------------------------- 
 116 class WXDLLIMPEXP_FWD_CORE wxImplDC
; 
 118 class WXDLLIMPEXP_CORE wxDCFactory
 
 122     virtual ~wxDCFactory() {} 
 124     virtual wxImplDC
* CreateWindowDC( wxWindowDC 
*owner 
) = 0; 
 125     virtual wxImplDC
* CreateWindowDC( wxWindowDC 
*owner
, wxWindow 
*window 
) = 0; 
 126     virtual wxImplDC
* CreateClientDC( wxClientDC 
*owner 
) = 0; 
 127     virtual wxImplDC
* CreateClientDC( wxClientDC 
*owner
, wxWindow 
*window 
) = 0; 
 128     virtual wxImplDC
* CreatePaintDC( wxPaintDC 
*owner 
) = 0; 
 129     virtual wxImplDC
* CreatePaintDC( wxPaintDC 
*owner
, wxWindow 
*window 
) = 0; 
 130     virtual wxImplDC
* CreateMemoryDC( wxMemoryDC 
*owner 
) = 0; 
 131     virtual wxImplDC
* CreateMemoryDC( wxMemoryDC 
*owner
, wxBitmap 
&bitmap 
) = 0; 
 132     virtual wxImplDC
* CreateMemoryDC( wxMemoryDC 
*owner
, wxDC 
*dc 
) = 0; 
 133     virtual wxImplDC
* CreateScreenDC( wxScreenDC 
*owner 
) = 0; 
 135     static void SetDCFactory( wxDCFactory 
*factory 
); 
 136     static wxDCFactory 
*GetFactory(); 
 138     static wxDCFactory 
*m_factory
; 
 141 //----------------------------------------------------------------------------- 
 143 //----------------------------------------------------------------------------- 
 145 class WXDLLIMPEXP_CORE wxNativeDCFactory
: public wxDCFactory
 
 148     wxNativeDCFactory() {} 
 150     virtual wxImplDC
* CreateWindowDC( wxWindowDC 
*owner 
); 
 151     virtual wxImplDC
* CreateWindowDC( wxWindowDC 
*owner
, wxWindow 
*window 
); 
 152     virtual wxImplDC
* CreateClientDC( wxClientDC 
*owner 
); 
 153     virtual wxImplDC
* CreateClientDC( wxClientDC 
*owner
, wxWindow 
*window 
); 
 154     virtual wxImplDC
* CreatePaintDC( wxPaintDC 
*owner 
); 
 155     virtual wxImplDC
* CreatePaintDC( wxPaintDC 
*owner
, wxWindow 
*window 
); 
 156     virtual wxImplDC
* CreateMemoryDC( wxMemoryDC 
*owner 
); 
 157     virtual wxImplDC
* CreateMemoryDC( wxMemoryDC 
*owner
, wxBitmap 
&bitmap 
); 
 158     virtual wxImplDC
* CreateMemoryDC( wxMemoryDC 
*owner
, wxDC 
*dc 
); 
 159     virtual wxImplDC
* CreateScreenDC( wxScreenDC 
*owner 
); 
 162 //----------------------------------------------------------------------------- 
 164 //----------------------------------------------------------------------------- 
 166 class WXDLLIMPEXP_CORE wxImplDC
: public wxObject
 
 169     wxImplDC( wxDC 
*owner 
); 
 172     wxDC 
*GetOwner() const { return m_owner
; } 
 174     virtual bool IsOk() const { return m_ok
; } 
 176     // query capabilities 
 178     virtual bool CanDrawBitmap() const = 0; 
 179     virtual bool CanGetTextExtent() const = 0; 
 181     // query dimension, colour deps, resolution 
 183     virtual void DoGetSize(int *width
, int *height
) const = 0; 
 184     virtual void DoGetSizeMM(int* width
, int* height
) const = 0; 
 186     virtual int GetDepth() const = 0; 
 187     virtual wxSize 
GetPPI() const = 0; 
 189     // Right-To-Left (RTL) modes 
 191     virtual void SetLayoutDirection(wxLayoutDirection 
WXUNUSED(dir
)) { } 
 192     virtual wxLayoutDirection 
GetLayoutDirection() const  { return wxLayout_Default
; } 
 196     virtual bool StartDoc(const wxString
& WXUNUSED(message
)) { return true; } 
 197     virtual void EndDoc() { } 
 199     virtual void StartPage() { } 
 200     virtual void EndPage() { } 
 204     virtual void CalcBoundingBox(wxCoord x
, wxCoord y
) 
 208          if ( x 
< m_minX 
) m_minX 
= x
; 
 209          if ( y 
< m_minY 
) m_minY 
= y
; 
 210          if ( x 
> m_maxX 
) m_maxX 
= x
; 
 211          if ( y 
> m_maxY 
) m_maxY 
= y
; 
 215          m_isBBoxValid 
= true; 
 223     void ResetBoundingBox() 
 225         m_isBBoxValid 
= false; 
 227         m_minX 
= m_maxX 
= m_minY 
= m_maxY 
= 0; 
 230     wxCoord 
MinX() const { return m_minX
; } 
 231     wxCoord 
MaxX() const { return m_maxX
; } 
 232     wxCoord 
MinY() const { return m_minY
; } 
 233     wxCoord 
MaxY() const { return m_maxY
; } 
 235     // setters and getters 
 237     virtual void SetFont(const wxFont
& font
) = 0; 
 238     virtual const wxFont
&   GetFont() const { return m_font
; } 
 240     virtual void SetPen(const wxPen
& pen
) = 0; 
 241     virtual const wxPen
&    GetPen() const { return m_pen
; } 
 243     virtual void SetBrush(const wxBrush
& brush
) = 0; 
 244     virtual const wxBrush
&  GetBrush() const { return m_brush
; } 
 246     virtual void SetBackground(const wxBrush
& brush
) = 0; 
 247     virtual const wxBrush
&  GetBackground() const { return m_backgroundBrush
; } 
 249     virtual void SetBackgroundMode(int mode
) = 0; 
 250     virtual int GetBackgroundMode() const { return m_backgroundMode
; } 
 252     virtual void SetTextForeground(const wxColour
& colour
) 
 253         { m_textForegroundColour 
= colour
; } 
 254     virtual const wxColour
& GetTextForeground() const { return m_textForegroundColour
; } 
 256     virtual void SetTextBackground(const wxColour
& colour
) 
 257         { m_textBackgroundColour 
= colour
; } 
 258     virtual const wxColour
& GetTextBackground() const { return m_textBackgroundColour
; } 
 261     virtual void SetPalette(const wxPalette
& palette
) = 0; 
 262 #endif // wxUSE_PALETTE 
 266     virtual void SetLogicalFunction(int function
) = 0; 
 267     virtual int GetLogicalFunction() const { return m_logicalFunction
; } 
 271     virtual wxCoord 
GetCharHeight() const = 0; 
 272     virtual wxCoord 
GetCharWidth() const = 0; 
 273     virtual void DoGetTextExtent(const wxString
& string
, 
 274                                  wxCoord 
*x
, wxCoord 
*y
, 
 275                                  wxCoord 
*descent 
= NULL
, 
 276                                  wxCoord 
*externalLeading 
= NULL
, 
 277                                  const wxFont 
*theFont 
= NULL
) const = 0; 
 278     virtual void GetMultiLineTextExtent(const wxString
& string
, 
 281                                         wxCoord 
*heightLine 
= NULL
, 
 282                                         const wxFont 
*font 
= NULL
) const; 
 283     virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const; 
 287     virtual void Clear() = 0; 
 291     virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, 
 292                                      wxCoord width
, wxCoord height
) = 0; 
 293     virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
) = 0; 
 295     virtual void DoGetClippingBox(wxCoord 
*x
, wxCoord 
*y
, 
 296                                   wxCoord 
*w
, wxCoord 
*h
) const 
 303             *w 
= m_clipX2 
- m_clipX1
; 
 305             *h 
= m_clipY2 
- m_clipY1
; 
 308     virtual void DestroyClippingRegion() { ResetClipping(); } 
 311     // coordinates conversions and transforms 
 313     virtual wxCoord 
DeviceToLogicalX(wxCoord x
) const; 
 314     virtual wxCoord 
DeviceToLogicalY(wxCoord y
) const; 
 315     virtual wxCoord 
DeviceToLogicalXRel(wxCoord x
) const; 
 316     virtual wxCoord 
DeviceToLogicalYRel(wxCoord y
) const; 
 317     virtual wxCoord 
LogicalToDeviceX(wxCoord x
) const; 
 318     virtual wxCoord 
LogicalToDeviceY(wxCoord y
) const; 
 319     virtual wxCoord 
LogicalToDeviceXRel(wxCoord x
) const; 
 320     virtual wxCoord 
LogicalToDeviceYRel(wxCoord y
) const; 
 322     virtual void SetMapMode(int mode
); 
 323     virtual int GetMapMode() const { return m_mappingMode
; } 
 325     virtual void SetUserScale(double x
, double y
); 
 326     virtual void GetUserScale(double *x
, double *y
) const 
 328         if ( x 
) *x 
= m_userScaleX
; 
 329         if ( y 
) *y 
= m_userScaleY
; 
 332     virtual void SetLogicalScale(double x
, double y
); 
 333     virtual void GetLogicalScale(double *x
, double *y
) 
 335         if ( x 
) *x 
= m_logicalScaleX
; 
 336         if ( y 
) *y 
= m_logicalScaleY
; 
 339     virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
); 
 340     virtual void DoGetLogicalOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
 342         if ( x 
) *x 
= m_logicalOriginX
; 
 343         if ( y 
) *y 
= m_logicalOriginY
; 
 346     virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
); 
 347     virtual void DoGetDeviceOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
 349         if ( x 
) *x 
= m_deviceOriginX
; 
 350         if ( y 
) *y 
= m_deviceOriginY
; 
 353     virtual void SetDeviceLocalOrigin( wxCoord x
, wxCoord y 
); 
 355     virtual void ComputeScaleAndOrigin(); 
 357     // this needs to overidden if the axis is inverted 
 358     virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
); 
 360     // --------------------------------------------------------- 
 361     // the actual drawing API 
 363     virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, 
 364                              int style 
= wxFLOOD_SURFACE
) = 0; 
 366     virtual void DoGradientFillLinear(const wxRect
& rect
, 
 367                                       const wxColour
& initialColour
, 
 368                                       const wxColour
& destColour
, 
 369                                       wxDirection nDirection 
= wxEAST
); 
 371     virtual void DoGradientFillConcentric(const wxRect
& rect
, 
 372                                         const wxColour
& initialColour
, 
 373                                         const wxColour
& destColour
, 
 374                                         const wxPoint
& circleCenter
); 
 376     virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour 
*col
) const = 0; 
 378     virtual void DoDrawPoint(wxCoord x
, wxCoord y
) = 0; 
 379     virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) = 0; 
 381     virtual void DoDrawArc(wxCoord x1
, wxCoord y1
, 
 382                            wxCoord x2
, wxCoord y2
, 
 383                            wxCoord xc
, wxCoord yc
) = 0; 
 384     virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
, 
 385                                  wxCoord width
, wxCoord height
); 
 386     virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
, 
 387                                    double sa
, double ea
) = 0; 
 389     virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) = 0; 
 390     virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, 
 391                                         wxCoord width
, wxCoord height
, 
 393     virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, 
 394                                wxCoord width
, wxCoord height
) = 0; 
 396     virtual void DoCrossHair(wxCoord x
, wxCoord y
) = 0; 
 398     virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
) = 0; 
 399     virtual void DoDrawBitmap(const wxBitmap 
&bmp
, wxCoord x
, wxCoord y
, 
 400                               bool useMask 
= false) = 0; 
 402     virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
) = 0; 
 403     virtual void DoDrawRotatedText(const wxString
& text
, 
 404                                    wxCoord x
, wxCoord y
, double angle
) = 0; 
 406     virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, 
 407                         wxCoord width
, wxCoord height
, 
 409                         wxCoord xsrc
, wxCoord ysrc
, 
 411                         bool useMask 
= false, 
 412                         wxCoord xsrcMask 
= wxDefaultCoord
, 
 413                         wxCoord ysrcMask 
= wxDefaultCoord
) = 0; 
 415     virtual bool DoStretchBlit(wxCoord xdest
, wxCoord ydest
, 
 416                                wxCoord dstWidth
, wxCoord dstHeight
, 
 418                                wxCoord xsrc
, wxCoord ysrc
, 
 419                                wxCoord srcWidth
, wxCoord srcHeight
, 
 421                                bool useMask 
= false, 
 422                                wxCoord xsrcMask 
= wxDefaultCoord
, 
 423                                wxCoord ysrcMask 
= wxDefaultCoord
); 
 425     virtual wxBitmap 
DoGetAsBitmap(const wxRect 
*WXUNUSED(subrect
)) const 
 426         { return wxNullBitmap
; } 
 429     virtual void DoDrawLines(int n
, wxPoint points
[], 
 430                              wxCoord xoffset
, wxCoord yoffset
) = 0; 
 431     virtual void DoDrawPolygon(int n
, wxPoint points
[], 
 432                                wxCoord xoffset
, wxCoord yoffset
, 
 433                                int fillStyle 
= wxODDEVEN_RULE
) = 0; 
 434     virtual void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[], 
 435                                wxCoord xoffset
, wxCoord yoffset
, 
 441     virtual void DoDrawSpline(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
, wxCoord x3
, wxCoord y3
); 
 442     virtual void DoDrawSpline(int n
, wxPoint points
[]); 
 443     virtual void DoDrawSpline(const wxPointList 
*points
); 
 450     // unset clipping variables (after clipping region was destroyed) 
 455         m_clipX1 
= m_clipX2 
= m_clipY1 
= m_clipY2 
= 0; 
 462     bool m_isInteractive
:1; 
 463     bool m_isBBoxValid
:1; 
 465     // coordinate system variables 
 467     wxCoord m_logicalOriginX
, m_logicalOriginY
; 
 468     wxCoord m_deviceOriginX
, m_deviceOriginY
;           // Usually 0,0, can be change by user 
 470     wxCoord m_deviceLocalOriginX
, m_deviceLocalOriginY
; // non-zero if native top-left corner 
 471                                                         // is not at 0,0. This was the case under 
 472                                                         // Mac's GrafPorts (coordinate system 
 473                                                         // used toplevel window's origin) and 
 474                                                         // e.g. for Postscript, where the native 
 475                                                         // origin in the bottom left corner. 
 476     double m_logicalScaleX
, m_logicalScaleY
; 
 477     double m_userScaleX
, m_userScaleY
; 
 478     double m_scaleX
, m_scaleY
;  // calculated from logical scale and user scale 
 480     int m_signX
, m_signY
;  // Used by SetAxisOrientation() to invert the axes 
 482     // what is a mm on a screen you don't know the size of? 
 483     double       m_mm_to_pix_x
, 
 486     // bounding and clipping boxes 
 487     wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
; 
 488     wxCoord m_clipX1
, m_clipY1
, m_clipX2
, m_clipY2
; 
 490     int m_logicalFunction
; 
 491     int m_backgroundMode
; 
 496     wxBrush           m_backgroundBrush
; 
 497     wxColour          m_textForegroundColour
; 
 498     wxColour          m_textBackgroundColour
; 
 503     bool              m_hasCustomPalette
; 
 504 #endif // wxUSE_PALETTE 
 507     DECLARE_ABSTRACT_CLASS(wxImplDC
) 
 511 class wxDC
: public wxObject
 
 514     wxDC()   { m_pimpl 
= NULL
; } 
 520         { return m_pimpl 
&& m_pimpl
->IsOk(); } 
 522     // query capabilities 
 524     bool CanDrawBitmap() const  
 525         { return m_pimpl
->CanDrawBitmap(); } 
 526     bool CanGetTextExtent() const 
 527         { return m_pimpl
->CanGetTextExtent(); } 
 529     // query dimension, colour deps, resolution 
 531     void GetSize(int *width
, int *height
) const 
 532         { m_pimpl
->DoGetSize(width
, height
); } 
 534     wxSize 
GetSize() const 
 537         m_pimpl
->DoGetSize(&w
, &h
); 
 541     void GetSizeMM(int* width
, int* height
) const 
 542         { m_pimpl
->DoGetSizeMM(width
, height
); } 
 543     wxSize 
GetSizeMM() const 
 546         m_pimpl
->DoGetSizeMM(&w
, &h
); 
 551         { return m_pimpl
->GetDepth(); } 
 552     wxSize 
GetPPI() const 
 553         { return m_pimpl
->GetPPI(); } 
 555     // Right-To-Left (RTL) modes 
 557     void SetLayoutDirection(wxLayoutDirection dir
) 
 558         { m_pimpl
->SetLayoutDirection( dir 
); } 
 559     wxLayoutDirection 
GetLayoutDirection() const 
 560         { return m_pimpl
->GetLayoutDirection(); } 
 564     bool StartDoc(const wxString
& message
) 
 565         { return m_pimpl
->StartDoc(message
); } 
 567         { m_pimpl
->EndDoc(); } 
 570         { m_pimpl
->StartPage(); } 
 572         { m_pimpl
->EndPage(); } 
 576     void CalcBoundingBox(wxCoord x
, wxCoord y
) 
 577         { m_pimpl
->CalcBoundingBox(x
,y
); } 
 578     void ResetBoundingBox() 
 579         { m_pimpl
->ResetBoundingBox(); } 
 582         { return m_pimpl
->MinX(); } 
 584         { return m_pimpl
->MaxX(); } 
 586         { return m_pimpl
->MinY(); } 
 588         { return m_pimpl
->MaxY(); } 
 590     // setters and getters 
 592     void SetFont(const wxFont
& font
) 
 593         { m_pimpl
->SetFont( font 
); } 
 594     const wxFont
&   GetFont() const  
 595         { return m_pimpl
->GetFont(); } 
 597     void SetPen(const wxPen
& pen
) 
 598         { m_pimpl
->SetPen( pen 
); } 
 599     const wxPen
&    GetPen() const  
 600         { return m_pimpl
->GetPen(); } 
 602     void SetBrush(const wxBrush
& brush
) 
 603         { m_pimpl
->SetBrush( brush 
); } 
 604     const wxBrush
&  GetBrush() const 
 605         { return m_pimpl
->GetBrush(); } 
 607     void SetBackground(const wxBrush
& brush
) 
 608         { m_pimpl
->SetBackground( brush 
); } 
 609     const wxBrush
&  GetBackground() const 
 610         { return m_pimpl
->GetBackground(); } 
 612     void SetBackgroundMode(int mode
) 
 613         { m_pimpl
->SetBackgroundMode( mode 
); } 
 614     int GetBackgroundMode() const 
 615         { return m_pimpl
->GetBackgroundMode(); } 
 617     void SetTextForeground(const wxColour
& colour
) 
 618         { m_pimpl
->SetTextForeground(colour
); } 
 619     const wxColour
& GetTextForeground() const 
 620         { return m_pimpl
->GetTextForeground(); } 
 622     void SetTextBackground(const wxColour
& colour
) 
 623         { m_pimpl
->SetTextBackground(colour
); } 
 624     const wxColour
& GetTextBackground() const  
 625         { return m_pimpl
->GetTextBackground(); } 
 628     void SetPalette(const wxPalette
& palette
) 
 629         { m_pimpl
->SetPalette(palette
); } 
 630 #endif // wxUSE_PALETTE 
 634     void SetLogicalFunction(int function
) 
 635         { m_pimpl
->SetLogicalFunction(function
); } 
 636     int GetLogicalFunction() const 
 637         { return m_pimpl
->GetLogicalFunction(); } 
 641     wxCoord 
GetCharHeight() const 
 642         { return m_pimpl
->GetCharHeight(); } 
 643     wxCoord 
GetCharWidth() const 
 644         { return m_pimpl
->GetCharWidth(); } 
 646     void GetTextExtent(const wxString
& string
, 
 647                        wxCoord 
*x
, wxCoord 
*y
, 
 648                        wxCoord 
*descent 
= NULL
, 
 649                        wxCoord 
*externalLeading 
= NULL
, 
 650                        const wxFont 
*theFont 
= NULL
) const 
 651         { m_pimpl
->DoGetTextExtent(string
, x
, y
, descent
, externalLeading
, theFont
); } 
 653     wxSize 
GetTextExtent(const wxString
& string
) const 
 656         m_pimpl
->DoGetTextExtent(string
, &w
, &h
); 
 660     void GetMultiLineTextExtent(const wxString
& string
, 
 663                                         wxCoord 
*heightLine 
= NULL
, 
 664                                         const wxFont 
*font 
= NULL
) const 
 665         { m_pimpl
->GetMultiLineTextExtent( string
, width
, height
, heightLine
, font 
); } 
 667     wxSize 
GetMultiLineTextExtent(const wxString
& string
) const 
 670         m_pimpl
->GetMultiLineTextExtent(string
, &w
, &h
); 
 674     bool GetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const 
 675         { return m_pimpl
->DoGetPartialTextExtents(text
, widths
); } 
 680         { m_pimpl
->Clear(); } 
 684     void SetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) 
 685         { m_pimpl
->DoSetClippingRegion(x
, y
, width
, height
); } 
 686     void SetClippingRegion(const wxPoint
& pt
, const wxSize
& sz
) 
 687         { m_pimpl
->DoSetClippingRegion(pt
.x
, pt
.y
, sz
.x
, sz
.y
); } 
 688     void SetClippingRegion(const wxRect
& rect
) 
 689         { m_pimpl
->DoSetClippingRegion(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
 690     void SetClippingRegion(const wxRegion
& region
) 
 691         { m_pimpl
->DoSetClippingRegionAsRegion(region
); } 
 693     void DestroyClippingRegion() 
 694         { m_pimpl
->DestroyClippingRegion(); } 
 696     void GetClippingBox(wxCoord 
*x
, wxCoord 
*y
, wxCoord 
*w
, wxCoord 
*h
) const 
 697         { m_pimpl
->DoGetClippingBox(x
, y
, w
, h
); } 
 698     void GetClippingBox(wxRect
& rect
) const 
 699         { m_pimpl
->DoGetClippingBox(&rect
.x
, &rect
.y
, &rect
.width
, &rect
.height
); } 
 701     // coordinates conversions and transforms 
 703     wxCoord 
DeviceToLogicalX(wxCoord x
) const 
 704         { return m_pimpl
->DeviceToLogicalX(x
); } 
 705     wxCoord 
DeviceToLogicalY(wxCoord y
) const 
 706         { return m_pimpl
->DeviceToLogicalY(y
); } 
 707     wxCoord 
DeviceToLogicalXRel(wxCoord x
) const 
 708         { return m_pimpl
->DeviceToLogicalXRel(x
); } 
 709     wxCoord 
DeviceToLogicalYRel(wxCoord y
) const 
 710         { return m_pimpl
->DeviceToLogicalYRel(y
); } 
 711     wxCoord 
LogicalToDeviceX(wxCoord x
) const 
 712         { return m_pimpl
->LogicalToDeviceX(x
); } 
 713     wxCoord 
LogicalToDeviceY(wxCoord y
) const 
 714         { return m_pimpl
->LogicalToDeviceY(y
); } 
 715     wxCoord 
LogicalToDeviceXRel(wxCoord x
) const 
 716         { return m_pimpl
->LogicalToDeviceXRel(x
); } 
 717     wxCoord 
LogicalToDeviceYRel(wxCoord y
) const 
 718         { return m_pimpl
->LogicalToDeviceYRel(y
); } 
 720     void SetMapMode(int mode
) 
 721         { m_pimpl
->SetMapMode(mode
); } 
 722     int GetMapMode() const 
 723         { return m_pimpl
->GetMapMode(); } 
 725     void SetUserScale(double x
, double y
) 
 726         { m_pimpl
->SetUserScale(x
,y
); } 
 727     void GetUserScale(double *x
, double *y
) const 
 728         { m_pimpl
->GetUserScale( x
, y 
); } 
 730     void SetLogicalScale(double x
, double y
) 
 731         { m_pimpl
->SetLogicalScale( x
, y 
); } 
 732     void GetLogicalScale(double *x
, double *y
) 
 733         { m_pimpl
->GetLogicalScale( x
, y 
); } 
 735     void SetLogicalOrigin(wxCoord x
, wxCoord y
) 
 736         { m_pimpl
->SetLogicalOrigin(x
,y
); } 
 737     void GetLogicalOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
 738         { m_pimpl
->DoGetLogicalOrigin(x
, y
); } 
 739     wxPoint 
GetLogicalOrigin() const 
 740         { wxCoord x
, y
; m_pimpl
->DoGetLogicalOrigin(&x
, &y
); return wxPoint(x
, y
); } 
 742     void SetDeviceOrigin(wxCoord x
, wxCoord y
) 
 743         { m_pimpl
->SetDeviceOrigin( x
, y
); } 
 744     void GetDeviceOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
 745         { m_pimpl
->DoGetDeviceOrigin(x
, y
); } 
 746     wxPoint 
GetDeviceOrigin() const 
 747         { wxCoord x
, y
; m_pimpl
->DoGetDeviceOrigin(&x
, &y
); return wxPoint(x
, y
); } 
 749     void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
) 
 750         { m_pimpl
->SetAxisOrientation(xLeftRight
, yBottomUp
); } 
 753     void SetDeviceLocalOrigin( wxCoord x
, wxCoord y 
) 
 754         { m_pimpl
->SetDeviceLocalOrigin( x
, y 
); } 
 757     // draw generic object 
 759     void DrawObject(wxDrawObject
* drawobject
) 
 761         drawobject
->Draw(*this); 
 762         CalcBoundingBox(drawobject
->MinX(),drawobject
->MinY()); 
 763         CalcBoundingBox(drawobject
->MaxX(),drawobject
->MaxY()); 
 766     // ----------------------------------------------- 
 767     // the actual drawing API 
 769     bool FloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, 
 770                    int style 
= wxFLOOD_SURFACE
) 
 771         { return m_pimpl
->DoFloodFill(x
, y
, col
, style
); } 
 772     bool FloodFill(const wxPoint
& pt
, const wxColour
& col
, 
 773                    int style 
= wxFLOOD_SURFACE
) 
 774         { return m_pimpl
->DoFloodFill(pt
.x
, pt
.y
, col
, style
); } 
 776     // fill the area specified by rect with a radial gradient, starting from 
 777     // initialColour in the centre of the cercle and fading to destColour. 
 778     void GradientFillConcentric(const wxRect
& rect
, 
 779                                 const wxColour
& initialColour
, 
 780                                 const wxColour
& destColour
) 
 781         { m_pimpl
->DoGradientFillConcentric( rect
, initialColour
, destColour
, 
 782                                              wxPoint(rect
.GetWidth() / 2, 
 783                                                      rect
.GetHeight() / 2)); } 
 785     void GradientFillConcentric(const wxRect
& rect
, 
 786                                 const wxColour
& initialColour
, 
 787                                 const wxColour
& destColour
, 
 788                                 const wxPoint
& circleCenter
) 
 789         { m_pimpl
->DoGradientFillConcentric(rect
, initialColour
, destColour
, circleCenter
); } 
 791     // fill the area specified by rect with a linear gradient 
 792     void GradientFillLinear(const wxRect
& rect
, 
 793                             const wxColour
& initialColour
, 
 794                             const wxColour
& destColour
, 
 795                             wxDirection nDirection 
= wxEAST
) 
 796         { m_pimpl
->DoGradientFillLinear(rect
, initialColour
, destColour
, nDirection
); } 
 798     bool GetPixel(wxCoord x
, wxCoord y
, wxColour 
*col
) const 
 799         { return m_pimpl
->DoGetPixel(x
, y
, col
); } 
 800     bool GetPixel(const wxPoint
& pt
, wxColour 
*col
) const 
 801         { return m_pimpl
->DoGetPixel(pt
.x
, pt
.y
, col
); } 
 803     void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) 
 804         { m_pimpl
->DoDrawLine(x1
, y1
, x2
, y2
); } 
 805     void DrawLine(const wxPoint
& pt1
, const wxPoint
& pt2
) 
 806         { m_pimpl
->DoDrawLine(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
); } 
 808     void CrossHair(wxCoord x
, wxCoord y
) 
 809         { m_pimpl
->DoCrossHair(x
, y
); } 
 810     void CrossHair(const wxPoint
& pt
) 
 811         { m_pimpl
->DoCrossHair(pt
.x
, pt
.y
); } 
 813     void DrawArc(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
, 
 814                  wxCoord xc
, wxCoord yc
) 
 815         { m_pimpl
->DoDrawArc(x1
, y1
, x2
, y2
, xc
, yc
); } 
 816     void DrawArc(const wxPoint
& pt1
, const wxPoint
& pt2
, const wxPoint
& centre
) 
 817         { m_pimpl
->DoDrawArc(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
, centre
.x
, centre
.y
); } 
 819     void DrawCheckMark(wxCoord x
, wxCoord y
, 
 820                        wxCoord width
, wxCoord height
) 
 821         { m_pimpl
->DoDrawCheckMark(x
, y
, width
, height
); } 
 822     void DrawCheckMark(const wxRect
& rect
) 
 823         { m_pimpl
->DoDrawCheckMark(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
 825     void DrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
, 
 826                          double sa
, double ea
) 
 827         { m_pimpl
->DoDrawEllipticArc(x
, y
, w
, h
, sa
, ea
); } 
 828     void DrawEllipticArc(const wxPoint
& pt
, const wxSize
& sz
, 
 829                          double sa
, double ea
) 
 830         { m_pimpl
->DoDrawEllipticArc(pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
); } 
 832     void DrawPoint(wxCoord x
, wxCoord y
) 
 833         { m_pimpl
->DoDrawPoint(x
, y
); } 
 834     void DrawPoint(const wxPoint
& pt
) 
 835         { m_pimpl
->DoDrawPoint(pt
.x
, pt
.y
); } 
 837     void DrawLines(int n
, wxPoint points
[], 
 838                    wxCoord xoffset 
= 0, wxCoord yoffset 
= 0) 
 839         { m_pimpl
->DoDrawLines(n
, points
, xoffset
, yoffset
); } 
 842     // needs to be removed 
 843     void DrawLines(const wxPointList 
*list
, 
 844                    wxCoord xoffset 
= 0, wxCoord yoffset 
= 0) 
 847     void DrawPolygon(int n
, wxPoint points
[], 
 848                      wxCoord xoffset 
= 0, wxCoord yoffset 
= 0, 
 849                      int fillStyle 
= wxODDEVEN_RULE
) 
 850         { m_pimpl
->DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
); } 
 853     // needs to be removed 
 854     void DrawPolygon(const wxPointList 
*list
, 
 855                      wxCoord xoffset 
= 0, wxCoord yoffset 
= 0, 
 856                      int fillStyle 
= wxODDEVEN_RULE
) 
 857         { m_pimpl
->DrawPolygon( list
, xoffset
, yoffset
, fillStyle 
); } 
 860     void DrawPolyPolygon(int n
, int count
[], wxPoint points
[], 
 861                          wxCoord xoffset 
= 0, wxCoord yoffset 
= 0, 
 862                          int fillStyle 
= wxODDEVEN_RULE
) 
 863         { m_pimpl
->DoDrawPolyPolygon(n
, count
, points
, xoffset
, yoffset
, fillStyle
); } 
 865     void DrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) 
 866         { m_pimpl
->DoDrawRectangle(x
, y
, width
, height
); } 
 867     void DrawRectangle(const wxPoint
& pt
, const wxSize
& sz
) 
 868         { m_pimpl
->DoDrawRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
); } 
 869     void DrawRectangle(const wxRect
& rect
) 
 870         { m_pimpl
->DoDrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
 872     void DrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, 
 874         { m_pimpl
->DoDrawRoundedRectangle(x
, y
, width
, height
, radius
); } 
 875     void DrawRoundedRectangle(const wxPoint
& pt
, const wxSize
& sz
, 
 877         { m_pimpl
->DoDrawRoundedRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
, radius
); } 
 878     void DrawRoundedRectangle(const wxRect
& r
, double radius
) 
 879         { m_pimpl
->DoDrawRoundedRectangle(r
.x
, r
.y
, r
.width
, r
.height
, radius
); } 
 881     void DrawCircle(wxCoord x
, wxCoord y
, wxCoord radius
) 
 882         { m_pimpl
->DoDrawEllipse(x 
- radius
, y 
- radius
, 2*radius
, 2*radius
); } 
 883     void DrawCircle(const wxPoint
& pt
, wxCoord radius
) 
 884         { m_pimpl
->DoDrawEllipse(pt
.x 
- radius
, pt
.y 
- radius
, 2*radius
, 2*radius
); } 
 886     void DrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) 
 887         { m_pimpl
->DoDrawEllipse(x
, y
, width
, height
); } 
 888     void DrawEllipse(const wxPoint
& pt
, const wxSize
& sz
) 
 889         { m_pimpl
->DoDrawEllipse(pt
.x
, pt
.y
, sz
.x
, sz
.y
); } 
 890     void DrawEllipse(const wxRect
& rect
) 
 891         { m_pimpl
->DoDrawEllipse(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
 893     void DrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
) 
 894         { m_pimpl
->DoDrawIcon(icon
, x
, y
); } 
 895     void DrawIcon(const wxIcon
& icon
, const wxPoint
& pt
) 
 896         { m_pimpl
->DoDrawIcon(icon
, pt
.x
, pt
.y
); } 
 898     void DrawBitmap(const wxBitmap 
&bmp
, wxCoord x
, wxCoord y
, 
 899                     bool useMask 
= false) 
 900         { m_pimpl
->DoDrawBitmap(bmp
, x
, y
, useMask
); } 
 901     void DrawBitmap(const wxBitmap 
&bmp
, const wxPoint
& pt
, 
 902                     bool useMask 
= false) 
 903         { m_pimpl
->DoDrawBitmap(bmp
, pt
.x
, pt
.y
, useMask
); } 
 905     void DrawText(const wxString
& text
, wxCoord x
, wxCoord y
) 
 906         { m_pimpl
->DoDrawText(text
, x
, y
); } 
 907     void DrawText(const wxString
& text
, const wxPoint
& pt
) 
 908         { m_pimpl
->DoDrawText(text
, pt
.x
, pt
.y
); } 
 910     void DrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
) 
 911         { m_pimpl
->DoDrawRotatedText(text
, x
, y
, angle
); } 
 912     void DrawRotatedText(const wxString
& text
, const wxPoint
& pt
, double angle
) 
 913         { m_pimpl
->DoDrawRotatedText(text
, pt
.x
, pt
.y
, angle
); } 
 915     // this version puts both optional bitmap and the text into the given 
 916     // rectangle and aligns is as specified by alignment parameter; it also 
 917     // will emphasize the character with the given index if it is != -1 and 
 918     // return the bounding rectangle if required 
 919     void DrawLabel(const wxString
& text
, 
 920                            const wxBitmap
& image
, 
 922                            int alignment 
= wxALIGN_LEFT 
| wxALIGN_TOP
, 
 924                            wxRect 
*rectBounding 
= NULL
); 
 926     void DrawLabel(const wxString
& text
, const wxRect
& rect
, 
 927                    int alignment 
= wxALIGN_LEFT 
| wxALIGN_TOP
, 
 929         { DrawLabel(text
, wxNullBitmap
, rect
, alignment
, indexAccel
); } 
 931     bool Blit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
, 
 932               wxDC 
*source
, wxCoord xsrc
, wxCoord ysrc
, 
 933               int rop 
= wxCOPY
, bool useMask 
= false, wxCoord xsrcMask 
= wxDefaultCoord
, wxCoord ysrcMask 
= wxDefaultCoord
) 
 935         return m_pimpl
->DoBlit(xdest
, ydest
, width
, height
, 
 936                       source
, xsrc
, ysrc
, rop
, useMask
, xsrcMask
, ysrcMask
); 
 938     bool Blit(const wxPoint
& destPt
, const wxSize
& sz
, 
 939               wxDC 
*source
, const wxPoint
& srcPt
, 
 940               int rop 
= wxCOPY
, bool useMask 
= false, const wxPoint
& srcPtMask 
= wxDefaultPosition
) 
 942         return m_pimpl
->DoBlit(destPt
.x
, destPt
.y
, sz
.x
, sz
.y
, 
 943                       source
, srcPt
.x
, srcPt
.y
, rop
, useMask
, srcPtMask
.x
, srcPtMask
.y
); 
 946     bool StretchBlit(wxCoord dstX
, wxCoord dstY
,  
 947                      wxCoord dstWidth
, wxCoord dstHeight
, 
 949                      wxCoord srcX
, wxCoord srcY
, 
 950                      wxCoord srcWidth
, wxCoord srcHeight
, 
 951                      int rop 
= wxCOPY
, bool useMask 
= false,  
 952                      wxCoord srcMaskX 
= wxDefaultCoord
, wxCoord srcMaskY 
= wxDefaultCoord
) 
 954         return m_pimpl
->DoStretchBlit(dstX
, dstY
, dstWidth
, dstHeight
, 
 955                       source
, srcX
, srcY
, srcWidth
, srcHeight
, rop
, useMask
, srcMaskX
, srcMaskY
); 
 957     bool StretchBlit(const wxPoint
& dstPt
, const wxSize
& dstSize
, 
 958                      wxDC 
*source
, const wxPoint
& srcPt
, const wxSize
& srcSize
, 
 959                      int rop 
= wxCOPY
, bool useMask 
= false, const wxPoint
& srcMaskPt 
= wxDefaultPosition
) 
 961         return m_pimpl
->DoStretchBlit(dstPt
.x
, dstPt
.y
, dstSize
.x
, dstSize
.y
, 
 962                       source
, srcPt
.x
, srcPt
.y
, srcSize
.x
, srcSize
.y
, rop
, useMask
, srcMaskPt
.x
, srcMaskPt
.y
); 
 965     wxBitmap 
GetAsBitmap(const wxRect 
*subrect 
= (const wxRect 
*) NULL
) const 
 967         return m_pimpl
->DoGetAsBitmap(subrect
); 
 971     void DrawSpline(wxCoord x1
, wxCoord y1
, 
 972                     wxCoord x2
, wxCoord y2
, 
 973                     wxCoord x3
, wxCoord y3
) 
 974         { m_pimpl
->DoDrawSpline(x1
,y1
,x2
,y2
,x3
,y3
); } 
 975     void DrawSpline(int n
, wxPoint points
[]) 
 976         { m_pimpl
->DoDrawSpline(n
,points
); } 
 977     void DrawSpline(const wxPointList 
*points
)  
 978         { m_pimpl
->DoDrawSpline(points
); } 
 979 #endif // wxUSE_SPLINES 
 982 #if WXWIN_COMPATIBILITY_2_8 
 983     // for compatibility with the old code when wxCoord was long everywhere 
 984     wxDEPRECATED( void GetTextExtent(const wxString
& string
, 
 986                        long *descent 
= NULL
, 
 987                        long *externalLeading 
= NULL
, 
 988                        const wxFont 
*theFont 
= NULL
) const ); 
 989     wxDEPRECATED( void GetLogicalOrigin(long *x
, long *y
) const ); 
 990     wxDEPRECATED( void GetDeviceOrigin(long *x
, long *y
) const ); 
 991     wxDEPRECATED( void GetClippingBox(long *x
, long *y
, long *w
, long *h
) const ); 
 992 #endif  // WXWIN_COMPATIBILITY_2_8 
 999     DECLARE_ABSTRACT_CLASS(wxImplDC
) 
1003 //----------------------------------------------------------------------------- 
1005 //----------------------------------------------------------------------------- 
1007 class WXDLLIMPEXP_CORE wxWindowDC 
: public wxDC
 
1011     wxWindowDC( wxWindow 
*win 
); 
1014     DECLARE_DYNAMIC_CLASS(wxWindowDC
) 
1017 //----------------------------------------------------------------------------- 
1019 //----------------------------------------------------------------------------- 
1021 class WXDLLIMPEXP_CORE wxClientDC 
: public wxDC
 
1025     wxClientDC( wxWindow 
*win 
); 
1028     DECLARE_DYNAMIC_CLASS(wxClientDC
) 
1031 //----------------------------------------------------------------------------- 
1033 //----------------------------------------------------------------------------- 
1035 class WXDLLIMPEXP_CORE wxPaintDC 
: public wxDC
 
1039     wxPaintDC( wxWindow 
*win 
); 
1042     DECLARE_DYNAMIC_CLASS(wxPaintDC
) 
1045 #else  // wxUSE_NEW_DC 
1048 class WXDLLIMPEXP_FWD_CORE wxDC
; 
1050 // --------------------------------------------------------------------------- 
1052 // --------------------------------------------------------------------------- 
1054 // --------------------------------------------------------------------------- 
1055 // wxDC is the device context - object on which any drawing is done 
1056 // --------------------------------------------------------------------------- 
1058 class WXDLLEXPORT wxDCBase 
: public wxObject
 
1062     virtual ~wxDCBase(); 
1064     // graphic primitives 
1065     // ------------------ 
1067     virtual void DrawObject(wxDrawObject
* drawobject
) 
1069         drawobject
->Draw(*this); 
1070         CalcBoundingBox(drawobject
->MinX(),drawobject
->MinY()); 
1071         CalcBoundingBox(drawobject
->MaxX(),drawobject
->MaxY()); 
1074     wxDC 
*GetOwner() const { return (wxDC
*) this; } 
1076     bool FloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, 
1077                    int style 
= wxFLOOD_SURFACE
) 
1078         { return DoFloodFill(x
, y
, col
, style
); } 
1079     bool FloodFill(const wxPoint
& pt
, const wxColour
& col
, 
1080                    int style 
= wxFLOOD_SURFACE
) 
1081         { return DoFloodFill(pt
.x
, pt
.y
, col
, style
); } 
1083     // fill the area specified by rect with a radial gradient, starting from 
1084     // initialColour in the centre of the cercle and fading to destColour. 
1085     void GradientFillConcentric(const wxRect
& rect
, 
1086                                 const wxColour
& initialColour
, 
1087                                 const wxColour
& destColour
) 
1088         { GradientFillConcentric(rect
, initialColour
, destColour
, 
1089                                  wxPoint(rect
.GetWidth() / 2, 
1090                                          rect
.GetHeight() / 2)); } 
1092     void GradientFillConcentric(const wxRect
& rect
, 
1093                                 const wxColour
& initialColour
, 
1094                                 const wxColour
& destColour
, 
1095                                 const wxPoint
& circleCenter
) 
1096         { DoGradientFillConcentric(rect
, initialColour
, destColour
, circleCenter
); } 
1098     // fill the area specified by rect with a linear gradient 
1099     void GradientFillLinear(const wxRect
& rect
, 
1100                             const wxColour
& initialColour
, 
1101                             const wxColour
& destColour
, 
1102                             wxDirection nDirection 
= wxEAST
) 
1103         { DoGradientFillLinear(rect
, initialColour
, destColour
, nDirection
); } 
1105     bool GetPixel(wxCoord x
, wxCoord y
, wxColour 
*col
) const 
1106         { return DoGetPixel(x
, y
, col
); } 
1107     bool GetPixel(const wxPoint
& pt
, wxColour 
*col
) const 
1108         { return DoGetPixel(pt
.x
, pt
.y
, col
); } 
1110     void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) 
1111         { DoDrawLine(x1
, y1
, x2
, y2
); } 
1112     void DrawLine(const wxPoint
& pt1
, const wxPoint
& pt2
) 
1113         { DoDrawLine(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
); } 
1115     void CrossHair(wxCoord x
, wxCoord y
) 
1116         { DoCrossHair(x
, y
); } 
1117     void CrossHair(const wxPoint
& pt
) 
1118         { DoCrossHair(pt
.x
, pt
.y
); } 
1120     void DrawArc(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
, 
1121                  wxCoord xc
, wxCoord yc
) 
1122         { DoDrawArc(x1
, y1
, x2
, y2
, xc
, yc
); } 
1123     void DrawArc(const wxPoint
& pt1
, const wxPoint
& pt2
, const wxPoint
& centre
) 
1124         { DoDrawArc(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
, centre
.x
, centre
.y
); } 
1126     void DrawCheckMark(wxCoord x
, wxCoord y
, 
1127                        wxCoord width
, wxCoord height
) 
1128         { DoDrawCheckMark(x
, y
, width
, height
); } 
1129     void DrawCheckMark(const wxRect
& rect
) 
1130         { DoDrawCheckMark(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
1132     void DrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
, 
1133                          double sa
, double ea
) 
1134         { DoDrawEllipticArc(x
, y
, w
, h
, sa
, ea
); } 
1135     void DrawEllipticArc(const wxPoint
& pt
, const wxSize
& sz
, 
1136                          double sa
, double ea
) 
1137         { DoDrawEllipticArc(pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
); } 
1139     void DrawPoint(wxCoord x
, wxCoord y
) 
1140         { DoDrawPoint(x
, y
); } 
1141     void DrawPoint(const wxPoint
& pt
) 
1142         { DoDrawPoint(pt
.x
, pt
.y
); } 
1144     void DrawLines(int n
, wxPoint points
[], 
1145                    wxCoord xoffset 
= 0, wxCoord yoffset 
= 0) 
1146         { DoDrawLines(n
, points
, xoffset
, yoffset
); } 
1147     void DrawLines(const wxPointList 
*list
, 
1148                    wxCoord xoffset 
= 0, wxCoord yoffset 
= 0); 
1150 #if WXWIN_COMPATIBILITY_2_8 
1151     wxDEPRECATED( void DrawLines(const wxList 
*list
, 
1152                                  wxCoord xoffset 
= 0, wxCoord yoffset 
= 0) ); 
1153 #endif  // WXWIN_COMPATIBILITY_2_8 
1156     void DrawPolygon(int n
, wxPoint points
[], 
1157                      wxCoord xoffset 
= 0, wxCoord yoffset 
= 0, 
1158                      int fillStyle 
= wxODDEVEN_RULE
) 
1159         { DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
); } 
1161     void DrawPolygon(const wxPointList 
*list
, 
1162                      wxCoord xoffset 
= 0, wxCoord yoffset 
= 0, 
1163                      int fillStyle 
= wxODDEVEN_RULE
); 
1165 #if WXWIN_COMPATIBILITY_2_8 
1166     wxDEPRECATED( void DrawPolygon(const wxList 
*list
, 
1167                      wxCoord xoffset 
= 0, wxCoord yoffset 
= 0, 
1168                      int fillStyle 
= wxODDEVEN_RULE
) ); 
1169 #endif  // WXWIN_COMPATIBILITY_2_8 
1171     void DrawPolyPolygon(int n
, int count
[], wxPoint points
[], 
1172                          wxCoord xoffset 
= 0, wxCoord yoffset 
= 0, 
1173                          int fillStyle 
= wxODDEVEN_RULE
) 
1174         { DoDrawPolyPolygon(n
, count
, points
, xoffset
, yoffset
, fillStyle
); } 
1176     void DrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) 
1177         { DoDrawRectangle(x
, y
, width
, height
); } 
1178     void DrawRectangle(const wxPoint
& pt
, const wxSize
& sz
) 
1179         { DoDrawRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
); } 
1180     void DrawRectangle(const wxRect
& rect
) 
1181         { DoDrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
1183     void DrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, 
1185         { DoDrawRoundedRectangle(x
, y
, width
, height
, radius
); } 
1186     void DrawRoundedRectangle(const wxPoint
& pt
, const wxSize
& sz
, 
1188         { DoDrawRoundedRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
, radius
); } 
1189     void DrawRoundedRectangle(const wxRect
& r
, double radius
) 
1190         { DoDrawRoundedRectangle(r
.x
, r
.y
, r
.width
, r
.height
, radius
); } 
1192     void DrawCircle(wxCoord x
, wxCoord y
, wxCoord radius
) 
1193         { DoDrawEllipse(x 
- radius
, y 
- radius
, 2*radius
, 2*radius
); } 
1194     void DrawCircle(const wxPoint
& pt
, wxCoord radius
) 
1195         { DrawCircle(pt
.x
, pt
.y
, radius
); } 
1197     void DrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) 
1198         { DoDrawEllipse(x
, y
, width
, height
); } 
1199     void DrawEllipse(const wxPoint
& pt
, const wxSize
& sz
) 
1200         { DoDrawEllipse(pt
.x
, pt
.y
, sz
.x
, sz
.y
); } 
1201     void DrawEllipse(const wxRect
& rect
) 
1202         { DoDrawEllipse(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
1204     void DrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
) 
1205         { DoDrawIcon(icon
, x
, y
); } 
1206     void DrawIcon(const wxIcon
& icon
, const wxPoint
& pt
) 
1207         { DoDrawIcon(icon
, pt
.x
, pt
.y
); } 
1209     void DrawBitmap(const wxBitmap 
&bmp
, wxCoord x
, wxCoord y
, 
1210                     bool useMask 
= false) 
1211         { DoDrawBitmap(bmp
, x
, y
, useMask
); } 
1212     void DrawBitmap(const wxBitmap 
&bmp
, const wxPoint
& pt
, 
1213                     bool useMask 
= false) 
1214         { DoDrawBitmap(bmp
, pt
.x
, pt
.y
, useMask
); } 
1216     void DrawText(const wxString
& text
, wxCoord x
, wxCoord y
) 
1217         { DoDrawText(text
, x
, y
); } 
1218     void DrawText(const wxString
& text
, const wxPoint
& pt
) 
1219         { DoDrawText(text
, pt
.x
, pt
.y
); } 
1221     void DrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
) 
1222         { DoDrawRotatedText(text
, x
, y
, angle
); } 
1223     void DrawRotatedText(const wxString
& text
, const wxPoint
& pt
, double angle
) 
1224         { DoDrawRotatedText(text
, pt
.x
, pt
.y
, angle
); } 
1226     // this version puts both optional bitmap and the text into the given 
1227     // rectangle and aligns is as specified by alignment parameter; it also 
1228     // will emphasize the character with the given index if it is != -1 and 
1229     // return the bounding rectangle if required 
1230     virtual void DrawLabel(const wxString
& text
, 
1231                            const wxBitmap
& image
, 
1233                            int alignment 
= wxALIGN_LEFT 
| wxALIGN_TOP
, 
1234                            int indexAccel 
= -1, 
1235                            wxRect 
*rectBounding 
= NULL
); 
1237     void DrawLabel(const wxString
& text
, const wxRect
& rect
, 
1238                    int alignment 
= wxALIGN_LEFT 
| wxALIGN_TOP
, 
1239                    int indexAccel 
= -1) 
1240         { DrawLabel(text
, wxNullBitmap
, rect
, alignment
, indexAccel
); } 
1242     bool Blit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
, 
1243               wxDC 
*source
, wxCoord xsrc
, wxCoord ysrc
, 
1244               int rop 
= wxCOPY
, bool useMask 
= false, wxCoord xsrcMask 
= wxDefaultCoord
, wxCoord ysrcMask 
= wxDefaultCoord
) 
1246         return DoBlit(xdest
, ydest
, width
, height
, 
1247                       source
, xsrc
, ysrc
, rop
, useMask
, xsrcMask
, ysrcMask
); 
1249     bool Blit(const wxPoint
& destPt
, const wxSize
& sz
, 
1250               wxDC 
*source
, const wxPoint
& srcPt
, 
1251               int rop 
= wxCOPY
, bool useMask 
= false, const wxPoint
& srcPtMask 
= wxDefaultPosition
) 
1253         return DoBlit(destPt
.x
, destPt
.y
, sz
.x
, sz
.y
, 
1254                       source
, srcPt
.x
, srcPt
.y
, rop
, useMask
, srcPtMask
.x
, srcPtMask
.y
); 
1257     bool StretchBlit(wxCoord dstX
, wxCoord dstY
,  
1258                      wxCoord dstWidth
, wxCoord dstHeight
, 
1260                      wxCoord srcX
, wxCoord srcY
, 
1261                      wxCoord srcWidth
, wxCoord srcHeight
, 
1262                      int rop 
= wxCOPY
, bool useMask 
= false,  
1263                      wxCoord srcMaskX 
= wxDefaultCoord
, wxCoord srcMaskY 
= wxDefaultCoord
) 
1265         return DoStretchBlit(dstX
, dstY
, dstWidth
, dstHeight
, 
1266                       source
, srcX
, srcY
, srcWidth
, srcHeight
, rop
, useMask
, srcMaskX
, srcMaskY
); 
1268     bool StretchBlit(const wxPoint
& dstPt
, const wxSize
& dstSize
, 
1269                      wxDC 
*source
, const wxPoint
& srcPt
, const wxSize
& srcSize
, 
1270                      int rop 
= wxCOPY
, bool useMask 
= false, const wxPoint
& srcMaskPt 
= wxDefaultPosition
) 
1272         return DoStretchBlit(dstPt
.x
, dstPt
.y
, dstSize
.x
, dstSize
.y
, 
1273                       source
, srcPt
.x
, srcPt
.y
, srcSize
.x
, srcSize
.y
, rop
, useMask
, srcMaskPt
.x
, srcMaskPt
.y
); 
1276     wxBitmap 
GetAsBitmap(const wxRect 
*subrect 
= (const wxRect 
*) NULL
) const 
1278         return DoGetAsBitmap(subrect
); 
1282     void DrawSpline(wxCoord x1
, wxCoord y1
, 
1283                     wxCoord x2
, wxCoord y2
, 
1284                     wxCoord x3
, wxCoord y3
); 
1285     void DrawSpline(int n
, wxPoint points
[]); 
1287     void DrawSpline(const wxPointList 
*points
) { DoDrawSpline(points
); } 
1289 #if WXWIN_COMPATIBILITY_2_8 
1290     wxDEPRECATED( void DrawSpline(const wxList 
*points
) ); 
1291 #endif  // WXWIN_COMPATIBILITY_2_8 
1293 #endif // wxUSE_SPLINES 
1295     // Eventually we will have wxUSE_GENERIC_DRAWELLIPSE 
1297     //! Generic method to draw ellipses, circles and arcs with current pen and brush. 
1298     /*! \param x Upper left corner of bounding box. 
1299      *  \param y Upper left corner of bounding box. 
1300      *  \param w Width of bounding box. 
1301      *  \param h Height of bounding box. 
1302      *  \param sa Starting angle of arc 
1303      *            (counterclockwise, start at 3 o'clock, 360 is full circle). 
1304      *  \param ea Ending angle of arc. 
1305      *  \param angle Rotation angle, the Arc will be rotated after 
1306      *               calculating begin and end. 
1308     void DrawEllipticArcRot( wxCoord x
, wxCoord y
, 
1309                              wxCoord width
, wxCoord height
, 
1310                              double sa 
= 0, double ea 
= 0, double angle 
= 0 ) 
1311     { DoDrawEllipticArcRot( x
, y
, width
, height
, sa
, ea
, angle 
); } 
1313     void DrawEllipticArcRot( const wxPoint
& pt
, 
1315                              double sa 
= 0, double ea 
= 0, double angle 
= 0 ) 
1316     { DoDrawEllipticArcRot( pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
, angle 
); } 
1318     void DrawEllipticArcRot( const wxRect
& rect
, 
1319                              double sa 
= 0, double ea 
= 0, double angle 
= 0 ) 
1320     { DoDrawEllipticArcRot( rect
.x
, rect
.y
, rect
.width
, rect
.height
, sa
, ea
, angle 
); } 
1322     virtual void DoDrawEllipticArcRot( wxCoord x
, wxCoord y
, 
1323                                        wxCoord w
, wxCoord h
, 
1324                                        double sa 
= 0, double ea 
= 0, double angle 
= 0 ); 
1326     //! Rotates points around center. 
1327     /*! This is a quite straight method, it calculates in pixels 
1328      *  and so it produces rounding errors. 
1329      *  \param points The points inside will be rotated. 
1330      *  \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle). 
1331      *  \param center Center of rotation. 
1333     void Rotate( wxPointList
* points
, double angle
, wxPoint center 
= wxPoint(0,0) ); 
1335     // used by DrawEllipticArcRot 
1336     // Careful: wxList gets filled with points you have to delete later. 
1337     void CalculateEllipticPoints( wxPointList
* points
, 
1338                                   wxCoord xStart
, wxCoord yStart
, 
1339                                   wxCoord w
, wxCoord h
, 
1340                                   double sa
, double ea 
); 
1343     // global DC operations 
1344     // -------------------- 
1346     virtual void Clear() = 0; 
1348     virtual bool StartDoc(const wxString
& WXUNUSED(message
)) { return true; } 
1349     virtual void EndDoc() { } 
1351     virtual void StartPage() { } 
1352     virtual void EndPage() { } 
1354 #if WXWIN_COMPATIBILITY_2_6 
1355     wxDEPRECATED( void BeginDrawing() ); 
1356     wxDEPRECATED( void EndDrawing() ); 
1357 #endif // WXWIN_COMPATIBILITY_2_6 
1360     // set objects to use for drawing 
1361     // ------------------------------ 
1363     virtual void SetFont(const wxFont
& font
) = 0; 
1364     virtual void SetPen(const wxPen
& pen
) = 0; 
1365     virtual void SetBrush(const wxBrush
& brush
) = 0; 
1366     virtual void SetBackground(const wxBrush
& brush
) = 0; 
1367     virtual void SetBackgroundMode(int mode
) = 0; 
1369     virtual void SetPalette(const wxPalette
& palette
) = 0; 
1370 #endif // wxUSE_PALETTE 
1375     void SetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) 
1376         { DoSetClippingRegion(x
, y
, width
, height
); } 
1377     void SetClippingRegion(const wxPoint
& pt
, const wxSize
& sz
) 
1378         { DoSetClippingRegion(pt
.x
, pt
.y
, sz
.x
, sz
.y
); } 
1379     void SetClippingRegion(const wxRect
& rect
) 
1380         { DoSetClippingRegion(rect
.x
, rect
.y
, rect
.width
, rect
.height
); } 
1381     void SetClippingRegion(const wxRegion
& region
) 
1382         { DoSetClippingRegionAsRegion(region
); } 
1384     virtual void DestroyClippingRegion() { ResetClipping(); } 
1386     void GetClippingBox(wxCoord 
*x
, wxCoord 
*y
, wxCoord 
*w
, wxCoord 
*h
) const 
1387         { DoGetClippingBox(x
, y
, w
, h
); } 
1388     void GetClippingBox(wxRect
& rect
) const 
1390           DoGetClippingBox(&rect
.x
, &rect
.y
, &rect
.width
, &rect
.height
); 
1396     virtual wxCoord 
GetCharHeight() const = 0; 
1397     virtual wxCoord 
GetCharWidth() const = 0; 
1399     // only works for single line strings 
1400     void GetTextExtent(const wxString
& string
, 
1401                        wxCoord 
*x
, wxCoord 
*y
, 
1402                        wxCoord 
*descent 
= NULL
, 
1403                        wxCoord 
*externalLeading 
= NULL
, 
1404                        const wxFont 
*theFont 
= NULL
) const 
1405         { DoGetTextExtent(string
, x
, y
, descent
, externalLeading
, theFont
); } 
1407     wxSize 
GetTextExtent(const wxString
& string
) const 
1410         DoGetTextExtent(string
, &w
, &h
); 
1411         return wxSize(w
, h
); 
1414     // works for single as well as multi-line strings 
1415     virtual void GetMultiLineTextExtent(const wxString
& string
, 
1418                                         wxCoord 
*heightLine 
= NULL
, 
1419                                         const wxFont 
*font 
= NULL
) const; 
1421     wxSize 
GetMultiLineTextExtent(const wxString
& string
) const 
1424         GetMultiLineTextExtent(string
, &w
, &h
); 
1425         return wxSize(w
, h
); 
1428     // Measure cumulative width of text after each character 
1429     bool GetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const 
1430         { return DoGetPartialTextExtents(text
, widths
); } 
1433     // size and resolution 
1434     // ------------------- 
1437     void GetSize(int *width
, int *height
) const 
1438         { DoGetSize(width
, height
); } 
1439     wxSize 
GetSize() const 
1444         return wxSize(w
, h
); 
1448     void GetSizeMM(int* width
, int* height
) const 
1449         { DoGetSizeMM(width
, height
); } 
1450     wxSize 
GetSizeMM() const 
1453         DoGetSizeMM(&w
, &h
); 
1455         return wxSize(w
, h
); 
1458     // query DC capabilities 
1459     // --------------------- 
1461     virtual bool CanDrawBitmap() const = 0; 
1462     virtual bool CanGetTextExtent() const = 0; 
1465     virtual int GetDepth() const = 0; 
1467     // Resolution in Pixels per inch 
1468     virtual wxSize 
GetPPI() const = 0; 
1470     virtual bool Ok() const { return IsOk(); } 
1471     virtual bool IsOk() const { return m_ok
; } 
1473     // accessors and setters 
1474     // --------------------- 
1476     virtual int GetBackgroundMode() const { return m_backgroundMode
; } 
1477     virtual const wxBrush
&  GetBackground() const { return m_backgroundBrush
; } 
1478     virtual const wxBrush
&  GetBrush() const { return m_brush
; } 
1479     virtual const wxFont
&   GetFont() const { return m_font
; } 
1480     virtual const wxPen
&    GetPen() const { return m_pen
; } 
1482     virtual const wxColour
& GetTextForeground() const { return m_textForegroundColour
; } 
1483     virtual const wxColour
& GetTextBackground() const { return m_textBackgroundColour
; } 
1484     virtual void SetTextForeground(const wxColour
& colour
) 
1485         { m_textForegroundColour 
= colour
; } 
1486     virtual void SetTextBackground(const wxColour
& colour
) 
1487         { m_textBackgroundColour 
= colour
; } 
1490     // coordinates conversions and transforms 
1491     // -------------------------------------- 
1493     virtual wxCoord 
DeviceToLogicalX(wxCoord x
) const; 
1494     virtual wxCoord 
DeviceToLogicalY(wxCoord y
) const; 
1495     virtual wxCoord 
DeviceToLogicalXRel(wxCoord x
) const; 
1496     virtual wxCoord 
DeviceToLogicalYRel(wxCoord y
) const; 
1497     virtual wxCoord 
LogicalToDeviceX(wxCoord x
) const; 
1498     virtual wxCoord 
LogicalToDeviceY(wxCoord y
) const; 
1499     virtual wxCoord 
LogicalToDeviceXRel(wxCoord x
) const; 
1500     virtual wxCoord 
LogicalToDeviceYRel(wxCoord y
) const; 
1502     virtual void SetMapMode(int mode
); 
1503     virtual int GetMapMode() const { return m_mappingMode
; } 
1505     virtual void SetUserScale(double x
, double y
); 
1506     virtual void GetUserScale(double *x
, double *y
) const 
1508         if ( x 
) *x 
= m_userScaleX
; 
1509         if ( y 
) *y 
= m_userScaleY
; 
1512     virtual void SetLogicalScale(double x
, double y
); 
1513     virtual void GetLogicalScale(double *x
, double *y
) 
1515         if ( x 
) *x 
= m_logicalScaleX
; 
1516         if ( y 
) *y 
= m_logicalScaleY
; 
1519     virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
); 
1520     void GetLogicalOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
1521         { DoGetLogicalOrigin(x
, y
); } 
1522     wxPoint 
GetLogicalOrigin() const 
1523         { wxCoord x
, y
; DoGetLogicalOrigin(&x
, &y
); return wxPoint(x
, y
); } 
1525     virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
); 
1526     void GetDeviceOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
1527         { DoGetDeviceOrigin(x
, y
); } 
1528     wxPoint 
GetDeviceOrigin() const 
1529         { wxCoord x
, y
; DoGetDeviceOrigin(&x
, &y
); return wxPoint(x
, y
); } 
1531     virtual void SetDeviceLocalOrigin( wxCoord x
, wxCoord y 
); 
1533     virtual void ComputeScaleAndOrigin(); 
1535     // this needs to overidden if the axis is inverted (such 
1536     // as when using Postscript, where 0,0 is the lower left 
1537     // corner, not the upper left). 
1538     virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
); 
1540     // logical functions 
1541     // --------------------------- 
1543     virtual int GetLogicalFunction() const { return m_logicalFunction
; } 
1544     virtual void SetLogicalFunction(int function
) = 0; 
1549     virtual void CalcBoundingBox(wxCoord x
, wxCoord y
) 
1551       if ( m_isBBoxValid 
) 
1553          if ( x 
< m_minX 
) m_minX 
= x
; 
1554          if ( y 
< m_minY 
) m_minY 
= y
; 
1555          if ( x 
> m_maxX 
) m_maxX 
= x
; 
1556          if ( y 
> m_maxY 
) m_maxY 
= y
; 
1560          m_isBBoxValid 
= true; 
1569     void ResetBoundingBox() 
1571         m_isBBoxValid 
= false; 
1573         m_minX 
= m_maxX 
= m_minY 
= m_maxY 
= 0; 
1576     // Get the final bounding box of the PostScript or Metafile picture. 
1577     wxCoord 
MinX() const { return m_minX
; } 
1578     wxCoord 
MaxX() const { return m_maxX
; } 
1579     wxCoord 
MinY() const { return m_minY
; } 
1580     wxCoord 
MaxY() const { return m_maxY
; } 
1582     // misc old functions 
1583     // ------------------ 
1585 #if WXWIN_COMPATIBILITY_2_8 
1586     // for compatibility with the old code when wxCoord was long everywhere 
1587     wxDEPRECATED( void GetTextExtent(const wxString
& string
, 
1589                        long *descent 
= NULL
, 
1590                        long *externalLeading 
= NULL
, 
1591                        const wxFont 
*theFont 
= NULL
) const ); 
1592     wxDEPRECATED( void GetLogicalOrigin(long *x
, long *y
) const ); 
1593     wxDEPRECATED( void GetDeviceOrigin(long *x
, long *y
) const ); 
1594     wxDEPRECATED( void GetClippingBox(long *x
, long *y
, long *w
, long *h
) const ); 
1595 #endif  // WXWIN_COMPATIBILITY_2_8 
1597     // RTL related functions 
1598     // --------------------- 
1600     // get or change the layout direction (LTR or RTL) for this dc, 
1601     // wxLayout_Default is returned if layout direction is not supported 
1602     virtual wxLayoutDirection 
GetLayoutDirection() const 
1603         { return wxLayout_Default
; } 
1604     virtual void SetLayoutDirection(wxLayoutDirection 
WXUNUSED(dir
)) 
1608     // the pure virtual functions which should be implemented by wxDC 
1609     virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, 
1610                              int style 
= wxFLOOD_SURFACE
) = 0; 
1612     virtual void DoGradientFillLinear(const wxRect
& rect
, 
1613                                       const wxColour
& initialColour
, 
1614                                       const wxColour
& destColour
, 
1615                                       wxDirection nDirection 
= wxEAST
); 
1617     virtual void DoGradientFillConcentric(const wxRect
& rect
, 
1618                                         const wxColour
& initialColour
, 
1619                                         const wxColour
& destColour
, 
1620                                         const wxPoint
& circleCenter
); 
1622     virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour 
*col
) const = 0; 
1624     virtual void DoDrawPoint(wxCoord x
, wxCoord y
) = 0; 
1625     virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) = 0; 
1627     virtual void DoDrawArc(wxCoord x1
, wxCoord y1
, 
1628                            wxCoord x2
, wxCoord y2
, 
1629                            wxCoord xc
, wxCoord yc
) = 0; 
1630     virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
, 
1631                                  wxCoord width
, wxCoord height
); 
1632     virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
, 
1633                                    double sa
, double ea
) = 0; 
1635     virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) = 0; 
1636     virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, 
1637                                         wxCoord width
, wxCoord height
, 
1639     virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, 
1640                                wxCoord width
, wxCoord height
) = 0; 
1642     virtual void DoCrossHair(wxCoord x
, wxCoord y
) = 0; 
1644     virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
) = 0; 
1645     virtual void DoDrawBitmap(const wxBitmap 
&bmp
, wxCoord x
, wxCoord y
, 
1646                               bool useMask 
= false) = 0; 
1648     virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
) = 0; 
1649     virtual void DoDrawRotatedText(const wxString
& text
, 
1650                                    wxCoord x
, wxCoord y
, double angle
) = 0; 
1652     virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, 
1653                         wxCoord width
, wxCoord height
, 
1655                         wxCoord xsrc
, wxCoord ysrc
, 
1657                         bool useMask 
= false, 
1658                         wxCoord xsrcMask 
= wxDefaultCoord
, 
1659                         wxCoord ysrcMask 
= wxDefaultCoord
) = 0; 
1661     virtual bool DoStretchBlit(wxCoord xdest
, wxCoord ydest
, 
1662                                wxCoord dstWidth
, wxCoord dstHeight
, 
1664                                wxCoord xsrc
, wxCoord ysrc
, 
1665                                wxCoord srcWidth
, wxCoord srcHeight
, 
1667                                bool useMask 
= false, 
1668                                wxCoord xsrcMask 
= wxDefaultCoord
, 
1669                                wxCoord ysrcMask 
= wxDefaultCoord
); 
1671     virtual wxBitmap 
DoGetAsBitmap(const wxRect 
*WXUNUSED(subrect
)) const 
1672         { return wxNullBitmap
; } 
1674     virtual void DoGetSize(int *width
, int *height
) const = 0; 
1675     virtual void DoGetSizeMM(int* width
, int* height
) const = 0; 
1677     virtual void DoDrawLines(int n
, wxPoint points
[], 
1678                              wxCoord xoffset
, wxCoord yoffset
) = 0; 
1679     virtual void DoDrawPolygon(int n
, wxPoint points
[], 
1680                                wxCoord xoffset
, wxCoord yoffset
, 
1681                                int fillStyle 
= wxODDEVEN_RULE
) = 0; 
1682     virtual void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[], 
1683                                wxCoord xoffset
, wxCoord yoffset
, 
1686     virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
) = 0; 
1687     virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, 
1688                                      wxCoord width
, wxCoord height
) = 0; 
1690     virtual void DoGetClippingBox(wxCoord 
*x
, wxCoord 
*y
, 
1691                                   wxCoord 
*w
, wxCoord 
*h
) const 
1698             *w 
= m_clipX2 
- m_clipX1
; 
1700             *h 
= m_clipY2 
- m_clipY1
; 
1703     virtual void DoGetLogicalOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
1705         if ( x 
) *x 
= m_logicalOriginX
; 
1706         if ( y 
) *y 
= m_logicalOriginY
; 
1709     virtual void DoGetDeviceOrigin(wxCoord 
*x
, wxCoord 
*y
) const 
1711         if ( x 
) *x 
= m_deviceOriginX
; 
1712         if ( y 
) *y 
= m_deviceOriginY
; 
1715     virtual void DoGetTextExtent(const wxString
& string
, 
1716                                  wxCoord 
*x
, wxCoord 
*y
, 
1717                                  wxCoord 
*descent 
= NULL
, 
1718                                  wxCoord 
*externalLeading 
= NULL
, 
1719                                  const wxFont 
*theFont 
= NULL
) const = 0; 
1721     virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const; 
1724     virtual void DoDrawSpline(const wxPointList 
*points
); 
1728     // unset clipping variables (after clipping region was destroyed) 
1729     void ResetClipping() 
1733         m_clipX1 
= m_clipX2 
= m_clipY1 
= m_clipY2 
= 0; 
1740     bool m_isInteractive
:1; 
1741     bool m_isBBoxValid
:1; 
1743     // coordinate system variables 
1745     // TODO short descriptions of what exactly they are would be nice... 
1747     wxCoord m_logicalOriginX
, m_logicalOriginY
; 
1748     wxCoord m_deviceOriginX
, m_deviceOriginY
;           // Usually 0,0, can be change by user 
1750     wxCoord m_deviceLocalOriginX
, m_deviceLocalOriginY
; // non-zero if native top-left corner 
1751                                                         // is not at 0,0. This was the case under 
1752                                                         // Mac's GrafPorts (coordinate system 
1753                                                         // used toplevel window's origin) and 
1754                                                         // e.g. for Postscript, where the native 
1755                                                         // origin in the bottom left corner. 
1756     double m_logicalScaleX
, m_logicalScaleY
; 
1757     double m_userScaleX
, m_userScaleY
; 
1758     double m_scaleX
, m_scaleY
;  // calculated from logical scale and user scale 
1760     // Used by SetAxisOrientation() to invert the axes 
1761     int m_signX
, m_signY
; 
1763     // what is a mm on a screen you don't know the size of? 
1764     double       m_mm_to_pix_x
, 
1767     // bounding and clipping boxes 
1768     wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
; 
1769     wxCoord m_clipX1
, m_clipY1
, m_clipX2
, m_clipY2
; 
1771     int m_logicalFunction
; 
1772     int m_backgroundMode
; 
1778     wxBrush           m_backgroundBrush
; 
1779     wxColour          m_textForegroundColour
; 
1780     wxColour          m_textBackgroundColour
; 
1784     wxPalette         m_palette
; 
1785     bool              m_hasCustomPalette
; 
1786 #endif // wxUSE_PALETTE 
1789     DECLARE_NO_COPY_CLASS(wxDCBase
) 
1790     DECLARE_ABSTRACT_CLASS(wxDCBase
) 
1793 #endif // wxUSE_NEW_DC 
1795 // ---------------------------------------------------------------------------- 
1796 // now include the declaration of wxDC class 
1797 // ---------------------------------------------------------------------------- 
1799 #if defined(__WXPALMOS__) 
1800     #include "wx/palmos/dc.h" 
1801 #elif defined(__WXMSW__) 
1802     #include "wx/msw/dc.h" 
1803 #elif defined(__WXMOTIF__) 
1804     #include "wx/motif/dc.h" 
1805 #elif defined(__WXGTK20__) 
1806     #include "wx/gtk/dc.h" 
1807 #elif defined(__WXGTK__) 
1808     #include "wx/gtk1/dc.h" 
1809 #elif defined(__WXX11__) 
1810     #include "wx/x11/dc.h" 
1811 #elif defined(__WXMGL__) 
1812     #include "wx/mgl/dc.h" 
1813 #elif defined(__WXDFB__) 
1814     #include "wx/dfb/dc.h" 
1815 #elif defined(__WXMAC__) 
1816     #include "wx/mac/dc.h" 
1817 #elif defined(__WXCOCOA__) 
1818     #include "wx/cocoa/dc.h" 
1819 #elif defined(__WXPM__) 
1820     #include "wx/os2/dc.h" 
1823 #if wxUSE_GRAPHICS_CONTEXT 
1824     #include "wx/dcgraph.h" 
1827 // ---------------------------------------------------------------------------- 
1828 // helper class: you can use it to temporarily change the DC text colour and 
1829 // restore it automatically when the object goes out of scope 
1830 // ---------------------------------------------------------------------------- 
1832 class WXDLLEXPORT wxDCTextColourChanger
 
1835     wxDCTextColourChanger(wxDC
& dc
) : m_dc(dc
), m_colFgOld() { } 
1837     wxDCTextColourChanger(wxDC
& dc
, const wxColour
& col
) : m_dc(dc
) 
1842     ~wxDCTextColourChanger() 
1844         if ( m_colFgOld
.Ok() ) 
1845             m_dc
.SetTextForeground(m_colFgOld
); 
1848     void Set(const wxColour
& col
) 
1850         if ( !m_colFgOld
.Ok() ) 
1851             m_colFgOld 
= m_dc
.GetTextForeground(); 
1852         m_dc
.SetTextForeground(col
); 
1858     wxColour m_colFgOld
; 
1860     DECLARE_NO_COPY_CLASS(wxDCTextColourChanger
) 
1863 // ---------------------------------------------------------------------------- 
1864 // helper class: you can use it to temporarily change the DC pen and 
1865 // restore it automatically when the object goes out of scope 
1866 // ---------------------------------------------------------------------------- 
1868 class WXDLLEXPORT wxDCPenChanger
 
1871     wxDCPenChanger(wxDC
& dc
, const wxPen
& pen
) : m_dc(dc
), m_penOld(dc
.GetPen()) 
1878         if ( m_penOld
.Ok() ) 
1879             m_dc
.SetPen(m_penOld
); 
1887     DECLARE_NO_COPY_CLASS(wxDCPenChanger
) 
1890 // ---------------------------------------------------------------------------- 
1891 // helper class: you can use it to temporarily change the DC brush and 
1892 // restore it automatically when the object goes out of scope 
1893 // ---------------------------------------------------------------------------- 
1895 class WXDLLEXPORT wxDCBrushChanger
 
1898     wxDCBrushChanger(wxDC
& dc
, const wxBrush
& brush
) : m_dc(dc
), m_brushOld(dc
.GetBrush()) 
1900         m_dc
.SetBrush(brush
); 
1905         if ( m_brushOld
.Ok() ) 
1906             m_dc
.SetBrush(m_brushOld
); 
1914     DECLARE_NO_COPY_CLASS(wxDCBrushChanger
) 
1917 // ---------------------------------------------------------------------------- 
1918 // another small helper class: sets the clipping region in its ctor and 
1919 // destroys it in the dtor 
1920 // ---------------------------------------------------------------------------- 
1922 class WXDLLEXPORT wxDCClipper
 
1925     wxDCClipper(wxDC
& dc
, const wxRegion
& r
) : m_dc(dc
) 
1926         { dc
.SetClippingRegion(r
); } 
1927     wxDCClipper(wxDC
& dc
, const wxRect
& r
) : m_dc(dc
) 
1928         { dc
.SetClippingRegion(r
.x
, r
.y
, r
.width
, r
.height
); } 
1929     wxDCClipper(wxDC
& dc
, wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) : m_dc(dc
) 
1930         { dc
.SetClippingRegion(x
, y
, w
, h
); } 
1932     ~wxDCClipper() { m_dc
.DestroyClippingRegion(); } 
1937     DECLARE_NO_COPY_CLASS(wxDCClipper
) 
1940 #endif // _WX_DC_H_BASE_