OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
Loading...
Searching...
No Matches
windowdc.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 classes TWindowDC, TScreenDC, TDesktopDC & TClientDC
7
//----------------------------------------------------------------------------
8
#include <
owl/pch.h
>
9
#include <
owl/defs.h
>
10
#include <
owl/dc.h
>
11
12
namespace
owl
{
13
14
OWL_DIAGINFO
;
15
16
//
17
/// Used for derived classes only.
18
//
19
TWindowDC::TWindowDC
()
20
:
21
TDC
()
22
{
23
}
24
25
//
26
/// Creates a TWindow object with the given owned window. The data member Wnd is set
27
/// to wnd.
28
//
29
TWindowDC::TWindowDC
(HWND hWnd)
30
:
31
TDC
(),
32
Wnd
(hWnd)
33
{
34
Handle
= ::GetWindowDC(
Wnd
);
35
CheckValid
();
36
}
37
38
//
39
//
40
//
41
TWindowDC::~TWindowDC
()
42
{
43
RestoreObjects
();
44
if
(
ShouldDelete
)
45
::ReleaseDC(
Wnd
,
static_cast<
HDC
>
(
Handle
));
46
Handle
=
nullptr
;
47
}
48
49
//
50
//
51
//
52
TScreenDC::TScreenDC
()
53
:
54
TWindowDC
(nullptr)
55
{
56
}
57
58
//
59
/// Default constructor for TDesktopDC objects.
60
//
61
TDesktopDC::TDesktopDC
()
62
:
63
TWindowDC
(::GetDesktopWindow())
64
{
65
}
66
67
//
68
/// Creates a TClientDC object with the given owned window. The data member Wnd is
69
/// set to wnd.
70
//
71
TClientDC::TClientDC
(HWND wnd)
72
:
73
TWindowDC
()
74
{
75
Wnd
= wnd;
76
Handle
= ::GetDC(
Wnd
);
77
CheckValid
();
78
}
79
80
81
//
82
/// Creates a TNCPaintDC object with the given owned window. The data member Wnd is
83
/// set to wnd. hPaintRgn is the WParam of WM_NCPAINT.
84
//
85
TNCPaintDC::TNCPaintDC
(HWND wnd, HRGN hPaintRgn)
86
:
87
TWindowDC
()
88
{
89
Wnd
= wnd;
90
91
// hPaintRgn can be 0, 1 or handle to region. 0 means something noone says what it is, 1 means
92
// entire area (undocumented), else, according to the documentation, we own hPaintRgn, and
93
// according to the documentation of GetDCEx, if DCX_INTERSECTRGN is set, the OS owns the region
94
// and will destroy it.
95
//
96
const
auto
dcxUseStyle = 0x10000u;
// Undocumented style.
97
const
auto
regionCode =
reinterpret_cast<
INT_PTR
>
(hPaintRgn);
98
if
(regionCode == 0 || regionCode == 1)
99
{
100
Handle
= ::GetDCEx(wnd,
nullptr
, DCX_WINDOW | DCX_EXCLUDERGN | dcxUseStyle);
101
}
102
else
103
{
104
Handle
= ::GetDCEx(wnd, hPaintRgn, DCX_WINDOW | DCX_INTERSECTRGN | dcxUseStyle);
105
}
106
CheckValid
();
107
}
108
109
110
}
// OWL namespace
111
/* ========================================================================== */
112
owl::TClientDC::TClientDC
TClientDC(HWND wnd)
Creates a TClientDC object with the given owned window.
Definition
windowdc.cpp:71
owl::TDC::TDC
TDC(HDC handle)
use an existing DC, doesn't auto delete it
Definition
dc.cpp:35
owl::TDC::RestoreObjects
void RestoreObjects()
Restores all the original GDI objects to this DC.
Definition
dc.cpp:298
owl::TDC::CheckValid
void CheckValid(uint resId=IDS_GDIFAILURE)
Definition
gdibase.cpp:49
owl::TDC::ShouldDelete
bool ShouldDelete
< The handle of this DC. Uses the base class's handle (TGdiBase::Handle.)
Definition
gdibase.h:82
owl::TDC::Handle
HANDLE Handle
< make this function available to derivatives
Definition
gdibase.h:81
owl::TDesktopDC::TDesktopDC
TDesktopDC()
Default constructor for TDesktopDC objects.
Definition
windowdc.cpp:61
owl::TNCPaintDC::TNCPaintDC
TNCPaintDC(HWND wnd, HRGN hPaintRgn)
Creates a TNCPaintDC object with the given owned window.
Definition
windowdc.cpp:85
owl::TScreenDC::TScreenDC
TScreenDC()
Definition
windowdc.cpp:52
owl::TWindowDC::TWindowDC
TWindowDC(HWND wnd)
Creates a TWindow object with the given owned window.
Definition
windowdc.cpp:29
owl::TWindowDC::Wnd
HWND Wnd
Holds a handle to the window owned by this device context.
Definition
dc.h:595
owl::TWindowDC::TWindowDC
TWindowDC()
Used for derived classes only.
Definition
windowdc.cpp:19
owl::TWindowDC::~TWindowDC
~TWindowDC()
Definition
windowdc.cpp:41
dc.h
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
pch.h
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::OWL_DIAGINFO
OWL_DIAGINFO
Definition
animctrl.cpp:14
defs.h
General definitions used by all ObjectWindows programs.
source
owlcore
windowdc.cpp
Generated by
1.18.0