]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_clipbrd.i
It *does* work now
[wxWidgets.git] / wxPython / src / _clipbrd.i
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
23
24 // wxClipboard represents the system clipboard. Normally, you should use
25 // wxTheClipboard which is a global pointer to the (unique) clipboard.
26 //
27 // Clipboard can be used to copy data to/paste data from. It works together
28 // with wxDataObject.
29 class wxClipboard : public wxObject {
30 public:
31 wxClipboard();
32 ~wxClipboard();
33
34 // open the clipboard before Add/SetData() and GetData()
35 virtual bool Open();
36
37 // close the clipboard after Add/SetData() and GetData()
38 virtual void Close();
39
40 // query whether the clipboard is opened
41 virtual bool IsOpened() const;
42
43 // add to the clipboard data
44 //
45 // NB: the clipboard owns the pointer and will delete it, so data must be
46 // allocated on the heap
47 virtual bool AddData( wxDataObject *data );
48
49 // set the clipboard data, this is the same as Clear() followed by
50 // AddData()
51 virtual bool SetData( wxDataObject *data );
52
53 // ask if data in correct format is available
54 virtual bool IsSupported( const wxDataFormat& format );
55
56 // fill data with data on the clipboard (if available)
57 virtual bool GetData( wxDataObject& data );
58
59 // clears wxTheClipboard and the system's clipboard if possible
60 virtual void Clear();
61
62 // flushes the clipboard: this means that the data which is currently on
63 // clipboard will stay available even after the application exits (possibly
64 // eating memory), otherwise the clipboard will be emptied on exit
65 virtual bool Flush();
66
67 // X11 has two clipboards which get selected by this call. Empty on MSW.
68 virtual void UsePrimarySelection( bool primary = False );
69 };
70
71
72 %immutable;
73 wxClipboard* const wxTheClipboard;
74 %mutable;
75
76
77
78 //---------------------------------------------------------------------------
79
80
81 // helpful class for opening the clipboard and automatically closing it when
82 // the locker is destroyed
83 class wxClipboardLocker
84 {
85 public:
86 wxClipboardLocker(wxClipboard *clipboard = NULL);
87 ~wxClipboardLocker();
88
89 //bool operator!() const;
90
91 %extend {
92 bool __nonzero__() { return !!(*self); }
93 }
94 };
95
96
97 //---------------------------------------------------------------------------