OWLNext    7.0
Borland's Object Windows Library for the modern age
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
12namespace owl {
13
15
16//
17/// Used for derived classes only.
18//
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//
30:
31 TDC(),
32 Wnd(hWnd)
33{
35 CheckValid();
36}
37
38//
39//
40//
42{
44 if (ShouldDelete)
45 ::ReleaseDC(Wnd, static_cast<HDC>(Handle));
46 Handle = nullptr;
47}
48
49//
50//
51//
57
58//
59/// Default constructor for TDesktopDC objects.
60//
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//
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//
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 {
101 }
102 else
103 {
105 }
106 CheckValid();
107}
108
109
110} // OWL namespace
111/* ========================================================================== */
112
TClientDC(HWND wnd)
Creates a TClientDC object with the given owned window.
Definition windowdc.cpp:71
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
void RestoreObjects()
Restores all the original GDI objects to this DC.
Definition dc.cpp:298
void CheckValid(uint resId=IDS_GDIFAILURE)
Definition gdibase.cpp:49
bool ShouldDelete
< The handle of this DC. Uses the base class's handle (TGdiBase::Handle.)
Definition gdibase.h:82
HANDLE Handle
< make this function available to derivatives
Definition gdibase.h:81
TDesktopDC()
Default constructor for TDesktopDC objects.
Definition windowdc.cpp:61
TNCPaintDC(HWND wnd, HRGN hPaintRgn)
Creates a TNCPaintDC object with the given owned window.
Definition windowdc.cpp:85
Derived from TDC, TWindowDC is a device context (DC) class that provides access to the entire area ow...
Definition dc.h:588
HWND Wnd
Holds a handle to the window owned by this device context.
Definition dc.h:595
TWindowDC()
Used for derived classes only.
Definition windowdc.cpp:19
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
OWL_DIAGINFO
Definition animctrl.cpp:14
General definitions used by all ObjectWindows programs.