]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: clipbrd.h | |
3 | // Purpose: Clipboard functionality | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc JS |
8 | // Copyright: (c) Julian Smart |
9 | // Licence: wxWindows licence | |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_CLIPBRD_H_ |
13 | #define _WX_CLIPBRD_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
16 | #pragma interface "clipbrd.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | #include "wx/setup.h" | |
21 | ||
47d67540 | 22 | #if wxUSE_CLIPBOARD |
2bda0e17 KB |
23 | |
24 | #include "wx/list.h" | |
25 | ||
26 | bool WXDLLEXPORT wxOpenClipboard(void); | |
27 | bool WXDLLEXPORT wxClipboardOpen(void); | |
28 | bool WXDLLEXPORT wxCloseClipboard(void); | |
29 | bool WXDLLEXPORT wxEmptyClipboard(void); | |
30 | bool WXDLLEXPORT wxIsClipboardFormatAvailable(int dataFormat); | |
31 | bool WXDLLEXPORT wxSetClipboardData(int dataFormat, wxObject *obj, int width = 0, int height = 0); | |
32 | wxObject* WXDLLEXPORT wxGetClipboardData(int dataFormat, long *len = NULL); | |
33 | int WXDLLEXPORT wxEnumClipboardFormats(int dataFormat); | |
34 | int WXDLLEXPORT wxRegisterClipboardFormat(char *formatName); | |
35 | bool WXDLLEXPORT wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount); | |
36 | ||
37 | /* The following is Matthew Flatt's implementation of the MSW | |
38 | * side of generic clipboard functionality. | |
39 | */ | |
40 | ||
41 | /* A clipboard client holds data belonging to the clipboard. | |
42 | For plain text, a client is not necessary. */ | |
43 | class WXDLLEXPORT wxClipboardClient : public wxObject | |
44 | { | |
45 | DECLARE_ABSTRACT_CLASS(wxClipboardClient) | |
46 | ||
47 | public: | |
48 | /* This list should be filled in with strings indicating the formats | |
49 | this client can provide. Almost all clients will provide "TEXT". | |
50 | Format names should be 4 characters long, so things will work | |
51 | out on the Macintosh */ | |
52 | wxStringList formats; | |
53 | ||
54 | /* This method is called when the client is losing the selection. */ | |
55 | virtual void BeingReplaced(void) = 0; | |
56 | ||
57 | /* This method is called when someone wants the data this client is | |
58 | supplying to the clipboard. "format" is a string indicating the | |
59 | format of the data - one of the strings from the "formats" | |
60 | list. "*size" should be filled with the size of the resulting | |
61 | data. In the case of text, "*size" does not count the | |
62 | NULL terminator. */ | |
63 | virtual char *GetData(char *format, long *size) = 0; | |
64 | }; | |
65 | ||
66 | /* ONE instance of this class: */ | |
67 | class WXDLLEXPORT wxClipboard : public wxObject | |
68 | { | |
69 | DECLARE_DYNAMIC_CLASS(wxClipboard) | |
70 | ||
71 | public: | |
72 | wxClipboardClient *clipOwner; | |
73 | char *cbString, *sentString, *receivedString; | |
74 | void *receivedTargets; | |
75 | long receivedLength; | |
76 | #ifdef __XVIEW__ | |
77 | long sel_owner; | |
78 | #endif | |
79 | ||
80 | wxClipboard(); | |
81 | ~wxClipboard(); | |
82 | ||
83 | /* Set the clipboard data owner. "time" comes from the event record. */ | |
84 | void SetClipboardClient(wxClipboardClient *, long time); | |
85 | ||
86 | /* Set the clipboard string; does not require a client. */ | |
87 | void SetClipboardString(char *, long time); | |
88 | ||
89 | /* Get data from the clipboard in the format "TEXT". */ | |
90 | char *GetClipboardString(long time); | |
91 | ||
92 | /* Get data from the clipboard */ | |
93 | char *GetClipboardData(char *format, long *length, long time); | |
94 | ||
95 | /* Get the clipboard client directly. Will be NULL if clipboard data | |
96 | is a string, or if some other application owns the clipboard. | |
97 | This can be useful for shortcutting data translation, if the | |
98 | clipboard user can check for a specific client. (This is used | |
99 | by the wxMediaEdit class.) */ | |
100 | wxClipboardClient *GetClipboardClient(void); | |
101 | }; | |
102 | ||
103 | /* Initialize wxTheClipboard. Can be called repeatedly */ | |
104 | void WXDLLEXPORT wxInitClipboard(void); | |
105 | ||
106 | /* The clipboard */ | |
b823f5a1 | 107 | WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard; |
2bda0e17 | 108 | |
47d67540 | 109 | #endif // wxUSE_CLIPBOARD |
2bda0e17 | 110 | #endif |
bbcdf8bc | 111 | // _WX_CLIPBRD_H_ |