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
; }
161 virtual void DoFloodFill( wxCoord vX
163 ,const wxColour
& rCol
164 ,int nStyle
= wxFLOOD_SURFACE
167 virtual bool DoGetPixel( wxCoord vX
172 virtual void DoDrawPoint( wxCoord vX
175 virtual void DoDrawLine( wxCoord vX1
181 virtual void DoDrawArc( wxCoord vX1
188 virtual void DoDrawCheckMark( wxCoord vX
193 virtual void DoDrawEllipticArc( wxCoord vX
201 virtual void DoDrawRectangle( wxCoord vX
206 virtual void DoDrawRoundedRectangle( wxCoord vX
212 virtual void DoDrawEllipse( wxCoord vX
218 virtual void DoCrossHair( wxCoord vX
222 virtual void DoDrawIcon( const wxIcon
& rIcon
226 virtual void DoDrawBitmap( const wxBitmap
& rBmp
229 ,bool bUseMask
= FALSE
232 virtual void DoDrawText( const wxString
& rsText
236 virtual void DoDrawRotatedText( const wxString
& rsText
242 virtual bool DoBlit( wxCoord vXdest
250 ,bool bUseMask
= FALSE
253 virtual void DoSetClippingRegionAsRegion(const wxRegion
& rRegion
);
254 virtual void DoSetClippingRegion( wxCoord vX
259 virtual void DoGetClippingRegion( wxCoord
* pX
271 virtual void DoGetSize( int* pWidth
274 virtual void DoGetSizeMM( int* pWidth
278 virtual void DoDrawLines( int n
283 virtual void DoDrawPolygon( int n
287 ,int nFillStyle
= wxODDEVEN_RULE
292 // common part of DoDrawText() and DoDrawRotatedText()
294 void DrawAnyText( const wxString
& rsText
299 // OS2-specific member variables ?? do we even need this under OS/2?
304 // the window associated with this DC (may be NULL)
307 wxBitmap m_vSelectedBitmap
;
312 HPS m_hOldPS
; // old hPS, if any
313 bool m_bIsPaintTime
;// True at Paint Time
315 RECTL m_vRclPaint
; // Bounding rectangle at Paint time etc.
317 // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
327 // Store all old GDI objects when do a SelectObject, so we can select them
328 // back in (this unselecting user's objects) so we can safely delete the
331 WXHBITMAP m_hOldBitmap
;
333 WXHBRUSH m_hOldBrush
;
335 WXHPALETTE m_hOldPalette
;