home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / GDIBASE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  1.8 KB  |  62 lines

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