]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/dc.h
compilation fixes - wxGTK compiles but not links
[wxWidgets.git] / include / wx / os2 / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dc.h
3 // Purpose: wxDC class
4 // Author: David Webster
5 // Modified by:
6 // Created: 08/26/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DC_H_
13 #define _WX_DC_H_
14
15 #include "wx/defs.h"
16 //#include "wx/dc.h"
17
18 // ---------------------------------------------------------------------------
19 // macros
20 // ---------------------------------------------------------------------------
21
22 // Logical to device
23 // Absolute
24 #define XLOG2DEV(x) (x)
25 #define YLOG2DEV(y) (y)
26
27 // Relative
28 #define XLOG2DEVREL(x) (x)
29 #define YLOG2DEVREL(y) (y)
30
31 // Device to logical
32 // Absolute
33 #define XDEV2LOG(x) (x)
34
35 #define YDEV2LOG(y) (y)
36
37 // Relative
38 #define XDEV2LOGREL(x) (x)
39 #define YDEV2LOGREL(y) (y)
40
41 /*
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).
44 */
45
46 // Logical to device
47 // Absolute
48 #define MS_XLOG2DEV(x) LogicalToDevice(x)
49
50 #define MS_YLOG2DEV(y) LogicalToDevice(y)
51
52 // Relative
53 #define MS_XLOG2DEVREL(x) LogicalToDeviceXRel(x)
54 #define MS_YLOG2DEVREL(y) LogicalToDeviceYRel(y)
55
56 // Device to logical
57 // Absolute
58 #define MS_XDEV2LOG(x) DeviceToLogicalX(x)
59
60 #define MS_YDEV2LOG(y) DeviceToLogicalY(y)
61
62 // Relative
63 #define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x)
64 #define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y)
65
66 #define YSCALE(y) (yorigin - (y))
67
68 #define wx_round(a) (int)((a)+.5)
69
70 class WXDLLEXPORT wxDC : public wxDCBase
71 {
72 DECLARE_DYNAMIC_CLASS(wxDC)
73
74 public:
75 wxDC(void);
76 ~wxDC();
77
78 // implement base class pure virtuals
79 // ----------------------------------
80
81 virtual void Clear(void);
82
83 virtual bool StartDoc(const wxString& rsMessage);
84 virtual void EndDoc(void);
85
86 virtual void StartPage(void);
87 virtual void EndPage(void);
88
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);
95
96 virtual void DestroyClippingRegion(void);
97
98 virtual wxCoord GetCharHeight(void) const;
99 virtual wxCoord GetCharWidth(void) const;
100 virtual void DoGetTextExtent( const wxString& rsString
101 ,wxCoord* pX
102 ,wxCoord* pY
103 ,wxCoord* pDescent = NULL
104 ,wxCoord* pExternalLeading = NULL
105 ,wxFont* pTheFont = NULL
106 ) const;
107 virtual bool CanDrawBitmap(void) const;
108 virtual bool CanGetTextExtent(void) const;
109 virtual int GetDepth(void) const;
110 virtual wxSize GetPPI(void) const;
111
112 virtual void SetMapMode(int nMode);
113 virtual void SetUserScale( double dX
114 ,double dY
115 );
116 virtual void SetSystemScale( double dX
117 ,double dY
118 );
119 virtual void SetLogicalScale( double dX
120 ,double dY
121 );
122 virtual void SetLogicalOrigin( wxCoord vX
123 ,wxCoord vY
124 );
125 virtual void SetDeviceOrigin( wxCoord vX
126 ,wxCoord vY
127 );
128 virtual void SetAxisOrientation( bool bXLeftRight
129 ,bool bYBottomUp
130 );
131 virtual void SetLogicalFunction(int nFunction);
132
133 // implementation from now on
134 // --------------------------
135
136 virtual void SetRop(WXHDC hCdc);
137 virtual void SelectOldObjects(WXHDC hDc);
138
139 wxWindow* GetWindow(void) const { return m_pCanvas; }
140 void SetWindow(wxWindow* pWin) { m_pCanvas = pWin; }
141
142 WXHDC GetHDC(void) const { return m_hDC; }
143 void SetHDC( WXHDC hDc
144 ,bool bOwnsDC = FALSE
145 )
146 {
147 m_hDC = hDc;
148 m_bOwnsDC = bOwnsDC;
149 }
150
151 HPS GetHPS(void) const { return m_hPS; }
152 void SetHPS(HPS hPS)
153 {
154 HDC hDC = ::GpiQueryDevice(hPS);
155 m_hPS = hPS;
156 }
157 const wxBitmap& GetSelectedBitmap(void) const { return m_vSelectedBitmap; }
158 wxBitmap& GetSelectedBitmap(void) { return m_vSelectedBitmap; }
159
160 protected:
161 virtual void DoFloodFill( wxCoord vX
162 ,wxCoord vY
163 ,const wxColour& rCol
164 ,int nStyle = wxFLOOD_SURFACE
165 );
166
167 virtual bool DoGetPixel( wxCoord vX
168 ,wxCoord vY
169 ,wxColour* pCol
170 ) const;
171
172 virtual void DoDrawPoint( wxCoord vX
173 ,wxCoord vY
174 );
175 virtual void DoDrawLine( wxCoord vX1
176 ,wxCoord vY1
177 ,wxCoord vX2
178 ,wxCoord vY2
179 );
180
181 virtual void DoDrawArc( wxCoord vX1
182 ,wxCoord vY1
183 ,wxCoord vX2
184 ,wxCoord vY2
185 ,wxCoord vXc
186 ,wxCoord vYc
187 );
188 virtual void DoDrawCheckMark( wxCoord vX
189 ,wxCoord vY
190 ,wxCoord vWidth
191 ,wxCoord vHeight
192 );
193 virtual void DoDrawEllipticArc( wxCoord vX
194 ,wxCoord vY
195 ,wxCoord vW
196 ,wxCoord vH
197 ,double dSa
198 ,double dEa
199 );
200
201 virtual void DoDrawRectangle( wxCoord vX
202 ,wxCoord vY
203 ,wxCoord vWidth
204 ,wxCoord vHeight
205 );
206 virtual void DoDrawRoundedRectangle( wxCoord vX
207 ,wxCoord vY
208 ,wxCoord vWidth
209 ,wxCoord vHeight
210 ,double dRadius
211 );
212 virtual void DoDrawEllipse( wxCoord vX
213 ,wxCoord vY
214 ,wxCoord vWidth
215 ,wxCoord vHeight
216 );
217
218 virtual void DoCrossHair( wxCoord vX
219 ,wxCoord vY
220 );
221
222 virtual void DoDrawIcon( const wxIcon& rIcon
223 ,wxCoord vX
224 ,wxCoord vY
225 );
226 virtual void DoDrawBitmap( const wxBitmap& rBmp
227 ,wxCoord vX
228 ,wxCoord vY
229 ,bool bUseMask = FALSE
230 );
231
232 virtual void DoDrawText( const wxString& rsText
233 ,wxCoord vX
234 ,wxCoord vY
235 );
236 virtual void DoDrawRotatedText( const wxString& rsText
237 ,wxCoord vX
238 ,wxCoord vY
239 ,double dAngle
240 );
241
242 virtual bool DoBlit( wxCoord vXdest
243 ,wxCoord vYdest
244 ,wxCoord vWidth
245 ,wxCoord vHeight
246 ,wxDC* pSource
247 ,wxCoord vXsrc
248 ,wxCoord vYsrc
249 ,int nRop = wxCOPY
250 ,bool bUseMask = FALSE
251 );
252
253 virtual void DoSetClippingRegionAsRegion(const wxRegion& rRegion);
254 virtual void DoSetClippingRegion( wxCoord vX
255 ,wxCoord vY
256 ,wxCoord vWidth
257 ,wxCoord vHeight
258 );
259 virtual void DoGetClippingRegion( wxCoord* pX
260 ,wxCoord* pY
261 ,wxCoord* pWidth
262 ,wxCoord* pHeight)
263 {
264 GetClippingBox( pX
265 ,pY
266 ,pWidth
267 ,pHeight
268 );
269 }
270
271 virtual void DoGetSize( int* pWidth
272 ,int* pHeight
273 ) const;
274 virtual void DoGetSizeMM( int* pWidth
275 ,int* pHeight
276 ) const;
277
278 virtual void DoDrawLines( int n
279 ,wxPoint vaPoints[]
280 ,wxCoord vXoffset
281 ,wxCoord yYoffset
282 );
283 virtual void DoDrawPolygon( int n
284 ,wxPoint vaPoints[]
285 ,wxCoord vXoffset
286 ,wxCoord vYoffset
287 ,int nFillStyle = wxODDEVEN_RULE
288 );
289
290
291 //
292 // common part of DoDrawText() and DoDrawRotatedText()
293 //
294 void DrawAnyText( const wxString& rsText
295 ,wxCoord vX
296 ,wxCoord vY
297 );
298
299 // OS2-specific member variables ?? do we even need this under OS/2?
300 int m_nWindowExtX;
301 int m_nWindowExtY;
302
303 //
304 // the window associated with this DC (may be NULL)
305 //
306 wxWindow* m_pCanvas;
307 wxBitmap m_vSelectedBitmap;
308
309 public:
310 // PM specific stuff
311 HPS m_hPS;
312 HPS m_hOldPS; // old hPS, if any
313 bool m_bIsPaintTime;// True at Paint Time
314
315 RECTL m_vRclPaint; // Bounding rectangle at Paint time etc.
316 //
317 // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
318 //
319 bool m_bOwnsDC:1;
320
321 //
322 // our HDC
323 //
324 WXHDC m_hDC;
325
326 //
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
329 // DC.
330 //
331 WXHBITMAP m_hOldBitmap;
332 WXHPEN m_hOldPen;
333 WXHBRUSH m_hOldBrush;
334 WXHFONT m_hOldFont;
335 WXHPALETTE m_hOldPalette;
336 };
337 #endif
338 // _WX_DC_H_