home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / OWLSRC.PAK / CREATEDC.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  1.9 KB  |  84 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.8  $
  6. //
  7. // Implementation of classes TCreatedDC, and TIC
  8. //----------------------------------------------------------------------------
  9. #include <owl/pch.h>
  10. #if !defined(OWL_DC_H)
  11. # include <owl/dc.h>
  12. #endif
  13.  
  14. OWL_DIAGINFO;
  15. DIAG_DECLARE_GROUP(OwlGDI);
  16.  
  17. //
  18. //
  19. //
  20. TCreatedDC::TCreatedDC()
  21. :
  22.   TDC()
  23. {
  24.   TRACEX(OwlGDI, OWL_CDLEVEL, "TCreatedDC constructed @" << (void*)this);
  25. }
  26.  
  27. //
  28. //
  29. //
  30. TCreatedDC::TCreatedDC(const char far* driver, const char far* device,
  31.                        const char far* output, const DEVMODE far* initData)
  32. :
  33.   TDC()
  34. {
  35.   Handle = ::CreateDC(driver, device, output, initData);
  36.   CheckValid();
  37.   TRACEX(OwlGDI, OWL_CDLEVEL, "TCreatedDC constructed @" << (void*)this <<
  38.     " with driver " << string(driver));
  39. }
  40.  
  41. //
  42. // Use an existing HDC. Delete it on destruction as requested
  43. //
  44. TCreatedDC::TCreatedDC(HDC handle, TAutoDelete autoDelete)
  45. :
  46.   TDC(handle, autoDelete)
  47. {
  48.   TRACEX(OwlGDI, OWL_CDLEVEL, "TCreatedDC constructed @" << (void*)this <<
  49.     " with handle " << uint(handle));
  50. }
  51.  
  52. //
  53. // Destruct the TDC by deleting the HDC if ShouldDelete is true
  54. //
  55. TCreatedDC::~TCreatedDC()
  56. {
  57.   RestoreObjects();
  58.   if (ShouldDelete && Handle)
  59.     ::DeleteDC(HDC(Handle));
  60.   TRACEX(OwlGDI, OWL_CDLEVEL, "TCreatedDC destructed @" << (void*)this);
  61. }
  62.  
  63. //
  64. //
  65. //
  66. TIC::TIC(const char far* driver, const char far* device,
  67.          const char far* output, const DEVMODE far* initData)
  68. :
  69.   TCreatedDC()
  70. {
  71.   Handle = ::CreateIC(driver, device, output, initData);
  72.   CheckValid();
  73.   TRACEX(OwlGDI, OWL_CDLEVEL, "TIC constructed @" << (void*)this <<
  74.     " with driver " << string(driver));
  75. }
  76.  
  77. //
  78. //
  79. //
  80. TIC::~TIC()
  81. {
  82.   TRACEX(OwlGDI, OWL_CDLEVEL, "TIC destructed @" << (void*)this);
  83. }
  84.