-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathclip.h
86 lines (69 loc) · 1.85 KB
/
clip.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*****************************************
NanoShell Operating System
(C) 2022 iProgramInCpp
Clipboard Utilitary Module
******************************************/
#ifndef _CLIP_H
#define _CLIP_H
#include <main.h>
#include <memory.h>
#include <task.h>
#include <string.h>
enum
{
CLIPBOARD_DATA_NONE,
CLIPBOARD_DATA_INTEGER,
CLIPBOARD_DATA_BINARY,
CLIPBOARD_DATA_TEXT,
CLIPBOARD_DATA_LARGE_TEXT,
// Add more clipboard data types here. Unknown clipboard data types will be treated as generic binaries
CLIPBOARD_CABINET_COPY,
};
typedef struct
{
SafeLock m_lock;
int m_type;
char m_short_str[256];
int m_blob_size;
union {
int m_int_data;
void *m_generic_data_ptr;
char *m_char_str;
};
}
ClipboardVariant;
/**
* Gets the contents of the clipboard. Use CbRelease to release them.
*/
ClipboardVariant* CbGetCurrentVariant();
/**
* Releases the contents of the clipboard, so that other programs can use it.
*/
void CbRelease(ClipboardVariant*);
/**
* This is a function for testing. It types a small block of text from the clipboard (CLIPBOARD_DATA_TEXT)
* as if it were a sequence of keyboard key presses.
*/
bool CbPushTextIntoBuffer();
/**
* Clears the clipboard.
*/
void CbClear(); // clears the current variant by grabbing it for you
void CbClearUnsafe(); // clears the current variant, assumes that you already own it
/**
* Copies a block of text to the clipboard. If the function succeeds, it returns true.
*/
bool CbCopyText(const char* pText);
/**
* Copies a binary blob to the clipboard. If the function succeeds, it returns true.
*/
bool CbCopyBlob(void* pBlob, size_t size);
/**
* Debug: Dumps the contents of the clipboard to the console.
*/
void CbDump();
/**
* Initializes the clipboard.
*/
void CbInit();
#endif