1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Clipboard functionality
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CLIPBRD_H_
13 #define _WX_CLIPBRD_H_
16 #pragma interface "clipbrd.h"
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
);
37 /* The following is Matthew Flatt's implementation of the MSW
38 * side of generic clipboard functionality.
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
45 DECLARE_ABSTRACT_CLASS(wxClipboardClient
)
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 */
54 /* This method is called when the client is losing the selection. */
55 virtual void BeingReplaced(void) = 0;
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
63 virtual char *GetData(char *format
, long *size
) = 0;
66 /* ONE instance of this class: */
67 class WXDLLEXPORT wxClipboard
: public wxObject
69 DECLARE_DYNAMIC_CLASS(wxClipboard
)
72 wxClipboardClient
*clipOwner
;
73 char *cbString
, *sentString
, *receivedString
;
74 void *receivedTargets
;
83 /* Set the clipboard data owner. "time" comes from the event record. */
84 void SetClipboardClient(wxClipboardClient
*, long time
);
86 /* Set the clipboard string; does not require a client. */
87 void SetClipboardString(char *, long time
);
89 /* Get data from the clipboard in the format "TEXT". */
90 char *GetClipboardString(long time
);
92 /* Get data from the clipboard */
93 char *GetClipboardData(char *format
, long *length
, long time
);
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);
103 /* Initialize wxTheClipboard. Can be called repeatedly */
104 void WXDLLEXPORT
wxInitClipboard(void);
107 WXDLLEXPORT_DATA(extern wxClipboard
*) wxTheClipboard
;
109 #endif // USE_CLIPBOARD