]> git.saurik.com Git - wxWidgets.git/blob - include/wx/stubs/clipbrd.h
Rewrote wxNotebook, incl. PAGE_CHANGING event
[wxWidgets.git] / include / wx / stubs / 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 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);
37
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
41 {
42 DECLARE_ABSTRACT_CLASS(wxClipboardClient)
43
44 public:
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 */
49 wxStringList formats;
50
51 /* This method is called when the client is losing the selection. */
52 virtual void BeingReplaced() = 0;
53
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
59 NULL terminator. */
60 virtual char *GetData(char *format, long *size) = 0;
61 };
62
63 /* ONE instance of this class: */
64 class WXDLLEXPORT wxClipboard : public wxObject
65 {
66 DECLARE_DYNAMIC_CLASS(wxClipboard)
67
68 public:
69 wxClipboardClient *clipOwner;
70 char *cbString, *sentString, *receivedString;
71 void *receivedTargets;
72 long receivedLength;
73
74 wxClipboard();
75 ~wxClipboard();
76
77 /* Set the clipboard data owner. "time" comes from the event record. */
78 void SetClipboardClient(wxClipboardClient *, long time);
79
80 /* Set the clipboard string; does not require a client. */
81 void SetClipboardString(char *, long time);
82
83 /* Get data from the clipboard in the format "TEXT". */
84 char *GetClipboardString(long time);
85
86 /* Get data from the clipboard */
87 char *GetClipboardData(char *format, long *length, long time);
88
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();
95 };
96
97 /* Initialize wxTheClipboard. Can be called repeatedly */
98 void WXDLLEXPORT wxInitClipboard();
99
100 /* The clipboard */
101 WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
102
103 #endif
104 // _WX_CLIPBRD_H_