]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: dc.cpp | |
3 | // Purpose: wxDC class | |
4 | // Author: William Osborne | |
5 | // Modified by: | |
6 | // Created: 10/13/04 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) William Osborne | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // =========================================================================== | |
13 | // declarations | |
14 | // =========================================================================== | |
15 | ||
16 | // --------------------------------------------------------------------------- | |
17 | // headers | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
21 | #pragma implementation "dc.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #ifndef WX_PRECOMP | |
32 | #include "wx/window.h" | |
33 | #include "wx/dc.h" | |
34 | #include "wx/utils.h" | |
35 | #include "wx/dialog.h" | |
36 | #include "wx/app.h" | |
37 | #include "wx/bitmap.h" | |
38 | #include "wx/dcmemory.h" | |
39 | #include "wx/log.h" | |
40 | #include "wx/icon.h" | |
41 | #endif | |
42 | ||
43 | #include "wx/sysopt.h" | |
44 | #include "wx/dcprint.h" | |
45 | #include "wx/module.h" | |
46 | #include "wx/dynload.h" | |
47 | ||
48 | #ifdef wxHAVE_RAW_BITMAP | |
49 | #include "wx/rawbmp.h" | |
50 | #endif | |
51 | ||
52 | #include <string.h> | |
53 | #include <math.h> | |
54 | ||
55 | #ifndef AC_SRC_ALPHA | |
56 | #define AC_SRC_ALPHA 1 | |
57 | #endif | |
58 | ||
59 | /* Quaternary raster codes */ | |
60 | #ifndef MAKEROP4 | |
61 | #define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) | |
62 | #endif | |
63 | ||
64 | IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase) | |
65 | ||
66 | // --------------------------------------------------------------------------- | |
67 | // constants | |
68 | // --------------------------------------------------------------------------- | |
69 | ||
70 | static const int VIEWPORT_EXTENT = 1000; | |
71 | ||
72 | static const int MM_POINTS = 9; | |
73 | static const int MM_METRIC = 10; | |
74 | ||
75 | // usually this is defined in math.h | |
76 | #ifndef M_PI | |
77 | static const double M_PI = 3.14159265358979323846; | |
78 | #endif // M_PI | |
79 | ||
80 | #define DSTCOPY 0x00AA0029 | |
81 | ||
82 | // --------------------------------------------------------------------------- | |
83 | // private functions | |
84 | // --------------------------------------------------------------------------- | |
85 | ||
86 | // ---------------------------------------------------------------------------- | |
87 | // private classes | |
88 | // ---------------------------------------------------------------------------- | |
89 | ||
90 | // =========================================================================== | |
91 | // implementation | |
92 | // =========================================================================== | |
93 | ||
94 | // --------------------------------------------------------------------------- | |
95 | // wxDC | |
96 | // --------------------------------------------------------------------------- | |
97 | ||
98 | // Default constructor | |
99 | wxDC::wxDC() | |
100 | { | |
101 | } | |
102 | ||
103 | wxDC::~wxDC() | |
104 | { | |
105 | } | |
106 | ||
107 | // This will select current objects out of the DC, | |
108 | // which is what you have to do before deleting the | |
109 | // DC. | |
110 | void wxDC::SelectOldObjects(WXHDC dc) | |
111 | { | |
112 | } | |
113 | ||
114 | // --------------------------------------------------------------------------- | |
115 | // clipping | |
116 | // --------------------------------------------------------------------------- | |
117 | ||
118 | void wxDC::UpdateClipBox() | |
119 | { | |
120 | } | |
121 | ||
122 | void | |
123 | wxDC::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const | |
124 | { | |
125 | } | |
126 | ||
127 | // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion() | |
128 | void wxDC::SetClippingHrgn(WXHRGN hrgn) | |
129 | { | |
130 | } | |
131 | ||
132 | void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) | |
133 | { | |
134 | } | |
135 | ||
136 | void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) | |
137 | { | |
138 | } | |
139 | ||
140 | void wxDC::DestroyClippingRegion() | |
141 | { | |
142 | } | |
143 | ||
144 | // --------------------------------------------------------------------------- | |
145 | // query capabilities | |
146 | // --------------------------------------------------------------------------- | |
147 | ||
148 | bool wxDC::CanDrawBitmap() const | |
149 | { | |
150 | return false; | |
151 | } | |
152 | ||
153 | bool wxDC::CanGetTextExtent() const | |
154 | { | |
155 | return false; | |
156 | } | |
157 | ||
158 | int wxDC::GetDepth() const | |
159 | { | |
160 | return 0; | |
161 | } | |
162 | ||
163 | // --------------------------------------------------------------------------- | |
164 | // drawing | |
165 | // --------------------------------------------------------------------------- | |
166 | ||
167 | void wxDC::Clear() | |
168 | { | |
169 | } | |
170 | ||
171 | bool wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) | |
172 | { | |
173 | return false; | |
174 | } | |
175 | ||
176 | bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const | |
177 | { | |
178 | return false; | |
179 | } | |
180 | ||
181 | void wxDC::DoCrossHair(wxCoord x, wxCoord y) | |
182 | { | |
183 | } | |
184 | ||
185 | void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) | |
186 | { | |
187 | } | |
188 | ||
189 | // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1) | |
190 | // and ending at (x2, y2) | |
191 | void wxDC::DoDrawArc(wxCoord x1, wxCoord y1, | |
192 | wxCoord x2, wxCoord y2, | |
193 | wxCoord xc, wxCoord yc) | |
194 | { | |
195 | } | |
196 | ||
197 | void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, | |
198 | wxCoord width, wxCoord height) | |
199 | { | |
200 | } | |
201 | ||
202 | void wxDC::DoDrawPoint(wxCoord x, wxCoord y) | |
203 | { | |
204 | } | |
205 | ||
206 | void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle) | |
207 | { | |
208 | } | |
209 | ||
210 | void | |
211 | wxDC::DoDrawPolyPolygon(int n, | |
212 | int count[], | |
213 | wxPoint points[], | |
214 | wxCoord xoffset, | |
215 | wxCoord yoffset, | |
216 | int fillStyle) | |
217 | { | |
218 | } | |
219 | ||
220 | void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) | |
221 | { | |
222 | } | |
223 | ||
224 | void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) | |
225 | { | |
226 | } | |
227 | ||
228 | void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) | |
229 | { | |
230 | } | |
231 | ||
232 | void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) | |
233 | { | |
234 | } | |
235 | ||
236 | void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) | |
237 | { | |
238 | } | |
239 | ||
240 | void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) | |
241 | { | |
242 | } | |
243 | ||
244 | void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask ) | |
245 | { | |
246 | } | |
247 | ||
248 | void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) | |
249 | { | |
250 | } | |
251 | ||
252 | void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) | |
253 | { | |
254 | } | |
255 | ||
256 | void wxDC::DoDrawRotatedText(const wxString& text, | |
257 | wxCoord x, wxCoord y, | |
258 | double angle) | |
259 | { | |
260 | } | |
261 | ||
262 | // --------------------------------------------------------------------------- | |
263 | // set GDI objects | |
264 | // --------------------------------------------------------------------------- | |
265 | ||
266 | #if wxUSE_PALETTE | |
267 | ||
268 | void wxDC::DoSelectPalette(bool realize) | |
269 | { | |
270 | } | |
271 | ||
272 | void wxDC::SetPalette(const wxPalette& palette) | |
273 | { | |
274 | } | |
275 | ||
276 | void wxDC::InitializePalette() | |
277 | { | |
278 | } | |
279 | ||
280 | #endif // wxUSE_PALETTE | |
281 | ||
282 | void wxDC::SetFont(const wxFont& font) | |
283 | { | |
284 | } | |
285 | ||
286 | void wxDC::SetPen(const wxPen& pen) | |
287 | { | |
288 | } | |
289 | ||
290 | void wxDC::SetBrush(const wxBrush& brush) | |
291 | { | |
292 | } | |
293 | ||
294 | void wxDC::SetBackground(const wxBrush& brush) | |
295 | { | |
296 | } | |
297 | ||
298 | void wxDC::SetBackgroundMode(int mode) | |
299 | { | |
300 | } | |
301 | ||
302 | void wxDC::SetLogicalFunction(int function) | |
303 | { | |
304 | } | |
305 | ||
306 | void wxDC::SetRop(WXHDC dc) | |
307 | { | |
308 | } | |
309 | ||
310 | bool wxDC::StartDoc(const wxString& WXUNUSED(message)) | |
311 | { | |
312 | return true; | |
313 | } | |
314 | ||
315 | void wxDC::EndDoc() | |
316 | { | |
317 | } | |
318 | ||
319 | void wxDC::StartPage() | |
320 | { | |
321 | } | |
322 | ||
323 | void wxDC::EndPage() | |
324 | { | |
325 | } | |
326 | ||
327 | // --------------------------------------------------------------------------- | |
328 | // text metrics | |
329 | // --------------------------------------------------------------------------- | |
330 | ||
331 | wxCoord wxDC::GetCharHeight() const | |
332 | { | |
333 | return 0; | |
334 | } | |
335 | ||
336 | wxCoord wxDC::GetCharWidth() const | |
337 | { | |
338 | return 0; | |
339 | } | |
340 | ||
341 | void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, | |
342 | wxCoord *descent, wxCoord *externalLeading, | |
343 | wxFont *font) const | |
344 | { | |
345 | } | |
346 | ||
347 | ||
348 | bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const | |
349 | { | |
350 | return false; | |
351 | } | |
352 | ||
353 | ||
354 | ||
355 | ||
356 | void wxDC::SetMapMode(int mode) | |
357 | { | |
358 | } | |
359 | ||
360 | void wxDC::SetUserScale(double x, double y) | |
361 | { | |
362 | } | |
363 | ||
364 | void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp) | |
365 | { | |
366 | } | |
367 | ||
368 | void wxDC::SetSystemScale(double x, double y) | |
369 | { | |
370 | } | |
371 | ||
372 | void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y) | |
373 | { | |
374 | } | |
375 | ||
376 | void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y) | |
377 | { | |
378 | } | |
379 | ||
380 | // --------------------------------------------------------------------------- | |
381 | // coordinates transformations | |
382 | // --------------------------------------------------------------------------- | |
383 | ||
384 | wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const | |
385 | { | |
386 | return 0; | |
387 | } | |
388 | ||
389 | wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const | |
390 | { | |
391 | return 0; | |
392 | } | |
393 | ||
394 | wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const | |
395 | { | |
396 | return 0; | |
397 | } | |
398 | ||
399 | wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const | |
400 | { | |
401 | return 0; | |
402 | } | |
403 | ||
404 | wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const | |
405 | { | |
406 | return 0; | |
407 | } | |
408 | ||
409 | wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const | |
410 | { | |
411 | return 0; | |
412 | } | |
413 | ||
414 | wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const | |
415 | { | |
416 | return 0; | |
417 | } | |
418 | ||
419 | wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const | |
420 | { | |
421 | return 0; | |
422 | } | |
423 | ||
424 | // --------------------------------------------------------------------------- | |
425 | // bit blit | |
426 | // --------------------------------------------------------------------------- | |
427 | ||
428 | bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, | |
429 | wxCoord width, wxCoord height, | |
430 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
431 | int rop, bool useMask, | |
432 | wxCoord xsrcMask, wxCoord ysrcMask) | |
433 | { | |
434 | return false; | |
435 | } | |
436 | ||
437 | void wxDC::DoGetSize(int *w, int *h) const | |
438 | { | |
439 | } | |
440 | ||
441 | void wxDC::DoGetSizeMM(int *w, int *h) const | |
442 | { | |
443 | } | |
444 | ||
445 | wxSize wxDC::GetPPI() const | |
446 | { | |
447 | return wxSize(0, 0); | |
448 | } | |
449 | ||
450 | void wxDC::SetLogicalScale(double x, double y) | |
451 | { | |
452 | } | |
453 | ||
454 | // ---------------------------------------------------------------------------- | |
455 | // DC caching | |
456 | // ---------------------------------------------------------------------------- | |
457 | ||
458 | #if wxUSE_DC_CACHEING | |
459 | ||
460 | wxList wxDC::sm_bitmapCache; | |
461 | wxList wxDC::sm_dcCache; | |
462 | ||
463 | wxDCCacheEntry::wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth) | |
464 | { | |
465 | } | |
466 | ||
467 | wxDCCacheEntry::wxDCCacheEntry(WXHDC hDC, int depth) | |
468 | { | |
469 | } | |
470 | ||
471 | wxDCCacheEntry::~wxDCCacheEntry() | |
472 | { | |
473 | } | |
474 | ||
475 | wxDCCacheEntry* wxDC::FindBitmapInCache(WXHDC dc, int w, int h) | |
476 | { | |
477 | return NULL; | |
478 | } | |
479 | ||
480 | wxDCCacheEntry* wxDC::FindDCInCache(wxDCCacheEntry* notThis, WXHDC dc) | |
481 | { | |
482 | return NULL; | |
483 | } | |
484 | ||
485 | void wxDC::AddToBitmapCache(wxDCCacheEntry* entry) | |
486 | { | |
487 | } | |
488 | ||
489 | void wxDC::AddToDCCache(wxDCCacheEntry* entry) | |
490 | { | |
491 | } | |
492 | ||
493 | void wxDC::ClearCache() | |
494 | { | |
495 | } | |
496 | ||
497 | class wxDCModule : public wxModule | |
498 | { | |
499 | public: | |
500 | virtual bool OnInit() { return true; } | |
501 | virtual void OnExit() { wxDC::ClearCache(); } | |
502 | ||
503 | private: | |
504 | DECLARE_DYNAMIC_CLASS(wxDCModule) | |
505 | }; | |
506 | ||
507 | IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule) | |
508 | ||
509 | #endif // wxUSE_DC_CACHEING | |
510 |