clipboard.h (3804B)
1/** 2 * WinPR: Windows Portable Runtime 3 * Clipboard Functions 4 * 5 * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef WINPR_CLIPBOARD_H 21#define WINPR_CLIPBOARD_H 22 23#include <winpr/winpr.h> 24#include <winpr/wtypes.h> 25 26typedef struct _wClipboard wClipboard; 27 28typedef void* (*CLIPBOARD_SYNTHESIZE_FN)(wClipboard* clipboard, UINT32 formatId, const void* data, 29 UINT32* pSize); 30 31struct _wClipboardFileSizeRequest 32{ 33 UINT32 streamId; 34 UINT32 listIndex; 35}; 36typedef struct _wClipboardFileSizeRequest wClipboardFileSizeRequest; 37 38struct _wClipboardFileRangeRequest 39{ 40 UINT32 streamId; 41 UINT32 listIndex; 42 UINT32 nPositionLow; 43 UINT32 nPositionHigh; 44 UINT32 cbRequested; 45}; 46typedef struct _wClipboardFileRangeRequest wClipboardFileRangeRequest; 47 48typedef struct _wClipboardDelegate wClipboardDelegate; 49 50struct _wClipboardDelegate 51{ 52 wClipboard* clipboard; 53 void* custom; 54 char* basePath; 55 56 UINT (*ClientRequestFileSize)(wClipboardDelegate*, const wClipboardFileSizeRequest*); 57 UINT(*ClipboardFileSizeSuccess) 58 (wClipboardDelegate*, const wClipboardFileSizeRequest*, UINT64 fileSize); 59 UINT(*ClipboardFileSizeFailure) 60 (wClipboardDelegate*, const wClipboardFileSizeRequest*, UINT errorCode); 61 62 UINT (*ClientRequestFileRange)(wClipboardDelegate*, const wClipboardFileRangeRequest*); 63 UINT(*ClipboardFileRangeSuccess) 64 (wClipboardDelegate*, const wClipboardFileRangeRequest*, const BYTE* data, UINT32 size); 65 UINT(*ClipboardFileRangeFailure) 66 (wClipboardDelegate*, const wClipboardFileRangeRequest*, UINT errorCode); 67 68 BOOL (*IsFileNameComponentValid)(LPCWSTR lpFileName); 69}; 70 71#ifdef __cplusplus 72extern "C" 73{ 74#endif 75 76 WINPR_API void ClipboardLock(wClipboard* clipboard); 77 WINPR_API void ClipboardUnlock(wClipboard* clipboard); 78 79 WINPR_API BOOL ClipboardEmpty(wClipboard* clipboard); 80 WINPR_API UINT32 ClipboardCountFormats(wClipboard* clipboard); 81 WINPR_API UINT32 ClipboardGetFormatIds(wClipboard* clipboard, UINT32** ppFormatIds); 82 83 WINPR_API UINT32 ClipboardCountRegisteredFormats(wClipboard* clipboard); 84 WINPR_API UINT32 ClipboardGetRegisteredFormatIds(wClipboard* clipboard, UINT32** ppFormatIds); 85 WINPR_API UINT32 ClipboardRegisterFormat(wClipboard* clipboard, const char* name); 86 87 WINPR_API BOOL ClipboardRegisterSynthesizer(wClipboard* clipboard, UINT32 formatId, 88 UINT32 syntheticId, 89 CLIPBOARD_SYNTHESIZE_FN pfnSynthesize); 90 91 WINPR_API UINT32 ClipboardGetFormatId(wClipboard* clipboard, const char* name); 92 WINPR_API const char* ClipboardGetFormatName(wClipboard* clipboard, UINT32 formatId); 93 WINPR_API void* ClipboardGetData(wClipboard* clipboard, UINT32 formatId, UINT32* pSize); 94 WINPR_API BOOL ClipboardSetData(wClipboard* clipboard, UINT32 formatId, const void* data, 95 UINT32 size); 96 97 WINPR_API UINT64 ClipboardGetOwner(wClipboard* clipboard); 98 WINPR_API void ClipboardSetOwner(wClipboard* clipboard, UINT64 ownerId); 99 100 WINPR_API wClipboardDelegate* ClipboardGetDelegate(wClipboard* clipboard); 101 102 WINPR_API wClipboard* ClipboardCreate(void); 103 WINPR_API void ClipboardDestroy(wClipboard* clipboard); 104 105#ifdef __cplusplus 106} 107#endif 108 109#endif /* WINPR_CLIPBOARD_H */