OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
gdibase.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of base most abstract GDI object class, and associated exception
7/// class
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_GDIBASE_H)
11#define OWL_GDIBASE_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/defs.h>
19#include <owl/color.h>
20#include <owl/except.h>
21
22
23
24namespace owl {
25
26#include <owl/preclass.h>
27
28/// \addtogroup except
29/// @{
30/// \class TXGdi
31// ~~~~~ ~~~~~
32/// Describes an exception resulting from GDI failures such as creating too many
33/// TWindow device contexts (DCs). This exception occurs, for example, if a DC
34/// driver cannot be located or if a device-independent bitmap (DIB) file cannot be
35/// read.
36///
37/// The following code from the PAINT.CPP sample program on BC5.0x distribution disk
38/// throws a TXGdi exception if a new DIB cannot be created.
39/// \code
40/// void TCanvas::NewDib(int width, int height, int nColors)
41/// {
42/// TDib* dib;
43/// try {
44/// dib = new TDib(width, height, nColors);
45/// }
46/// catch (TXGdi& x) {
47/// MessageBox("Could Not Create DIB", GetApplication()->Name, MB_OK);
48/// return;
49/// }
50/// \endcode
51//
52class _OWLCLASS TXGdi : public TXOwl {
53 public:
55
56 static tstring Msg(uint resId, HANDLE);
57
58 TXGdi* Clone();
59 void Throw();
60
61 static void Raise(uint resId = IDS_GDIFAILURE, HANDLE handle = 0);
62};
63/// @}
64
65/// \addtogroup base
66/// @{
67//
68/// Flag for Handle ctors to control Handle deletion in dtor
69//
71
72//
73/// \class TGdiBase
74// ~~~~~ ~~~~~~~~
75/// Root and abstract class for Windows object wrappers. Provides basic
76/// notion of working with a handle, and constructing a C++ object with
77/// an aliased handle.
78//
80 protected:
81 HANDLE Handle; ///< GDI handle of this object
82 bool ShouldDelete; ///< Should object delete GDI handle in dtor?
83
84 // Throws exception if object is bad
85 //
86 void CheckValid(uint resId = IDS_GDIFAILURE);
87 static void _CheckValid(HANDLE handle, uint resId = IDS_GDIFAILURE);
88
89 // Constructors for use by derived classes only
90 //
91 TGdiBase();
93
94 private:
95 TGdiBase(const TGdiBase&); // Protect against copying & assignment
97
98};
99
100/// @}
101
102#include <owl/posclass.h>
103
104
105} // OWL namespace
106
107
108#endif // OWL_GDIBASE_H
Root and abstract class for Windows object wrappers.
Definition gdibase.h:79
bool ShouldDelete
Should object delete GDI handle in dtor?
Definition gdibase.h:82
HANDLE Handle
GDI handle of this object.
Definition gdibase.h:81
Describes an exception resulting from GDI failures such as creating too many TWindow device contexts ...
Definition gdibase.h:52
TXOwl is root class of the ObjectWindows exception hierarchy.
Definition except.h:38
Definition of windowing system color classes.
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Definition gdibase.h:70
@ AutoDelete
Definition gdibase.h:70
@ NoAutoDelete
Definition gdibase.h:70
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
General definitions used by all ObjectWindows programs.
ObjectWindows exception class & function definitions.
#define _OWLCLASS
Definition defs.h:338