]>
Commit | Line | Data |
---|---|---|
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 | ||
33 | //----------------------------------------------------------------------------- | |
34 | // wxDCBase | |
35 | //----------------------------------------------------------------------------- | |
36 | ||
37 | long wxDCBase::DeviceToLogicalX(long x) const | |
38 | { | |
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; | |
44 | }; | |
45 | ||
46 | long wxDCBase::DeviceToLogicalY(long y) const | |
47 | { | |
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; | |
53 | }; | |
54 | ||
55 | long wxDCBase::DeviceToLogicalXRel(long x) const | |
56 | { | |
57 | if (x > 0) | |
58 | return (long)((double)(x) / m_scaleX + 0.5); | |
59 | else | |
60 | return (long)((double)(x) / m_scaleX - 0.5); | |
61 | }; | |
62 | ||
63 | long wxDCBase::DeviceToLogicalYRel(long y) const | |
64 | { | |
65 | if (y > 0) | |
66 | return (long)((double)(y) / m_scaleY + 0.5); | |
67 | else | |
68 | return (long)((double)(y) / m_scaleY - 0.5); | |
69 | }; | |
70 | ||
71 | long wxDCBase::LogicalToDeviceX(long x) const | |
72 | { | |
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; | |
78 | }; | |
79 | ||
80 | long wxDCBase::LogicalToDeviceY(long y) const | |
81 | { | |
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; | |
87 | }; | |
88 | ||
89 | long wxDCBase::LogicalToDeviceXRel(long x) const | |
90 | { | |
91 | if (x > 0) | |
92 | return (long)((double)(x) * m_scaleX + 0.5); | |
93 | else | |
94 | return (long)((double)(x) * m_scaleX - 0.5); | |
95 | }; | |
96 | ||
97 | long wxDCBase::LogicalToDeviceYRel(long y) const | |
98 | { | |
99 | if (y > 0) | |
100 | return (long)((double)(y) * m_scaleY + 0.5); | |
101 | else | |
102 | return (long)((double)(y) * m_scaleY - 0.5); | |
103 | }; | |
104 | ||
105 | //----------------------------------------------------------------------------- | |
106 | // wxDC | |
107 | //----------------------------------------------------------------------------- | |
108 | ||
109 | wxDC::wxDC(void) | |
110 | { | |
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; | |
121 | }; | |
122 | ||
123 | wxDC::~wxDC(void) | |
124 | { | |
125 | // TODO: | |
126 | }; | |
127 | ||
128 | void wxDC::DestroyClippingRegion(void) | |
129 | { | |
130 | // TODO: | |
131 | }; | |
132 | ||
133 | void wxDC::DoGetSize( int* width, int* height ) const | |
134 | { | |
135 | // TODO: | |
136 | }; | |
137 | ||
138 | void wxDC::DoGetSizeMM( int* width, int* height ) const | |
139 | { | |
140 | // TODO: | |
141 | }; | |
142 | ||
143 | void wxDC::SetMapMode( int mode ) | |
144 | { | |
145 | // TODO: | |
146 | }; | |
147 | ||
148 | void wxDC::SetUserScale( double x, double y ) | |
149 | { | |
150 | m_userScaleX = x; | |
151 | m_userScaleY = y; | |
152 | ||
153 | SetMapMode(m_mappingMode); | |
154 | }; | |
155 | ||
156 | void wxDC::SetLogicalScale( double x, double y ) | |
157 | { | |
158 | // TODO: | |
159 | }; | |
160 | ||
161 | void wxDC::SetLogicalOrigin( long x, long y ) | |
162 | { | |
163 | // TODO: | |
164 | }; | |
165 | ||
166 | void wxDC::SetDeviceOrigin( long x, long y ) | |
167 | { | |
168 | // TODO: | |
169 | }; | |
170 | ||
171 | void wxDC::SetInternalDeviceOrigin( long x, long y ) | |
172 | { | |
173 | // TODO: | |
174 | }; | |
175 | ||
176 | void wxDC::GetInternalDeviceOrigin( long *x, long *y ) | |
177 | { | |
178 | // TODO: | |
179 | }; | |
180 | ||
181 | void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) | |
182 | { | |
183 | // TODO: | |
184 | }; | |
185 | ||
186 | ||
187 | int wxDC::GetDepth() const | |
188 | { | |
189 | // TODO: | |
190 | return (1); | |
191 | } | |
192 | ||
193 | wxSize wxDC::GetPPI() const | |
194 | { | |
195 | int x = 1; | |
196 | int y = 1; | |
197 | // TODO: | |
198 | return (wxSize(x,y)); | |
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 | } | |
210 | ||
211 | long wxDC::GetCharWidth() const | |
212 | { | |
213 | // TODO | |
214 | return(1); | |
215 | } | |
216 | ||
217 | long wxDC::GetCharHeight() const | |
218 | { | |
219 | // TODO | |
220 | return(1); | |
221 | } | |
222 | ||
223 | void wxDC::Clear() | |
224 | { | |
225 | // TODO | |
226 | } | |
227 | ||
228 | void wxDC::SetFont(const wxFont& font) | |
229 | { | |
230 | // TODO | |
231 | } | |
232 | ||
233 | void wxDC::SetPen(const wxPen& pen) | |
234 | { | |
235 | // TODO | |
236 | } | |
237 | void wxDC::SetBrush(const wxBrush& brush) | |
238 | { | |
239 | // TODO | |
240 | } | |
241 | ||
242 | void wxDC::SetBackground(const wxBrush& brush) | |
243 | { | |
244 | // TODO | |
245 | } | |
246 | ||
247 | void wxDC::SetLogicalFunction(int function) | |
248 | { | |
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 | |
265 | ,int style | |
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 | |
336 | ,bool useMask | |
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 | |
354 | ,int rop | |
355 | ,bool useMask | |
356 | ) | |
357 | { | |
358 | // TODO | |
359 | return(TRUE); | |
360 | } | |
361 | ||
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 | |
371 | ,int fillStyle | |
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 | // | |
399 | ||
400 |