]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/clipbrd.tex
Added OnKeyDown, OnKeyUp.
[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
dface61c
JS
9now own the clipboard. Call \helpref{wxClipboard::SetData}{wxclipboardsetdata} to put data
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 {
4ce81a75
JS
20 // This object is held by the clipboard, so do not delete it in the app.
21 wxTextDataObject* object = new wxTextDataObject("Some text");
22 wxTheClipboard->SetData(& object);
23 wxTheClipboard->Close();
dface61c
JS
24 }
25
26 // Read some text
4ce81a75 27 if (wxTheClipboard->Open() && wxTheClipboard->IsSupportedFormat(wxDF_TEXT))
dface61c
JS
28 {
29 wxTextDataObject object;
4ce81a75
JS
30 wxTheClipboard->GetData(& object);
31 wxTheClipboard->Close();
dface61c
JS
32
33 wxMessageBox(object.GetText());
34 }
35\end{verbatim}
a660d684
KB
36
37\wxheading{Derived from}
38
39\helpref{wxObject}{wxobject}
40
41\wxheading{See also}
42
dface61c 43\helpref{Drag and drop overview}{wxdndoverview}, \helpref{wxDataObject}{wxdataobject}
a660d684
KB
44
45\latexignore{\rtfignore{\wxheading{Members}}}
46
dface61c 47\membersection{wxClipboard::wxClipboard}
a660d684 48
dface61c 49\func{}{wxClipboard}{\void}
a660d684 50
dface61c 51Constructor.
a660d684 52
dface61c 53\membersection{wxClipboard::\destruct{wxClipboard}}
a660d684 54
dface61c 55\func{}{\destruct{wxClipboard}}{\void}
a660d684 56
dface61c 57Destructor.
a660d684 58
dface61c 59\membersection{wxClipboard::Clear}\label{wxclipboardclear}
a660d684 60
dface61c 61\func{void}{Clear}{\void}
a660d684 62
dface61c 63Clears the global clipboard object and the system's clipboard if possible.
a660d684 64
dface61c 65\membersection{wxClipboard::Close}\label{wxclipboardclose}
a660d684 66
dface61c 67\func{bool}{Close}{\void}
a660d684 68
dface61c 69Call this function to close the clipboard, having opened it with \helpref{wxClipboard::Close}{wxclipboardclose}.
a660d684 70
dface61c 71\membersection{wxClipboard::GetData}\label{wxclipboardgetdata}
a660d684 72
dface61c 73\func{bool}{GetData}{\param{wxDataObject*}{ data}}
a660d684 74
dface61c
JS
75Call this function to fill {\it data} with data on the clipboard, if available in the required
76format.
a660d684 77
dface61c 78\membersection{wxClipboard::IsSupportedFormat}\label{wxclipboardissupportedformat}
a660d684 79
dface61c 80\func{bool}{IsSupportedFormat}{\param{wxDataFormat}{ format}, \param{const wxString\&}{ id = ""}}
a660d684 81
dface61c 82Returns TRUE if the given format is available on the clipboard.
a660d684 83
dface61c 84\wxheading{Parameters}
a660d684 85
dface61c 86\docparam{format}{The format. See \helpref{wxDataObject}{wxdataobject} for a list of formats.}
a660d684 87
dface61c 88\docparam{id}{ If {\it format} is wxDF\_PRIVATE, {\it id} is the identifier of the private data format.}
a660d684 89
dface61c 90\membersection{wxClipboard::Open}\label{wxclipboardopen}
a660d684 91
dface61c 92\func{bool}{Open}{\void}
a660d684 93
dface61c
JS
94Call this function to open the clipboard before calling \helpref{wxClipboard::SetData}{wxclipboardsetdata}
95and \helpref{wxClipboard::GetData}{wxclipboardgetdata}.
a660d684 96
dface61c
JS
97Call \helpref{wxClipboard::Close}{wxclipboardclose} when you have finished with the clipboard. You
98should keep the clipboard open for only a very short time.
a660d684 99
dface61c 100\membersection{wxClipboard::SetData}\label{wxclipboardsetdata}
a660d684 101
dface61c 102\func{bool}{SetData}{\param{wxDataObject*}{ data}}
a660d684 103
dface61c
JS
104Call this function to set a data object to the clipboard. This function can be called several times
105to put different formats on the clipboard.
a660d684 106