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