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
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
12namespace owl {
13
15
16//
17// We only want to search this mixin for events, so don't include any base
18// classes in Find()
19//
20DEFINE_RESPONSE_TABLE(TClipboardViewer)
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//
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//
46
47//
48/// Tests to see if the Clipboard has changed and, if so, DoChangeCBChain forwards
49/// this message.
50//
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//
67{
68 if (HWndNext)
69 ForwardMessage(HWndNext);
70 return esPartial;
71}
72
73//
74/// Removes the window from the Clipboard-viewer chain.
75//
82
83//
84/// Adds a window to the Clipboard-viewer chain.
85//
86void
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//
96void
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//
109void
116
117//
118/// Responds to a WM_DESTROY message when a window is removed from the
119/// Clipboard-viewer chain.
120//
121void
123{
124 if (DoDestroy() == esComplete)
125 return;
127}
128
129} // OWL namespace
130//////////////////
Mix-in class that registers as a clipboard viewer when the user interface element is created and remo...
Definition clipview.h:33
TClipboardViewer()
Constructs a TClipboardViewer object.
Definition clipview.cpp:32
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
TEventStatus DoDestroy()
Removes the window from the Clipboard-viewer chain.
Definition clipview.cpp:77
void EvDrawClipboard()
pass to next window in clipboard-viewer chain
Definition clipview.cpp:110
void SetupWindow() override
Adds a window to the Clipboard-viewer chain.
Definition clipview.cpp:87
void EvDestroy()
Responds to a WM_DESTROY message when a window is removed from the Clipboard-viewer chain.
Definition clipview.cpp:122
void EvChangeCBChain(HWND hWndRemoved, HWND hWndNext)
Responds to a WM_CHANGECBCHAIN message.
Definition clipview.cpp:97
TEventStatus DoDrawClipboard()
pass to next window in clipboard-viewer chain
Definition clipview.cpp:66
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
void EvDestroy()
Responds to an incoming WM_DESTROY message.
Definition window.cpp:2850
TResult ForwardMessage(HWND handle, bool send=true)
Forwards the window's current message.
Definition window.cpp:3302
void EvDrawClipboard()
The default message handler for WM_DRAWCLIPBOARD.
Definition window.h:3677
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
Mixin class TClipboardViewer that allows a TWindow derived class to hook in on the clipboard notifica...
#define DEFINE_RESPONSE_TABLE(cls)
Macro to define a response table for a class with no base response tables.
Definition eventhan.h:479
TEventStatus
Mixin window event implementation return status.
Definition window.h:107
@ esPartial
Additional handlers may be invoked.
Definition window.h:108
@ esComplete
No additional handlers are needed.
Definition window.h:109
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
EV_WM_DRAWCLIPBOARD
Definition clipview.cpp:23
OWL_DIAGINFO
Definition animctrl.cpp:14
END_RESPONSE_TABLE
Definition button.cpp:26
EV_WM_DESTROY
Definition clipview.cpp:22
EV_WM_CHANGECBCHAIN
Definition clipview.cpp:21