home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / GDIBASE.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  2KB  |  66 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Definition of base most abstract GDI object class
  6. //----------------------------------------------------------------------------
  7. #if !defined(OWL_GDIBASE_H)
  8. #define OWL_GDIBASE_H
  9.  
  10. #if !defined(OWL_OWLDEFS_H)
  11. # include <owl/owldefs.h>
  12. #endif
  13. #if !defined(OSL_GEOMETRY_H)
  14. # include <osl/geometry.h>
  15. #endif
  16. #if !defined(OWL_COLOR_H)
  17. # include <owl/color.h>
  18. #endif
  19. #if !defined(OWL_EXCEPT_H)
  20. # include <owl/except.h>
  21. #endif
  22.  
  23. //
  24. // Flag for Handle ctors to control Handle deletion in dtor
  25. //
  26. enum TAutoDelete { NoAutoDelete, AutoDelete };
  27.  
  28. //
  29. // class TGdiBase
  30. // ----- --------
  31. //
  32. // Root and abstract class for Windows GDI object wrappers.  Provides basic
  33. // notion of working with a GDI handle, and constructing a C++ object with
  34. // an aliased handle.
  35. //
  36. class _OWLCLASS TGdiBase {
  37.   public:
  38.     class _OWLCLASS_RTL TXGdi : public TXOwl {
  39.       public:
  40.         TXGdi(unsigned resId = IDS_GDIFAILURE, HANDLE = 0);
  41.         static string Msg(unsigned resId, HANDLE);
  42.         TXOwl* Clone();
  43.         void Throw();
  44.     };
  45.  
  46.   protected:
  47.     HANDLE      Handle;       // GDI handle of this object
  48.     bool        ShouldDelete; // Should object delete GDI handle in dtor?
  49.  
  50.     // throws exception if object is bad
  51.     void        CheckValid(uint resId = IDS_GDIFAILURE);
  52.     static void CheckValid(HANDLE handle, uint resId = IDS_GDIFAILURE);
  53.  
  54.     // constructors for use by derived classes only
  55.     TGdiBase();
  56.     TGdiBase(HANDLE handle, TAutoDelete autoDelete = NoAutoDelete);
  57.     
  58.     friend class TXGdi;
  59.  
  60.   private:
  61.     TGdiBase(const TGdiBase&); // Protect against copying & assignment
  62.     TGdiBase& operator=(const TGdiBase&);
  63. };
  64.  
  65. #endif  // OWL_GDIBASE_H
  66.