]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_clipbrd.i
Add a set for wxMac too
[wxWidgets.git] / wxPython / src / _clipbrd.i
CommitLineData
d14a1e28
RD
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
fcafa8a9
RD
22DocStr(wxClipboard,
23
24"wx.Clipboard represents the system clipboard and provides methods to copy data
25to or paste data from it. Normally, you should only use wx.TheClipboard which
26is a reference to a global wx.Clipboard instance.
27
28Call wx.TheClipboard.Open to get ownership of the clipboard. If this operation
29returns True, you now own the clipboard. Call wx.TheClipboard.SetData to put
30data on the clipboard, or wx.TheClipboard.GetData to retrieve data from the
31clipboard. Call wx.TheClipboard.Close to close the clipboard and relinquish
32ownership. You should keep the clipboard open only momentarily.
33");
34
d14a1e28
RD
35
36
d14a1e28
RD
37class wxClipboard : public wxObject {
38public:
fcafa8a9
RD
39 DocCtorStr( wxClipboard(), "" );
40
d14a1e28
RD
41 ~wxClipboard();
42
d14a1e28 43
fcafa8a9
RD
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
d14a1e28 56
fcafa8a9
RD
57 DocDeclStr(
58 virtual bool , IsOpened() const,
59 "Query whether the clipboard is opened");
60
d14a1e28 61
8668c242
RD
62
63 %apply SWIGTYPE *DISOWN { wxDataObject *data };
64
fcafa8a9
RD
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
d14a1e28 72
fcafa8a9
RD
73 DocDeclStr(
74 virtual bool , SetData( wxDataObject *data ),
75 "Set the clipboard data, this is the same as Clear followed by AddData.");
76
d14a1e28 77
8668c242
RD
78 %clear wxDataObject *data;
79
d14a1e28 80
fcafa8a9
RD
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.");
d14a1e28 96
d14a1e28 97
fcafa8a9
RD
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
d14a1e28 105
fcafa8a9
RD
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.");
d14a1e28
RD
111};
112
113
114%immutable;
115wxClipboard* const wxTheClipboard;
116%mutable;
117
118
119
120//---------------------------------------------------------------------------
121
122
fcafa8a9
RD
123DocStr(wxClipboardLocker,
124"A helpful class for opening the clipboard and automatically closing it when
125the locker is destroyed.");
126
d14a1e28
RD
127class wxClipboardLocker
128{
129public:
130 wxClipboardLocker(wxClipboard *clipboard = NULL);
131 ~wxClipboardLocker();
132
fcafa8a9
RD
133 DocStr(__nonzero__,
134 "A ClipboardLocker instance evaluates to True if the clipboard was\n"
135 "successfully opened.")
d14a1e28
RD
136 %extend {
137 bool __nonzero__() { return !!(*self); }
138 }
139};
140
141
142//---------------------------------------------------------------------------