OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gdibase.cpp
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/// Implementation of TGdiBase, base abstract class for all GDI objects that
7/// have Handles.
8//----------------------------------------------------------------------------
9#include <owl/pch.h>
10#include <owl/gdibase.h>
11#include <stdio.h>
12
13namespace owl {
14
16
17//
18/// This default constructor sets Handle to 0 and ShouldDelete to true. This
19/// constructor is intended for use by derived classes that must set the Handle
20/// member later.
21//
23:
24 Handle(nullptr),
25 ShouldDelete(true)
26{
27 // Handle must be set and validated by the derived class.
28}
29
30//
31/// Initializes members to given values, and validates the handle.
32/// This constructor is intended for use by derived classes only.
33//
41
42#if !defined(BI_COMP_GNUC)
43#pragma warn -par // resId is never used in small model
44#endif
45//
46//
47//
48void
53
54//
55//
56//
57void
63#if !defined(BI_COMP_GNUC)
64#pragma warn .par
65#endif
66
67//----------------------------------------------------------------------------
68
69//
70/// Converts the resource ID to a string and returns the string message.
71/// \note For backward compatibility
72//
75{
76 return MakeMessage(resId, static_cast<uint>(reinterpret_cast<UINT_PTR>(handle)));
77}
78
79//
80/// Constructs a TXGdi object with a default IDS_GDIFAILURE message.
81//
88//
89// Clone the exception object for safe-throwing across Windows.
90//
91TXGdi*
93{
94 return new TXGdi(*this);
95}
96
97
98//
99/// Throws the exception object. Throw must be implemented in any class derived from
100/// TXOwl.
101//
102void
104{
105 throw *this;
106}
107
108//
109/// Throws the exception.
110//
111void
116
117} // OWL namespace
118/* ========================================================================== */
119
TGdiBase()
This default constructor sets Handle to 0 and ShouldDelete to true.
Definition gdibase.cpp:22
void CheckValid(uint resId=IDS_GDIFAILURE)
Definition gdibase.cpp:49
static void _CheckValid(HANDLE handle, uint resId=IDS_GDIFAILURE)
Definition gdibase.cpp:58
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
static void Raise(uint resId=IDS_GDIFAILURE, HANDLE handle=0)
Throws the exception.
Definition gdibase.cpp:112
TXGdi(uint resId=IDS_GDIFAILURE, HANDLE handle=0)
Constructs a TXGdi object with a default IDS_GDIFAILURE message.
Definition gdibase.cpp:82
void Throw()
Throws the exception object.
Definition gdibase.cpp:103
static tstring Msg(uint resId, HANDLE)
Converts the resource ID to a string and returns the string message.
Definition gdibase.cpp:74
TXGdi * Clone()
Definition gdibase.cpp:92
TXOwl is root class of the ObjectWindows exception hierarchy.
Definition except.h:38
Definition of base most abstract GDI object class, and associated exception class.
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Definition gdibase.h:70
@ AutoDelete
Definition gdibase.h:70
static tstring MakeMessage(uint resId, const tstring &infoStr, TModule *module=&GetGlobalModule())
Definition except.cpp:242
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
OWL_DIAGINFO
Definition animctrl.cpp:14
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25