]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_clipbrd.i
Use the DISOWN typemap
[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
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.
29class wxClipboard : public wxObject {
30public:
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
8668c242
RD
43
44 %apply SWIGTYPE *DISOWN { wxDataObject *data };
45
d14a1e28
RD
46 // add to the clipboard data
47 //
48 // NB: the clipboard owns the pointer and will delete it, so data must be
49 // allocated on the heap
50 virtual bool AddData( wxDataObject *data );
51
52 // set the clipboard data, this is the same as Clear() followed by
53 // AddData()
54 virtual bool SetData( wxDataObject *data );
55
8668c242
RD
56 %clear wxDataObject *data;
57
d14a1e28
RD
58 // ask if data in correct format is available
59 virtual bool IsSupported( const wxDataFormat& format );
60
61 // fill data with data on the clipboard (if available)
62 virtual bool GetData( wxDataObject& data );
63
64 // clears wxTheClipboard and the system's clipboard if possible
65 virtual void Clear();
66
67 // flushes the clipboard: this means that the data which is currently on
68 // clipboard will stay available even after the application exits (possibly
69 // eating memory), otherwise the clipboard will be emptied on exit
70 virtual bool Flush();
71
72 // X11 has two clipboards which get selected by this call. Empty on MSW.
dd9f7fea 73 virtual void UsePrimarySelection( bool primary = False );
d14a1e28
RD
74};
75
76
77%immutable;
78wxClipboard* const wxTheClipboard;
79%mutable;
80
81
82
83//---------------------------------------------------------------------------
84
85
86// helpful class for opening the clipboard and automatically closing it when
87// the locker is destroyed
88class wxClipboardLocker
89{
90public:
91 wxClipboardLocker(wxClipboard *clipboard = NULL);
92 ~wxClipboardLocker();
93
94 //bool operator!() const;
95
96 %extend {
97 bool __nonzero__() { return !!(*self); }
98 }
99};
100
101
102//---------------------------------------------------------------------------