OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
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
24
namespace
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
//
52
class
_OWLCLASS
TXGdi
:
public
TXOwl
{
53
public
:
54
TXGdi
(
uint
resId = IDS_GDIFAILURE, HANDLE handle = 0);
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
//
70
enum
TAutoDelete
{
NoAutoDelete
,
AutoDelete
};
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
//
79
class
_OWLCLASS
TGdiBase
{
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
();
92
TGdiBase
(HANDLE handle,
TAutoDelete
autoDelete =
NoAutoDelete
);
93
94
private
:
95
TGdiBase
(
const
TGdiBase
&);
// Protect against copying & assignment
96
TGdiBase
& operator =(
const
TGdiBase
&);
97
98
};
99
100
/// @}
101
102
#include <
owl/posclass.h
>
103
104
105
}
// OWL namespace
106
107
108
#endif
// OWL_GDIBASE_H
owl::TGdiBase::TGdiBase
TGdiBase()
This default constructor sets Handle to 0 and ShouldDelete to true.
Definition
gdibase.cpp:22
owl::TGdiBase::CheckValid
void CheckValid(uint resId=IDS_GDIFAILURE)
Definition
gdibase.cpp:49
owl::TGdiBase::_CheckValid
static void _CheckValid(HANDLE handle, uint resId=IDS_GDIFAILURE)
Definition
gdibase.cpp:58
owl::TGdiBase::ShouldDelete
bool ShouldDelete
Should object delete GDI handle in dtor?
Definition
gdibase.h:82
owl::TGdiBase::Handle
HANDLE Handle
GDI handle of this object.
Definition
gdibase.h:81
owl::TXGdi::Raise
static void Raise(uint resId=IDS_GDIFAILURE, HANDLE handle=0)
Throws the exception.
Definition
gdibase.cpp:112
owl::TXGdi::TXGdi
TXGdi(uint resId=IDS_GDIFAILURE, HANDLE handle=0)
Constructs a TXGdi object with a default IDS_GDIFAILURE message.
Definition
gdibase.cpp:82
owl::TXGdi::Throw
void Throw()
Throws the exception object.
Definition
gdibase.cpp:103
owl::TXGdi::Msg
static tstring Msg(uint resId, HANDLE)
Converts the resource ID to a string and returns the string message.
Definition
gdibase.cpp:74
owl::TXGdi::Clone
TXGdi * Clone()
Definition
gdibase.cpp:92
color.h
Definition of windowing system color classes.
owl::TAutoDelete
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Definition
gdibase.h:70
owl::AutoDelete
@ AutoDelete
Definition
gdibase.h:70
owl::NoAutoDelete
@ NoAutoDelete
Definition
gdibase.h:70
owl::TXOwl::TXOwl
TXOwl(const tstring &msg, uint resId=0)
An OWL exception with a given message for displaying and an unsigned Id that can be used for identifi...
Definition
except.cpp:123
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::tstring
std::string tstring
Definition
defs.h:79
owl::uint
unsigned int uint
Definition
number.h:25
defs.h
General definitions used by all ObjectWindows programs.
except.h
ObjectWindows exception class & function definitions.
defs.h
_OWLCLASS
#define _OWLCLASS
Definition
defs.h:338
posclass.h
preclass.h
include
owl
gdibase.h
Generated by
1.18.0