1 /////////////////////////////////////////////////////////////////////////////
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.
11 // Copyright: (c) AUTHOR
12 // Licence: wxWindows licence
13 /////////////////////////////////////////////////////////////////////////////
15 #ifndef _WX_CLIPBRD_H_
16 #define _WX_CLIPBRD_H_
19 #pragma interface "clipbrd.h"
27 bool WXDLLEXPORT
wxOpenClipboard();
28 bool WXDLLEXPORT
wxClipboardOpen();
29 bool WXDLLEXPORT
wxCloseClipboard();
30 bool WXDLLEXPORT
wxEmptyClipboard();
31 bool WXDLLEXPORT
wxIsClipboardFormatAvailable(int dataFormat
);
32 bool WXDLLEXPORT
wxSetClipboardData(int dataFormat
, wxObject
*obj
, int width
= 0, int height
= 0);
33 wxObject
* WXDLLEXPORT
wxGetClipboardData(int dataFormat
, long *len
= NULL
);
34 int WXDLLEXPORT
wxEnumClipboardFormats(int dataFormat
);
35 int WXDLLEXPORT
wxRegisterClipboardFormat(char *formatName
);
36 bool WXDLLEXPORT
wxGetClipboardFormatName(int dataFormat
, char *formatName
, int maxCount
);
38 /* A clipboard client holds data belonging to the clipboard.
39 For plain text, a client is not necessary. */
40 class WXDLLEXPORT wxClipboardClient
: public wxObject
42 DECLARE_ABSTRACT_CLASS(wxClipboardClient
)
45 /* This list should be filled in with strings indicating the formats
46 this client can provide. Almost all clients will provide "TEXT".
47 Format names should be 4 characters long, so things will work
48 out on the Macintosh */
51 /* This method is called when the client is losing the selection. */
52 virtual void BeingReplaced() = 0;
54 /* This method is called when someone wants the data this client is
55 supplying to the clipboard. "format" is a string indicating the
56 format of the data - one of the strings from the "formats"
57 list. "*size" should be filled with the size of the resulting
58 data. In the case of text, "*size" does not count the
60 virtual char *GetData(char *format
, long *size
) = 0;
63 /* ONE instance of this class: */
64 class WXDLLEXPORT wxClipboard
: public wxObject
66 DECLARE_DYNAMIC_CLASS(wxClipboard
)
69 wxClipboardClient
*clipOwner
;
70 char *cbString
, *sentString
, *receivedString
;
71 void *receivedTargets
;
77 /* Set the clipboard data owner. "time" comes from the event record. */
78 void SetClipboardClient(wxClipboardClient
*, long time
);
80 /* Set the clipboard string; does not require a client. */
81 void SetClipboardString(char *, long time
);
83 /* Get data from the clipboard in the format "TEXT". */
84 char *GetClipboardString(long time
);
86 /* Get data from the clipboard */
87 char *GetClipboardData(char *format
, long *length
, long time
);
89 /* Get the clipboard client directly. Will be NULL if clipboard data
90 is a string, or if some other application owns the clipboard.
91 This can be useful for shortcutting data translation, if the
92 clipboard user can check for a specific client. (This is used
93 by the wxMediaEdit class.) */
94 wxClipboardClient
*GetClipboardClient();
97 /* Initialize wxTheClipboard. Can be called repeatedly */
98 void WXDLLEXPORT
wxInitClipboard();
101 WXDLLEXPORT_DATA(extern wxClipboard
*) wxTheClipboard
;