1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
18 // ---------------------------------------------------------------------------
20 // ---------------------------------------------------------------------------
24 #define XLOG2DEV(x) (x)
25 #define YLOG2DEV(y) (y)
28 #define XLOG2DEVREL(x) (x)
29 #define YLOG2DEVREL(y) (y)
33 #define XDEV2LOG(x) (x)
35 #define YDEV2LOG(y) (y)
38 #define XDEV2LOGREL(x) (x)
39 #define YDEV2LOGREL(y) (y)
42 * Have the same macros as for XView but not for every operation:
43 * just for calculating window/viewport extent (a better way of scaling).
48 #define MS_XLOG2DEV(x) LogicalToDevice(x)
50 #define MS_YLOG2DEV(y) LogicalToDevice(y)
53 #define MS_XLOG2DEVREL(x) LogicalToDeviceXRel(x)
54 #define MS_YLOG2DEVREL(y) LogicalToDeviceYRel(y)
58 #define MS_XDEV2LOG(x) DeviceToLogicalX(x)
60 #define MS_YDEV2LOG(y) DeviceToLogicalY(y)
63 #define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x)
64 #define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y)
66 #define YSCALE(y) (yorigin - (y))
68 #define wx_round(a) (int)((a)+.5)
70 class WXDLLEXPORT wxDC
: public wxDCBase
72 DECLARE_DYNAMIC_CLASS(wxDC
)
78 // implement base class pure virtuals
79 // ----------------------------------
81 virtual void Clear(void);
83 virtual bool StartDoc(const wxString
& rsMessage
);
84 virtual void EndDoc(void);
86 virtual void StartPage(void);
87 virtual void EndPage(void);
89 virtual void SetFont(const wxFont
& rFont
);
90 virtual void SetPen(const wxPen
& rPen
);
91 virtual void SetBrush(const wxBrush
& rBrush
);
92 virtual void SetBackground(const wxBrush
& rBrush
);
93 virtual void SetBackgroundMode(int nMode
);
94 virtual void SetPalette(const wxPalette
& rPalette
);
96 virtual void DestroyClippingRegion(void);
98 virtual wxCoord
GetCharHeight(void) const;
99 virtual wxCoord
GetCharWidth(void) const;
100 virtual void DoGetTextExtent( const wxString
& rsString
103 ,wxCoord
* pDescent
= NULL
104 ,wxCoord
* pExternalLeading
= NULL
105 ,wxFont
* pTheFont
= NULL
107 virtual bool CanDrawBitmap(void) const;
108 virtual bool CanGetTextExtent(void) const;
109 virtual int GetDepth(void) const;
110 virtual wxSize
GetPPI(void) const;
112 virtual void SetMapMode(int nMode
);
113 virtual void SetUserScale( double dX
116 virtual void SetSystemScale( double dX
119 virtual void SetLogicalScale( double dX
122 virtual void SetLogicalOrigin( wxCoord vX
125 virtual void SetDeviceOrigin( wxCoord vX
128 virtual void SetAxisOrientation( bool bXLeftRight
131 virtual void SetLogicalFunction(int nFunction
);
133 // implementation from now on
134 // --------------------------
136 virtual void SetRop(WXHDC hCdc
);
137 virtual void SelectOldObjects(WXHDC hDc
);
139 wxWindow
* GetWindow(void) const { return m_pCanvas
; }
140 void SetWindow(wxWindow
* pWin
) { m_pCanvas
= pWin
; }
142 WXHDC
GetHDC(void) const { return m_hDC
; }
143 void SetHDC( WXHDC hDc
144 ,bool bOwnsDC
= FALSE
151 const wxBitmap
& GetSelectedBitmap(void) const { return m_vSelectedBitmap
; }
152 wxBitmap
& GetSelectedBitmap(void) { return m_vSelectedBitmap
; }
155 virtual void DoFloodFill( wxCoord vX
157 ,const wxColour
& rCol
158 ,int nStyle
= wxFLOOD_SURFACE
161 virtual bool DoGetPixel( wxCoord vX
166 virtual void DoDrawPoint( wxCoord vX
169 virtual void DoDrawLine( wxCoord vX1
175 virtual void DoDrawArc( wxCoord vX1
182 virtual void DoDrawCheckMark( wxCoord vX
187 virtual void DoDrawEllipticArc( wxCoord vX
195 virtual void DoDrawRectangle( wxCoord vX
200 virtual void DoDrawRoundedRectangle( wxCoord vX
206 virtual void DoDrawEllipse( wxCoord vX
212 virtual void DoCrossHair( wxCoord vX
216 virtual void DoDrawIcon( const wxIcon
& rIcon
220 virtual void DoDrawBitmap( const wxBitmap
& rBmp
223 ,bool bUseMask
= FALSE
226 virtual void DoDrawText( const wxString
& rsText
230 virtual void DoDrawRotatedText( const wxString
& rsText
236 virtual bool DoBlit( wxCoord vXdest
244 ,bool bUseMask
= FALSE
247 virtual void DoSetClippingRegionAsRegion(const wxRegion
& rRegion
);
248 virtual void DoSetClippingRegion( wxCoord vX
253 virtual void DoGetClippingRegion( wxCoord
* pX
265 virtual void DoGetSize( int* pWidth
268 virtual void DoGetSizeMM( int* pWidth
272 virtual void DoDrawLines( int n
277 virtual void DoDrawPolygon( int n
281 ,int nFillStyle
= wxODDEVEN_RULE
285 virtual void DoDrawSpline(wxList
* pPoints
);
286 #endif // wxUSE_SPLINES
289 // common part of DoDrawText() and DoDrawRotatedText()
291 void DrawAnyText( const wxString
& rsText
296 // OS2-specific member variables ?? do we even need this under OS/2?
301 // the window associated with this DC (may be NULL)
304 wxBitmap m_vSelectedBitmap
;
309 HPS m_hOldPS
; // old hPS, if any
310 bool m_bIsPaintTime
;// True at Paint Time
312 RECTL m_vRclPaint
; // Bounding rectangle at Paint time etc.
314 // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
319 // our HDC and its usage count: we only free it when the usage count drops
326 // Store all old GDI objects when do a SelectObject, so we can select them
327 // back in (this unselecting user's objects) so we can safely delete the
330 WXHBITMAP m_hOldBitmap
;
332 WXHBRUSH m_hOldBrush
;
334 WXHPALETTE m_hOldPalette
;