OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
Loading...
Searching...
No Matches
clipview.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 class TClipboardViewer, a TWindow mixin that allows a
7
/// window to receive clipboard notifications appropriate for being a viewer
8
//----------------------------------------------------------------------------
9
#include <
owl/pch.h
>
10
#include <
owl/clipview.h
>
11
12
namespace
owl
{
13
14
OWL_DIAGINFO
;
15
16
//
17
// We only want to search this mixin for events, so don't include any base
18
// classes in Find()
19
//
20
DEFINE_RESPONSE_TABLE
(
TClipboardViewer
)
21
EV_WM_CHANGECBCHAIN
,
22
EV_WM_DESTROY
,
23
EV_WM_DRAWCLIPBOARD
,
24
END_RESPONSE_TABLE
;
25
26
//
27
/// Constructs a TClipboardViewer object.
28
//
29
/// Rely on TWindow's default ctor since we will always be mixed-in and another
30
/// window will perform Init()
31
//
32
TClipboardViewer
::
TClipboardViewer
()
33
{
34
HWndNext =
nullptr
;
35
}
36
37
//
38
/// Constructs a TClipboardViewer object with a handle (hWnd) to the windows that
39
/// will receive notification when the Clipboard's contents are changed.
40
//
41
TClipboardViewer::TClipboardViewer
(
THandle
handle,
TModule
* module)
42
:
43
TWindow
(handle, module)
44
{
45
}
46
47
//
48
/// Tests to see if the Clipboard has changed and, if so, DoChangeCBChain forwards
49
/// this message.
50
//
51
TEventStatus
52
TClipboardViewer::DoChangeCBChain
(
THandle
hWndRemoved,
THandle
hWndNext)
53
{
54
if
(hWndRemoved == HWndNext)
55
HWndNext = hWndNext;
56
57
else
58
ForwardMessage
(HWndNext);
59
return
esComplete
;
60
}
61
62
//
63
/// Handles EvDrawClipboard messages.
64
//
65
TEventStatus
66
TClipboardViewer::DoDrawClipboard
()
67
{
68
if
(HWndNext)
69
ForwardMessage
(HWndNext);
70
return
esPartial
;
71
}
72
73
//
74
/// Removes the window from the Clipboard-viewer chain.
75
//
76
TEventStatus
77
TClipboardViewer::DoDestroy
()
78
{
79
::ChangeClipboardChain(
GetHandle
(), HWndNext);
80
return
esPartial
;
81
}
82
83
//
84
/// Adds a window to the Clipboard-viewer chain.
85
//
86
void
87
TClipboardViewer::SetupWindow
()
88
{
89
HWndNext = ::SetClipboardViewer(
GetHandle
());
90
}
91
92
//
93
/// Responds to a WM_CHANGECBCHAIN message. hWndRemoved is a handle to the window
94
/// that's being removed. hWndNext is the window following the removed window.
95
//
96
void
97
TClipboardViewer::EvChangeCBChain
(HWND hWndRemoved, HWND hWndNext)
98
{
99
if
(hWndRemoved == hWndNext)
100
HWndNext = hWndNext;
101
else
102
ForwardMessage
(HWndNext);
103
}
104
105
//
106
/// Responds to a WM_DRAWCLIPBOARD message sent to the window in the
107
/// Clipboard-viewer chain when the contents of the Clipboard change.
108
//
109
void
110
TClipboardViewer::EvDrawClipboard
()
111
{
112
if
(
DoDrawClipboard
() ==
esComplete
)
113
return
;
114
TWindow::EvDrawClipboard
();
115
}
116
117
//
118
/// Responds to a WM_DESTROY message when a window is removed from the
119
/// Clipboard-viewer chain.
120
//
121
void
122
TClipboardViewer::EvDestroy
()
123
{
124
if
(
DoDestroy
() ==
esComplete
)
125
return
;
126
TWindow::EvDestroy
();
127
}
128
129
}
// OWL namespace
130
//////////////////
owl::TClipboardViewer
Mix-in class that registers as a clipboard viewer when the user interface element is created and remo...
Definition
clipview.h:33
owl::TClipboardViewer::TClipboardViewer
TClipboardViewer()
Constructs a TClipboardViewer object.
Definition
clipview.cpp:32
owl::TClipboardViewer::DoChangeCBChain
TEventStatus DoChangeCBChain(HWND hWndRemoved, HWND hWndNext)
Tests to see if the Clipboard has changed and, if so, DoChangeCBChain forwards this message.
Definition
clipview.cpp:52
owl::TClipboardViewer::DoDestroy
TEventStatus DoDestroy()
Removes the window from the Clipboard-viewer chain.
Definition
clipview.cpp:77
owl::TClipboardViewer::EvDrawClipboard
void EvDrawClipboard()
pass to next window in clipboard-viewer chain
Definition
clipview.cpp:110
owl::TClipboardViewer::SetupWindow
void SetupWindow() override
Adds a window to the Clipboard-viewer chain.
Definition
clipview.cpp:87
owl::TClipboardViewer::EvDestroy
void EvDestroy()
Responds to a WM_DESTROY message when a window is removed from the Clipboard-viewer chain.
Definition
clipview.cpp:122
owl::TClipboardViewer::EvChangeCBChain
void EvChangeCBChain(HWND hWndRemoved, HWND hWndNext)
Responds to a WM_CHANGECBCHAIN message.
Definition
clipview.cpp:97
owl::TClipboardViewer::DoDrawClipboard
TEventStatus DoDrawClipboard()
pass to next window in clipboard-viewer chain
Definition
clipview.cpp:66
owl::TModule
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition
module.h:78
owl::TWindow::TWindow
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
Definition
window.cpp:341
owl::TWindow::EvDestroy
void EvDestroy()
Responds to an incoming WM_DESTROY message.
Definition
window.cpp:2850
owl::TWindow::ForwardMessage
TResult ForwardMessage(HWND handle, bool send=true)
Forwards the window's current message.
Definition
window.cpp:3302
owl::TWindow::EvDrawClipboard
void EvDrawClipboard()
The default message handler for WM_DRAWCLIPBOARD.
Definition
window.h:3677
owl::TWindow::THandle
HWND THandle
TWindow encapsulates an HWND.
Definition
window.h:418
owl::TWindow::GetHandle
HWND GetHandle() const
Returns the handle of the window.
Definition
window.h:2020
clipview.h
Mixin class TClipboardViewer that allows a TWindow derived class to hook in on the clipboard notifica...
DEFINE_RESPONSE_TABLE
#define DEFINE_RESPONSE_TABLE(cls)
Macro to define a response table for a class with no base response tables.
Definition
eventhan.h:479
owl::TEventStatus
TEventStatus
Mixin window event implementation return status.
Definition
window.h:107
owl::esPartial
@ esPartial
Additional handlers may be invoked.
Definition
window.h:108
owl::esComplete
@ esComplete
No additional handlers are needed.
Definition
window.h:109
pch.h
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::EV_WM_DRAWCLIPBOARD
EV_WM_DRAWCLIPBOARD
Definition
clipview.cpp:23
owl::OWL_DIAGINFO
OWL_DIAGINFO
Definition
animctrl.cpp:14
owl::END_RESPONSE_TABLE
END_RESPONSE_TABLE
Definition
button.cpp:26
owl::EV_WM_DESTROY
EV_WM_DESTROY
Definition
clipview.cpp:22
owl::EV_WM_CHANGECBCHAIN
EV_WM_CHANGECBCHAIN
Definition
clipview.cpp:21
source
owlcore
clipview.cpp
Generated by
1.18.0