]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/clipbrd.tex
Removed wxNullRegion
[wxWidgets.git] / docs / latex / wx / clipbrd.tex
1 \section{\class{wxClipboard}}\label{wxclipboard}
2
3 A class for manipulating the clipboard. Note that this is not compatible with the
4 clipboard class from wxWindows 1.xx, which has the same name but a different implementation.
5
6 To use the clipboard, you call member functions of the global {\bf wxTheClipboard} object.
7
8 Call \helpref{wxClipboard::Open}{wxclipboardopen} to get ownership of the clipboard. If this operation returns TRUE, you
9 now own the clipboard. Call \helpref{wxClipboard::AddData}{wxclipboardadddata} to put data
10 on the clipboard (one or more times), or \helpref{wxClipboard::GetData}{wxclipboardgetdata} to
11 retrieve data from the clipboard. Call \helpref{wxClipboard::Close}{wxclipboardclose} to close
12 the clipboard and relinquish ownership. You should keep the clipboard open only momentarily.
13
14 For example:
15
16 \begin{verbatim}
17 // Write some text to the clipboard
18 if (wxTheClipboard->Open())
19 {
20 // This data objects are held by the clipboard,
21 // so do not delete them in the app.
22 wxTheClipboard->AddData( new wxTextDataObject("Some text") );
23 wxTheClipboard->Close();
24 }
25
26 // Read some text
27 if (wxTheClipboard->Open())
28 {
29 wxTextDataObject data;
30 if (wxTheClipboard->IsSupported(data))
31 {
32 wxTheClipboard->GetData(data);
33 wxMessageBox(data.GetText());
34 }
35 wxTheClipboard->Close();
36 }
37 \end{verbatim}
38
39 \wxheading{Derived from}
40
41 \helpref{wxObject}{wxobject}
42
43 \wxheading{See also}
44
45 \helpref{Drag and drop overview}{wxdndoverview}, \helpref{wxDataObject}{wxdataobject}
46
47 \latexignore{\rtfignore{\wxheading{Members}}}
48
49 \membersection{wxClipboard::wxClipboard}
50
51 \func{}{wxClipboard}{\void}
52
53 Constructor.
54
55 \membersection{wxClipboard::\destruct{wxClipboard}}
56
57 \func{}{\destruct{wxClipboard}}{\void}
58
59 Destructor.
60
61 \membersection{wxClipboard::AddData}\label{wxclipboardadddata}
62
63 \func{bool}{AddData}{\param{wxDataObject*}{ data}}
64
65 Call this function to add a data object to the clipboard. This function can be called several times
66 to put different formats on the clipboard.
67
68 \membersection{wxClipboard::Clear}\label{wxclipboardclear}
69
70 \func{void}{Clear}{\void}
71
72 Clears the global clipboard object and the system's clipboard if possible.
73
74 \membersection{wxClipboard::Close}\label{wxclipboardclose}
75
76 \func{bool}{Close}{\void}
77
78 Call this function to close the clipboard, having opened it with \helpref{wxClipboard::Open}{wxclipboardopen}.
79
80 \membersection{wxClipboard::GetData}\label{wxclipboardgetdata}
81
82 \func{bool}{GetData}{\param{wxDataObject&}{ data}}
83
84 Call this function to fill {\it data} with data on the clipboard, if available in the required
85 format. Returns TRUE on success.
86
87 \membersection{wxClipboard::IsSupported}\label{wxclipboardissupported}
88
89 \func{bool}{IsSupported}{\param{wxDataObject&}{ data}}
90
91 Returns TRUE if the format of the given data object is available on the clipboard.
92
93 \membersection{wxClipboard::Open}\label{wxclipboardopen}
94
95 \func{bool}{Open}{\void}
96
97 Call this function to open the clipboard before calling \helpref{wxClipboard::SetData}{wxclipboardsetdata}
98 and \helpref{wxClipboard::GetData}{wxclipboardgetdata}.
99
100 Call \helpref{wxClipboard::Close}{wxclipboardclose} when you have finished with the clipboard. You
101 should keep the clipboard open for only a very short time.
102
103 Returns TRUE on success. This should be tested (as in the sample shown above).
104
105 \membersection{wxClipboard::SetData}\label{wxclipboardadddata}
106
107 \func{bool}{SetData}{\param{wxDataObject*}{ data}}
108
109 Call this function to set the data object to the clipboard. This function will
110 clear all previous contents in the clipboard, so calling it several times
111 does not make any sense.
112