]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: _clipbrd.i | |
3 | // Purpose: SWIG definitions for the Clipboard | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 31-October-1999 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | %newgroup | |
18 | ||
19 | %{ | |
20 | %} | |
21 | ||
22 | DocStr(wxClipboard, | |
23 | ||
24 | "wx.Clipboard represents the system clipboard and provides methods to copy data | |
25 | to or paste data from it. Normally, you should only use wx.TheClipboard which | |
26 | is a reference to a global wx.Clipboard instance. | |
27 | ||
28 | Call wx.TheClipboard.Open to get ownership of the clipboard. If this operation | |
29 | returns True, you now own the clipboard. Call wx.TheClipboard.SetData to put | |
30 | data on the clipboard, or wx.TheClipboard.GetData to retrieve data from the | |
31 | clipboard. Call wx.TheClipboard.Close to close the clipboard and relinquish | |
32 | ownership. You should keep the clipboard open only momentarily. | |
33 | "); | |
34 | ||
35 | ||
36 | ||
37 | class wxClipboard : public wxObject { | |
38 | public: | |
39 | DocCtorStr( wxClipboard(), "" ); | |
40 | ||
41 | ~wxClipboard(); | |
42 | ||
43 | ||
44 | DocDeclStr( | |
45 | virtual bool , Open(), | |
46 | "Call this function to open the clipboard before calling SetData\n" | |
47 | "and GetData. Call Close when you have finished with the clipboard.\n" | |
48 | "You should keep the clipboard open for only a very short time.\n" | |
49 | "Returns true on success. "); | |
50 | ||
51 | ||
52 | DocDeclStr( | |
53 | virtual void , Close(), | |
54 | "Closes the clipboard."); | |
55 | ||
56 | ||
57 | DocDeclStr( | |
58 | virtual bool , IsOpened() const, | |
59 | "Query whether the clipboard is opened"); | |
60 | ||
61 | ||
62 | ||
63 | %apply SWIGTYPE *DISOWN { wxDataObject *data }; | |
64 | ||
65 | DocDeclStr( | |
66 | virtual bool , AddData( wxDataObject *data ), | |
67 | "Call this function to add the data object to the clipboard. You\n" | |
68 | "may call this function repeatedly after having cleared the clipboard.\n" | |
69 | "After this function has been called, the clipboard owns the data, so\n" | |
70 | "do not delete the data explicitly."); | |
71 | ||
72 | ||
73 | DocDeclStr( | |
74 | virtual bool , SetData( wxDataObject *data ), | |
75 | "Set the clipboard data, this is the same as Clear followed by AddData."); | |
76 | ||
77 | ||
78 | %clear wxDataObject *data; | |
79 | ||
80 | ||
81 | DocDeclStr( | |
82 | virtual bool , IsSupported( const wxDataFormat& format ), | |
83 | "Returns True if the given format is available in the data object(s) on\n" | |
84 | "the clipboard."); | |
85 | ||
86 | DocDeclStr( | |
87 | virtual bool , GetData( wxDataObject& data ), | |
88 | "Call this function to fill data with data on the clipboard, if available\n" | |
89 | "in the required format. Returns true on success."); | |
90 | ||
91 | ||
92 | DocDeclStr( | |
93 | virtual void , Clear(), | |
94 | "Clears data from the clipboard object and also the system's clipboard\n" | |
95 | "if possible."); | |
96 | ||
97 | ||
98 | DocDeclStr( | |
99 | virtual bool , Flush(), | |
100 | "Flushes the clipboard: this means that the data which is currently on\n" | |
101 | "clipboard will stay available even after the application exits (possibly\n" | |
102 | "eating memory), otherwise the clipboard will be emptied on exit.\n" | |
103 | "Returns False if the operation is unsuccesful for any reason."); | |
104 | ||
105 | ||
106 | DocDeclStr( | |
107 | virtual void , UsePrimarySelection( bool primary = True ), | |
108 | "On platforms supporting it (the X11 based platforms), selects the so\n" | |
109 | "called PRIMARY SELECTION as the clipboard as opposed to the normal\n" | |
110 | "clipboard, if primary is True."); | |
111 | }; | |
112 | ||
113 | ||
114 | %immutable; | |
115 | wxClipboard* const wxTheClipboard; | |
116 | %mutable; | |
117 | ||
118 | ||
119 | ||
120 | //--------------------------------------------------------------------------- | |
121 | ||
122 | ||
123 | DocStr(wxClipboardLocker, | |
124 | "A helpful class for opening the clipboard and automatically closing it when | |
125 | the locker is destroyed."); | |
126 | ||
127 | class wxClipboardLocker | |
128 | { | |
129 | public: | |
130 | wxClipboardLocker(wxClipboard *clipboard = NULL); | |
131 | ~wxClipboardLocker(); | |
132 | ||
133 | DocStr(__nonzero__, | |
134 | "A ClipboardLocker instance evaluates to True if the clipboard was\n" | |
135 | "successfully opened.") | |
136 | %extend { | |
137 | bool __nonzero__() { return !!(*self); } | |
138 | } | |
139 | }; | |
140 | ||
141 | ||
142 | //--------------------------------------------------------------------------- |