]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: clipbrd.h | |
3 | // Purpose: Clipboard functionality. | |
4 | // Note: this functionality is under review, and | |
5 | // is derived from wxWindows 1.xx code. Please contact | |
6 | // the wxWindows developers for further information. | |
7 | // Author: AUTHOR | |
8 | // Modified by: | |
9 | // Created: ??/??/98 | |
10 | // RCS-ID: $Id$ | |
11 | // Copyright: (c) AUTHOR | |
12 | // Licence: wxWindows licence | |
13 | ///////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | #ifndef _WX_CLIPBRD_H_ | |
16 | #define _WX_CLIPBRD_H_ | |
17 | ||
18 | #ifdef __GNUG__ | |
19 | #pragma interface "clipbrd.h" | |
20 | #endif | |
21 | ||
e7549107 | 22 | #if wxUSE_CLIPBOARD |
0dbd6262 SC |
23 | |
24 | #include "wx/list.h" | |
e7549107 SC |
25 | #include "wx/module.h" |
26 | #include "wx/dataobj.h" // for wxDataFormat | |
27 | ||
28 | // These functions superceded by wxClipboard, but retained in order to | |
29 | // implement wxClipboard, and for compatibility. | |
30 | ||
31 | // open/close the clipboard | |
32 | WXDLLEXPORT bool wxOpenClipboard(); | |
33 | WXDLLEXPORT bool wxIsClipboardOpened(); | |
34 | #define wxClipboardOpen wxIsClipboardOpened | |
35 | WXDLLEXPORT bool wxCloseClipboard(); | |
36 | ||
37 | // get/set data | |
38 | WXDLLEXPORT bool wxEmptyClipboard(); | |
39 | WXDLLEXPORT bool wxSetClipboardData(wxDataFormat dataFormat, | |
40 | const void *data, | |
41 | int width = 0, int height = 0); | |
42 | WXDLLEXPORT void* wxGetClipboardData(wxDataFormat dataFormat, | |
43 | long *len = NULL); | |
44 | ||
45 | // clipboard formats | |
46 | WXDLLEXPORT bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); | |
47 | WXDLLEXPORT wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); | |
48 | WXDLLEXPORT int wxRegisterClipboardFormat(wxChar *formatName); | |
49 | WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, | |
50 | wxChar *formatName, | |
51 | int maxCount); | |
52 | ||
53 | //----------------------------------------------------------------------------- | |
54 | // wxClipboard | |
55 | //----------------------------------------------------------------------------- | |
56 | ||
57 | class WXDLLEXPORT wxDataObject; | |
0dbd6262 SC |
58 | class WXDLLEXPORT wxClipboard : public wxObject |
59 | { | |
e7549107 | 60 | DECLARE_DYNAMIC_CLASS(wxClipboard) |
0dbd6262 | 61 | |
e7549107 SC |
62 | public: |
63 | wxClipboard(); | |
64 | ~wxClipboard(); | |
0dbd6262 | 65 | |
e7549107 SC |
66 | // open the clipboard before SetData() and GetData() |
67 | virtual bool Open(); | |
0dbd6262 | 68 | |
e7549107 SC |
69 | // close the clipboard after SetData() and GetData() |
70 | virtual void Close(); | |
0dbd6262 | 71 | |
e7549107 SC |
72 | // query whether the clipboard is opened |
73 | virtual bool IsOpened() const; | |
0dbd6262 | 74 | |
e7549107 SC |
75 | // set the clipboard data. all other formats will be deleted. |
76 | virtual bool SetData( wxDataObject *data ); | |
0dbd6262 | 77 | |
e7549107 SC |
78 | // add to the clipboard data. |
79 | virtual bool AddData( wxDataObject *data ); | |
0dbd6262 | 80 | |
e7549107 SC |
81 | // ask if data in correct format is available |
82 | virtual bool IsSupported( wxDataFormat format ); | |
0dbd6262 | 83 | |
e7549107 SC |
84 | // fill data with data on the clipboard (if available) |
85 | virtual bool GetData( wxDataObject& data ); | |
86 | ||
87 | // clears wxTheClipboard and the system's clipboard if possible | |
88 | virtual void Clear(); | |
89 | ||
90 | // flushes the clipboard: this means that the data which is currently on | |
91 | // clipboard will stay available even after the application exits (possibly | |
92 | // eating memory), otherwise the clipboard will be emptied on exit | |
93 | virtual bool Flush(); | |
94 | ||
95 | // X11 has two clipboards which get selected by this call. Empty on MSW. | |
96 | void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { } | |
97 | ||
98 | private: | |
99 | bool m_clearOnExit; | |
100 | }; | |
0dbd6262 | 101 | |
e7549107 | 102 | #endif // wxUSE_CLIPBOARD |
0dbd6262 SC |
103 | |
104 | #endif | |
105 | // _WX_CLIPBRD_H_ |