]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/clipbrd.h
4d3658ed3c2b6ef8c88f6c9f87e106ed2c0171b1
[wxWidgets.git] / include / wx / mac / clipbrd.h
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
22 #include "wx/defs.h"
23 #include "wx/setup.h"
24
25 #include "wx/list.h"
26
27 /* A clipboard client holds data belonging to the clipboard.
28 For plain text, a client is not necessary. */
29 class WXDLLEXPORT wxClipboardClient : public wxObject
30 {
31 DECLARE_ABSTRACT_CLASS(wxClipboardClient)
32
33 public:
34 /* This list should be filled in with strings indicating the formats
35 this client can provide. Almost all clients will provide "TEXT".
36 Format names should be 4 characters long, so things will work
37 out on the Macintosh */
38 wxStringList formats;
39
40 /* This method is called when the client is losing the selection. */
41 virtual void BeingReplaced() = 0;
42
43 /* This method is called when someone wants the data this client is
44 supplying to the clipboard. "format" is a string indicating the
45 format of the data - one of the strings from the "formats"
46 list. "*size" should be filled with the size of the resulting
47 data. In the case of text, "*size" does not count the
48 NULL terminator. */
49 virtual char *GetData(char *format, long *size) = 0;
50 };
51
52 /* ONE instance of this class: */
53 class WXDLLEXPORT wxClipboard : public wxObject
54 {
55 DECLARE_DYNAMIC_CLASS(wxClipboard)
56
57 public:
58 wxClipboardClient *clipOwner;
59 char *cbString, *sentString, *receivedString;
60 void *receivedTargets;
61 long receivedLength;
62
63 wxClipboard();
64 ~wxClipboard();
65
66 /* Set the clipboard data owner. "time" comes from the event record. */
67 void SetClipboardClient(wxClipboardClient *, long time);
68
69 /* Set the clipboard string; does not require a client. */
70 void SetClipboardString(char *, long time);
71
72 /* Get data from the clipboard in the format "TEXT". */
73 char *GetClipboardString(long time);
74
75 /* Get data from the clipboard */
76 char *GetClipboardData(char *format, long *length, long time);
77
78 /* Get the clipboard client directly. Will be NULL if clipboard data
79 is a string, or if some other application owns the clipboard.
80 This can be useful for shortcutting data translation, if the
81 clipboard user can check for a specific client. (This is used
82 by the wxMediaEdit class.) */
83 wxClipboardClient *GetClipboardClient();
84 };
85
86 /* Initialize wxTheClipboard. Can be called repeatedly */
87 void WXDLLEXPORT wxInitClipboard();
88
89 /* The clipboard */
90 WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
91
92 #endif
93 // _WX_CLIPBRD_H_