]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dc.cpp | |
3 | // Purpose: wxDC class | |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "dc.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/dc.h" | |
17 | ||
18 | #if !USE_SHARED_LIBRARY | |
19 | IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) | |
20 | #endif | |
21 | ||
22 | //----------------------------------------------------------------------------- | |
23 | // constants | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | #define mm2inches 0.0393700787402 | |
27 | #define inches2mm 25.4 | |
28 | #define mm2twips 56.6929133859 | |
29 | #define twips2mm 0.0176388888889 | |
30 | #define mm2pt 2.83464566929 | |
31 | #define pt2mm 0.352777777778 | |
32 | ||
1408104d DW |
33 | //----------------------------------------------------------------------------- |
34 | // wxDCBase | |
35 | //----------------------------------------------------------------------------- | |
36 | ||
37 | long wxDCBase::DeviceToLogicalX(long x) const | |
38 | { | |
c3d43472 DW |
39 | long new_x = x - m_deviceOriginX; |
40 | if (new_x > 0) | |
41 | return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; | |
42 | else | |
43 | return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; | |
1408104d DW |
44 | }; |
45 | ||
46 | long wxDCBase::DeviceToLogicalY(long y) const | |
47 | { | |
c3d43472 DW |
48 | long new_y = y - m_deviceOriginY; |
49 | if (new_y > 0) | |
50 | return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; | |
51 | else | |
52 | return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; | |
1408104d DW |
53 | }; |
54 | ||
55 | long wxDCBase::DeviceToLogicalXRel(long x) const | |
56 | { | |
c3d43472 DW |
57 | if (x > 0) |
58 | return (long)((double)(x) / m_scaleX + 0.5); | |
59 | else | |
60 | return (long)((double)(x) / m_scaleX - 0.5); | |
1408104d DW |
61 | }; |
62 | ||
63 | long wxDCBase::DeviceToLogicalYRel(long y) const | |
64 | { | |
c3d43472 DW |
65 | if (y > 0) |
66 | return (long)((double)(y) / m_scaleY + 0.5); | |
67 | else | |
68 | return (long)((double)(y) / m_scaleY - 0.5); | |
1408104d DW |
69 | }; |
70 | ||
71 | long wxDCBase::LogicalToDeviceX(long x) const | |
72 | { | |
c3d43472 DW |
73 | long new_x = x - m_logicalOriginX; |
74 | if (new_x > 0) | |
75 | return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; | |
76 | else | |
77 | return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; | |
1408104d DW |
78 | }; |
79 | ||
80 | long wxDCBase::LogicalToDeviceY(long y) const | |
81 | { | |
c3d43472 DW |
82 | long new_y = y - m_logicalOriginY; |
83 | if (new_y > 0) | |
84 | return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; | |
85 | else | |
86 | return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; | |
1408104d DW |
87 | }; |
88 | ||
89 | long wxDCBase::LogicalToDeviceXRel(long x) const | |
90 | { | |
c3d43472 DW |
91 | if (x > 0) |
92 | return (long)((double)(x) * m_scaleX + 0.5); | |
93 | else | |
94 | return (long)((double)(x) * m_scaleX - 0.5); | |
1408104d DW |
95 | }; |
96 | ||
97 | long wxDCBase::LogicalToDeviceYRel(long y) const | |
98 | { | |
c3d43472 DW |
99 | if (y > 0) |
100 | return (long)((double)(y) * m_scaleY + 0.5); | |
101 | else | |
102 | return (long)((double)(y) * m_scaleY - 0.5); | |
1408104d DW |
103 | }; |
104 | ||
0e320a79 DW |
105 | //----------------------------------------------------------------------------- |
106 | // wxDC | |
107 | //----------------------------------------------------------------------------- | |
108 | ||
109 | wxDC::wxDC(void) | |
110 | { | |
c3d43472 DW |
111 | m_owner = NULL; |
112 | m_bitmap = NULL; | |
113 | ||
114 | m_oldBitmap = 0; | |
115 | m_oldPen = 0; | |
116 | m_oldBrush = 0; | |
117 | m_oldFont = 0; | |
118 | m_oldPalette = 0; | |
119 | m_hDC = 0; | |
120 | m_hDCCount = 0; | |
0e320a79 DW |
121 | }; |
122 | ||
123 | wxDC::~wxDC(void) | |
124 | { | |
c3d43472 | 125 | // TODO: |
0e320a79 DW |
126 | }; |
127 | ||
0e320a79 DW |
128 | void wxDC::DestroyClippingRegion(void) |
129 | { | |
c3d43472 | 130 | // TODO: |
0e320a79 DW |
131 | }; |
132 | ||
c3d43472 | 133 | void wxDC::DoGetSize( int* width, int* height ) const |
0e320a79 | 134 | { |
c3d43472 | 135 | // TODO: |
0e320a79 DW |
136 | }; |
137 | ||
c3d43472 | 138 | void wxDC::DoGetSizeMM( int* width, int* height ) const |
0e320a79 | 139 | { |
c3d43472 | 140 | // TODO: |
0e320a79 DW |
141 | }; |
142 | ||
0e320a79 DW |
143 | void wxDC::SetMapMode( int mode ) |
144 | { | |
c3d43472 | 145 | // TODO: |
0e320a79 DW |
146 | }; |
147 | ||
148 | void wxDC::SetUserScale( double x, double y ) | |
149 | { | |
c3d43472 DW |
150 | m_userScaleX = x; |
151 | m_userScaleY = y; | |
0e320a79 | 152 | |
c3d43472 | 153 | SetMapMode(m_mappingMode); |
0e320a79 DW |
154 | }; |
155 | ||
156 | void wxDC::SetLogicalScale( double x, double y ) | |
157 | { | |
c3d43472 | 158 | // TODO: |
0e320a79 DW |
159 | }; |
160 | ||
0e320a79 DW |
161 | void wxDC::SetLogicalOrigin( long x, long y ) |
162 | { | |
c3d43472 | 163 | // TODO: |
0e320a79 DW |
164 | }; |
165 | ||
0e320a79 DW |
166 | void wxDC::SetDeviceOrigin( long x, long y ) |
167 | { | |
c3d43472 | 168 | // TODO: |
0e320a79 DW |
169 | }; |
170 | ||
0e320a79 DW |
171 | void wxDC::SetInternalDeviceOrigin( long x, long y ) |
172 | { | |
c3d43472 | 173 | // TODO: |
0e320a79 DW |
174 | }; |
175 | ||
176 | void wxDC::GetInternalDeviceOrigin( long *x, long *y ) | |
177 | { | |
c3d43472 | 178 | // TODO: |
0e320a79 DW |
179 | }; |
180 | ||
181 | void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) | |
182 | { | |
c3d43472 | 183 | // TODO: |
0e320a79 DW |
184 | }; |
185 | ||
1408104d DW |
186 | |
187 | int wxDC::GetDepth() const | |
0e320a79 | 188 | { |
1408104d DW |
189 | // TODO: |
190 | return (1); | |
191 | } | |
0e320a79 | 192 | |
1408104d | 193 | wxSize wxDC::GetPPI() const |
0e320a79 | 194 | { |
c3d43472 DW |
195 | int x = 1; |
196 | int y = 1; | |
1408104d | 197 | // TODO: |
c3d43472 | 198 | return (wxSize(x,y)); |
1408104d DW |
199 | } |
200 | void wxDC::GetTextExtent( const wxString& string | |
201 | ,long* x | |
202 | ,long* y | |
203 | ,long* decent | |
204 | ,long* externalLeading | |
205 | ,wxFont* theFont | |
206 | ) const | |
207 | { | |
208 | // TODO: | |
209 | } | |
0e320a79 | 210 | |
c3d43472 | 211 | long wxDC::GetCharWidth() const |
0e320a79 | 212 | { |
1408104d DW |
213 | // TODO |
214 | return(1); | |
215 | } | |
0e320a79 | 216 | |
c3d43472 | 217 | long wxDC::GetCharHeight() const |
0e320a79 | 218 | { |
1408104d DW |
219 | // TODO |
220 | return(1); | |
221 | } | |
0e320a79 | 222 | |
1408104d | 223 | void wxDC::Clear() |
0e320a79 | 224 | { |
1408104d DW |
225 | // TODO |
226 | } | |
0e320a79 | 227 | |
1408104d | 228 | void wxDC::SetFont(const wxFont& font) |
0e320a79 | 229 | { |
1408104d DW |
230 | // TODO |
231 | } | |
0e320a79 | 232 | |
1408104d | 233 | void wxDC::SetPen(const wxPen& pen) |
0e320a79 | 234 | { |
1408104d DW |
235 | // TODO |
236 | } | |
237 | void wxDC::SetBrush(const wxBrush& brush) | |
238 | { | |
239 | // TODO | |
240 | } | |
0e320a79 | 241 | |
1408104d | 242 | void wxDC::SetBackground(const wxBrush& brush) |
0e320a79 | 243 | { |
1408104d DW |
244 | // TODO |
245 | } | |
246 | ||
247 | void wxDC::SetLogicalFunction(int function) | |
0e320a79 | 248 | { |
1408104d DW |
249 | // TODO |
250 | } | |
251 | ||
252 | void wxDC::SetBackgroundMode(int mode) | |
253 | { | |
254 | // TODO | |
255 | } | |
256 | ||
257 | void wxDC::SetPalette(const wxPalette& palette) | |
258 | { | |
259 | // TODO | |
260 | } | |
261 | ||
262 | void wxDC::DoFloodFill( long x | |
263 | ,long y | |
264 | ,const wxColour& col | |
c3d43472 | 265 | ,int style |
1408104d DW |
266 | ) |
267 | { | |
268 | // TODO | |
269 | } | |
270 | ||
271 | bool wxDC::DoGetPixel(long x, long y, wxColour *col) const | |
272 | { | |
273 | // TODO | |
274 | return(TRUE); | |
275 | } | |
276 | ||
277 | void wxDC::DoDrawPoint(long x, long y) | |
278 | { | |
279 | // TODO | |
280 | } | |
281 | ||
282 | void wxDC::DoDrawLine(long x1, long y1, long x2, long y2) | |
283 | { | |
284 | // TODO | |
285 | } | |
286 | ||
287 | void wxDC::DoDrawArc( long x1, long y1 | |
288 | ,long x2, long y2 | |
289 | ,long xc, long yc | |
290 | ) | |
291 | { | |
292 | // TODO | |
293 | } | |
294 | ||
295 | void wxDC::DoDrawEllipticArc( long x | |
296 | ,long y | |
297 | ,long w | |
298 | ,long h | |
299 | ,double sa | |
300 | ,double ea | |
301 | ) | |
302 | { | |
303 | // TODO | |
304 | } | |
305 | ||
306 | void wxDC::DoDrawRectangle(long x, long y, long width, long height) | |
307 | { | |
308 | // TODO | |
309 | } | |
310 | ||
311 | void wxDC::DoDrawRoundedRectangle( long x, long y | |
312 | ,long width, long height | |
313 | ,double radius | |
314 | ) | |
315 | { | |
316 | // TODO | |
317 | } | |
318 | ||
319 | void wxDC::DoDrawEllipse(long x, long y, long width, long height) | |
320 | { | |
321 | // TODO | |
322 | } | |
323 | ||
324 | void wxDC::DoCrossHair(long x, long y) | |
325 | { | |
326 | // TODO | |
327 | } | |
328 | ||
329 | void wxDC::DoDrawIcon(const wxIcon& icon, long x, long y) | |
330 | { | |
331 | // TODO | |
332 | } | |
333 | ||
334 | void wxDC::DoDrawBitmap( const wxBitmap &bmp | |
335 | ,long x, long y | |
c3d43472 | 336 | ,bool useMask |
1408104d DW |
337 | ) |
338 | { | |
339 | // TODO | |
340 | } | |
341 | ||
342 | void wxDC::DoDrawText(const wxString& text, long x, long y) | |
343 | { | |
344 | // TODO | |
345 | } | |
346 | ||
347 | bool wxDC::DoBlit( long xdest | |
348 | ,long ydest | |
349 | ,long width | |
350 | ,long height | |
351 | ,wxDC *source | |
352 | ,long xsrc | |
353 | ,long ysrc | |
c3d43472 DW |
354 | ,int rop |
355 | ,bool useMask | |
1408104d DW |
356 | ) |
357 | { | |
358 | // TODO | |
359 | return(TRUE); | |
360 | } | |
361 | ||
1408104d DW |
362 | void wxDC::DoDrawLines( int n, wxPoint points[] |
363 | ,long xoffset, long yoffset | |
364 | ) | |
365 | { | |
366 | // TODO | |
367 | } | |
368 | ||
369 | void wxDC::DoDrawPolygon(int n, wxPoint points[] | |
370 | ,long xoffset, long yoffset | |
c3d43472 | 371 | ,int fillStyle |
1408104d DW |
372 | ) |
373 | { | |
374 | // TODO | |
375 | } | |
376 | ||
377 | void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) | |
378 | { | |
379 | // TODO | |
380 | } | |
381 | ||
382 | void wxDC::DoSetClippingRegion( long x, long y | |
383 | ,long width, long height | |
384 | ) | |
385 | { | |
386 | // TODO | |
387 | } | |
388 | ||
389 | #if wxUSE_SPLINES | |
390 | void wxDC::DoDrawSpline(wxList *points) | |
391 | { | |
392 | // TODO | |
393 | } | |
394 | #endif | |
395 | ||
396 | // | |
397 | // Private functions | |
398 | // | |
0e320a79 | 399 | |
0e320a79 | 400 |