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