OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The clipboard class encapsulates the methods for the clipboard object of Windows. More...
#include <owl/clipboar.h>
Public Member Functions | |
TClipboard (HWND hWnd, bool mustOpen=true) | |
Constructs a clipboard object to grab the clipboard given a window handle. | |
~TClipboard () | |
Destruct a clipboard object & close the clipboard if open. | |
void | CloseClipboard () |
If the Clipboard is opened (IsOpen is true), closes the Clipboard. | |
bool | OpenClipboard (HWND hWnd) |
Opens the Clipboard and associates it with the window specified in Wnd. | |
operator bool () const | |
Return true if the clipboard is currently owned by this application. | |
HANDLE | GetClipboardData (uint format) const |
Retrieves data from the Clipboard in the format specified by format.The following formats are supported: | |
HWND | GetOpenClipboardWindow () const |
Retrieves the handle of the window that currently has the Clipboard open. | |
HWND | GetClipboardOwner () const |
Retrieves the handle of the window that currently owns the Clipboard, otherwise returns NULL. | |
HWND | GetClipboardViewer () const |
Retrieves the handle of the first window in the Clipboard-view chain. | |
int | GetClipboardFormatName (uint format, TCHAR *formatName, int maxCount) const |
Retrieves the name of the registered format specified by format and copies the format to the buffer pointed to by formatName. | |
int | GetPriorityClipboardFormat (uint *priorityList, int count) const |
Returns the first Clipboard format in a list. | |
int | CountClipboardFormats () const |
Returns a count of the number of types of data formats the Clipboard can use. | |
bool | IsClipboardFormatAvailable (uint format) const |
Indicates if the format specified in format exists for use in the Clipboard. | |
bool | EmptyClipboard () |
Clears the Clipboard and frees any handles to the Clipboard's data. | |
uint | RegisterClipboardFormat (const tstring &formatName) const |
Registers a new Clipboard format. | |
HANDLE | SetClipboardData (uint format, HANDLE handle) |
Copy the data onto the clipboard in the format. | |
HWND | SetClipboardViewer (HWND hWnd) const |
Adds the window specified by Wnd to the chain of windows that WM_DRAWCLIPBOARD notifies whenever the contents of the Clipboard change. | |
Static Public Attributes | |
static LPCTSTR | DefaultProtocol = _T("StdFileEditing") |
Points to a string that specifies the name of the protocol the client needs. | |
The clipboard class encapsulates the methods for the clipboard object of Windows.
TClipboard encapsulates and manipulates Clipboard data.
You can open, close, empty, and paste data in a variety of data formats between the Clipboard and the open window. An object on the Clipboard can exist in a variety of Clipboard formats, which range from bitmaps to text.
Usually, the window is in charge of manipulating Clipboard interactions between the window and the Clipboard. It does this by responding to messages sent between the Clipboard owner and the application. The following ObjectWindows event-handling functions encapsulate these Clipboard messages: EvRenderFormat - Responds to a WM_RENDERFORMAT message sent to the Clipboard owner if a specific Clipboard format that an application has requested hasn't been rendered. After the Clipboard owner renders the data in the requested format, it callsSetClipboardData to place the data on the Clipboard. EvRenderAllFormats - Responds to a message sent to the Clipboard owner if the Clipboard owner has delayed rendering a Clipboard format. After the Clipboard owner renders data in all of possible formats, it calls SetClipboardData.
The following example tests to see If there is a palette on the Clipboard. If one exists, TClipboard retrieves the palette, realizes it, and then closes the Clipboard.
Definition at line 32 of file clipboar.h.
Constructs a clipboard object to grab the clipboard given a window handle.
This is the preferred method of getting the clipboard; Throws an exception on open failure if mustOpen is true (default) mustOpen can be passed as false for compatability
Definition at line 90 of file clipboar.cpp.
References OpenClipboard().
owl::TClipboard::~TClipboard | ( | ) |
Destruct a clipboard object & close the clipboard if open.
Definition at line 100 of file clipboar.cpp.
References CloseClipboard().
void owl::TClipboard::CloseClipboard | ( | ) |
If the Clipboard is opened (IsOpen is true), closes the Clipboard.
Closing the Clipboard allows other applications to access the Clipboard.
Definition at line 111 of file clipboar.cpp.
References CloseClipboard().
|
inline |
Returns a count of the number of types of data formats the Clipboard can use.
Definition at line 224 of file clipboar.h.
|
inline |
Clears the Clipboard and frees any handles to the Clipboard's data.
Returns true if the Clipboard is empty, or false if an error occurs.
Definition at line 255 of file clipboar.h.
Retrieves data from the Clipboard in the format specified by format.The following formats are supported:
CF_BITMAP Data
is a handle to a bitmap formatCF_DIB Data
is memory bitmap with a BITMAPINFO structureCF_DIBV5 Data
is memory bitmap with a BITMAPV5HEADER structureCF_DIF Data
is in a Data Interchange Format (DIF).CF_DSPBITMAP Data
is a handle to a private bitmap formatCF_DSPENHMETAFILE Data
is a handle to a private enhanced metafile.CF_DSPMETAFILEPICT Data
is in a private metafile format.CF_DSPTEXT Data
is in a private text format.CF_ENHMETAFILE Data
is a handle to an enhanced metafile.CF_GDIOBJFIRST Data
is the start of a range of integer values for application-defined GDI object clipboard formats.CF_GDIOBJLAST Data
is the last of a range of integer values for application-defined GDI object clipboard formats.CF_HDROP Data
is a handle to type HDROP that identifies a list of files.CF_LOCALE Data
is a handle to the locale identifier associated with the clipboard text.CF_METAFILEPICT Data
is in a metafile structure.CF_OEMTEXT Data
is an array of text characters in OEM character set.CF_OWNERDISPLAT Data
is in a special format that the application must display.CF_PALETTE Data
is in a color palette format.CF_PENDATA Data
is used for pen format.CF_PRIVATEFIRST Data
is the start of a range of integer values for private clipboard formats.CF_PRIVATELAST Data
is the last of a range of integer values for private clipboard formats.CF_RIFF Data
is in Resource Interchange File Format (RIFF).CF_SYLK Data
is in symbolic Link format (SYLK).CF_TEXT Data
is stored as an array of text characters.CF_TIFF Data
is in Tag Image File Format (TIFF).CF_UNICODETEXT Data
is stored as an array of Unicode text characters.CF_WAVE Data
is in a sound wave format. Definition at line 173 of file clipboar.h.
|
inline |
Retrieves the name of the registered format specified by format and copies the format to the buffer pointed to by formatName.
maxCount specifies the maximum length of the name of the format. If the name is longer than maxCount, it is truncated.
Definition at line 208 of file clipboar.h.
|
inline |
Retrieves the handle of the window that currently owns the Clipboard, otherwise returns NULL.
Definition at line 190 of file clipboar.h.
|
inline |
Retrieves the handle of the first window in the Clipboard-view chain.
Returns NULL if there is no viewer.
Definition at line 198 of file clipboar.h.
|
inline |
Retrieves the handle of the window that currently has the Clipboard open.
If the Clipboard is not open, the return value is NULL. Once the Clipboard is opened, applications cannot modify the data.
Definition at line 182 of file clipboar.h.
Returns the first Clipboard format in a list.
priorityList points to an array that contains a list of the Clipboard formats arranged in order of priority. See GetClipboardData for the Clipboard formats.
Definition at line 217 of file clipboar.h.
Indicates if the format specified in format exists for use in the Clipboard.
See GetClipBoardData for a description of Clipboard data formats. The following code tests if the Clipboard can support the specified formats:
Definition at line 247 of file clipboar.h.
Opens the Clipboard and associates it with the window specified in Wnd.
Other applications cannot change the Clipboard data until the Clipboard is closed. Returns true if successful; otherwise, returns false.
Definition at line 125 of file clipboar.cpp.
References OpenClipboard().
|
inline |
Return true if the clipboard is currently owned by this application.
Definition at line 139 of file clipboar.h.
Registers a new Clipboard format.
formatName points to a character string that identifies the new format. If the format can be registered, the return value indicates the registered format. If the format can't be registered, the return value is 0. Once the format is registered, it can be used as a valid format in which to render the data.
Definition at line 266 of file clipboar.h.
Copy the data onto the clipboard in the format.
Sets a handle to the block of data at the location indicated by handle. format specifies the format of the data block. The Clipboard must have been opened before the data handle is set. format can be any one of the valid Clipboard formats (for example, CF_BITMAP or CF_DIB). See GetClipboardData for a list of these formats. handle is a handle to the memory location where the data data is stored. If successful, the return value is a handle to the data; if an error occurs, the return value is 0. Before the window is updated with the Clipboard data, the Clipboard must be closed.
Definition at line 282 of file clipboar.h.
Adds the window specified by Wnd to the chain of windows that WM_DRAWCLIPBOARD notifies whenever the contents of the Clipboard change.
Definition at line 290 of file clipboar.h.
Points to a string that specifies the name of the protocol the client needs.
The default protocol is "StdFileEditing," which is the name of the object linking and embedding protocol.
Definition at line 77 of file clipboar.h.