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 HPS
GetHPS(void) const { return m_hPS
; }
154 HDC hDC
= ::GpiQueryDevice(hPS
);
157 const wxBitmap
& GetSelectedBitmap(void) const { return m_vSelectedBitmap
; }
158 wxBitmap
& GetSelectedBitmap(void) { return m_vSelectedBitmap
; }
160 void UpdateClipBox();
163 virtual void DoFloodFill( wxCoord vX
165 ,const wxColour
& rCol
166 ,int nStyle
= wxFLOOD_SURFACE
169 virtual bool DoGetPixel( wxCoord vX
174 virtual void DoDrawPoint( wxCoord vX
177 virtual void DoDrawLine( wxCoord vX1
183 virtual void DoDrawArc( wxCoord vX1
190 virtual void DoDrawCheckMark( wxCoord vX
195 virtual void DoDrawEllipticArc( wxCoord vX
203 virtual void DoDrawRectangle( wxCoord vX
208 virtual void DoDrawRoundedRectangle( wxCoord vX
214 virtual void DoDrawEllipse( wxCoord vX
220 virtual void DoCrossHair( wxCoord vX
224 virtual void DoDrawIcon( const wxIcon
& rIcon
228 virtual void DoDrawBitmap( const wxBitmap
& rBmp
231 ,bool bUseMask
= FALSE
234 virtual void DoDrawText( const wxString
& rsText
238 virtual void DoDrawRotatedText( const wxString
& rsText
244 virtual bool DoBlit( wxCoord vXdest
252 ,bool bUseMask
= FALSE
255 virtual void DoSetClippingRegionAsRegion(const wxRegion
& rRegion
);
256 virtual void DoSetClippingRegion( wxCoord vX
261 virtual void DoGetClippingRegion( wxCoord
* pX
273 virtual void DoGetSize( int* pWidth
276 virtual void DoGetSizeMM( int* pWidth
280 virtual void DoDrawLines( int n
285 virtual void DoDrawPolygon( int n
289 ,int nFillStyle
= wxODDEVEN_RULE
294 // common part of DoDrawText() and DoDrawRotatedText()
296 void DrawAnyText( const wxString
& rsText
301 // OS2-specific member variables ?? do we even need this under OS/2?
306 // the window associated with this DC (may be NULL)
309 wxBitmap m_vSelectedBitmap
;
314 HPS m_hOldPS
; // old hPS, if any
315 bool m_bIsPaintTime
;// True at Paint Time
317 RECTL m_vRclPaint
; // Bounding rectangle at Paint time etc.
319 // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
329 // Store all old GDI objects when do a SelectObject, so we can select them
330 // back in (this unselecting user's objects) so we can safely delete the
333 WXHBITMAP m_hOldBitmap
;
335 WXHBRUSH m_hOldBrush
;
337 WXHPALETTE m_hOldPalette
;