1998-05-20 14:25:30 +00:00
|
|
|
\section{\class{wxClipboard}}\label{wxclipboard}
|
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
A class for manipulating the clipboard. Note that this is not compatible with the
|
|
|
|
clipboard class from wxWindows 1.xx, which has the same name but a different implementation.
|
|
|
|
|
1999-01-14 11:23:37 +00:00
|
|
|
To use the clipboard, you call member functions of the global {\bf wxTheClipboard} object.
|
|
|
|
|
|
|
|
Call \helpref{wxClipboard::Open}{wxclipboardopen} to get ownership of the clipboard. If this operation returns TRUE, you
|
1999-01-28 18:25:36 +00:00
|
|
|
now own the clipboard. Call \helpref{wxClipboard::AddData}{wxclipboardadddata} to put data
|
1999-01-13 14:23:31 +00:00
|
|
|
on the clipboard (one or more times), or \helpref{wxClipboard::GetData}{wxclipboardgetdata} to
|
|
|
|
retrieve data from the clipboard. Call \helpref{wxClipboard::Close}{wxclipboardclose} to close
|
|
|
|
the clipboard and relinquish ownership. You should keep the clipboard open only momentarily.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
// Write some text to the clipboard
|
1999-01-14 11:23:37 +00:00
|
|
|
if (wxTheClipboard->Open())
|
1999-01-13 14:23:31 +00:00
|
|
|
{
|
1999-01-28 18:25:36 +00:00
|
|
|
// This data objects are held by the clipboard,
|
|
|
|
// so do not delete them in the app.
|
|
|
|
wxTheClipboard->AddData( new wxTextDataObject("Some text") );
|
1999-01-14 11:23:37 +00:00
|
|
|
wxTheClipboard->Close();
|
1999-01-13 14:23:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Read some text
|
1999-01-28 18:25:36 +00:00
|
|
|
if (wxTheClipboard->Open())
|
1999-01-13 14:23:31 +00:00
|
|
|
{
|
1999-01-28 18:25:36 +00:00
|
|
|
wxTextDataObject data;
|
|
|
|
if (wxTheClipboard->IsSupported(data))
|
|
|
|
{
|
|
|
|
wxTheClipboard->GetData(data);
|
|
|
|
wxMessageBox(data.GetText());
|
|
|
|
}
|
1999-01-14 11:23:37 +00:00
|
|
|
wxTheClipboard->Close();
|
1999-01-13 14:23:31 +00:00
|
|
|
}
|
|
|
|
\end{verbatim}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 20:41:29 +00:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/clipbrd.h>
|
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\helpref{Drag and drop overview}{wxdndoverview}, \helpref{wxDataObject}{wxdataobject}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\membersection{wxClipboard::wxClipboard}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\func{}{wxClipboard}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
Constructor.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\membersection{wxClipboard::\destruct{wxClipboard}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\func{}{\destruct{wxClipboard}}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
Destructor.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-28 18:25:36 +00:00
|
|
|
\membersection{wxClipboard::AddData}\label{wxclipboardadddata}
|
|
|
|
|
|
|
|
\func{bool}{AddData}{\param{wxDataObject*}{ data}}
|
|
|
|
|
|
|
|
Call this function to add a data object to the clipboard. This function can be called several times
|
|
|
|
to put different formats on the clipboard.
|
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\membersection{wxClipboard::Clear}\label{wxclipboardclear}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\func{void}{Clear}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
Clears the global clipboard object and the system's clipboard if possible.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\membersection{wxClipboard::Close}\label{wxclipboardclose}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\func{bool}{Close}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-28 18:25:36 +00:00
|
|
|
Call this function to close the clipboard, having opened it with \helpref{wxClipboard::Open}{wxclipboardopen}.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\membersection{wxClipboard::GetData}\label{wxclipboardgetdata}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-03-13 20:14:37 +00:00
|
|
|
\func{bool}{GetData}{\param{wxDataObject\&}{ data}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
Call this function to fill {\it data} with data on the clipboard, if available in the required
|
1999-01-28 18:25:36 +00:00
|
|
|
format. Returns TRUE on success.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-28 18:25:36 +00:00
|
|
|
\membersection{wxClipboard::IsSupported}\label{wxclipboardissupported}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-03-13 20:14:37 +00:00
|
|
|
\func{bool}{IsSupported}{\param{wxDataObject\&}{ data}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-28 18:25:36 +00:00
|
|
|
Returns TRUE if the format of the given data object is available on the clipboard.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\membersection{wxClipboard::Open}\label{wxclipboardopen}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\func{bool}{Open}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
Call this function to open the clipboard before calling \helpref{wxClipboard::SetData}{wxclipboardsetdata}
|
|
|
|
and \helpref{wxClipboard::GetData}{wxclipboardgetdata}.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
Call \helpref{wxClipboard::Close}{wxclipboardclose} when you have finished with the clipboard. You
|
|
|
|
should keep the clipboard open for only a very short time.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-28 18:25:36 +00:00
|
|
|
Returns TRUE on success. This should be tested (as in the sample shown above).
|
|
|
|
|
1999-01-30 21:37:17 +00:00
|
|
|
\membersection{wxClipboard::SetData}\label{wxclipboardsetdata}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\func{bool}{SetData}{\param{wxDataObject*}{ data}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-28 18:25:36 +00:00
|
|
|
Call this function to set the data object to the clipboard. This function will
|
|
|
|
clear all previous contents in the clipboard, so calling it several times
|
|
|
|
does not make any sense.
|
1998-05-20 14:25:30 +00:00
|
|
|
|