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
|
2004-05-04 08:27:20 +00:00
|
|
|
clipboard class from wxWidgets 1.xx, which has the same name but a different implementation.
|
1999-01-13 14:23:31 +00:00
|
|
|
|
1999-01-14 11:23:37 +00:00
|
|
|
To use the clipboard, you call member functions of the global {\bf wxTheClipboard} object.
|
|
|
|
|
1999-12-29 11:52:51 +00:00
|
|
|
See also the \helpref{wxDataObject overview}{wxdataobjectoverview} for further information.
|
|
|
|
|
2003-01-18 00:16:34 +00:00
|
|
|
Call \helpref{wxClipboard::Open}{wxclipboardopen} to get ownership of the clipboard. If this operation returns true, you
|
1999-11-01 18:20:39 +00:00
|
|
|
now own the clipboard. Call \helpref{wxClipboard::SetData}{wxclipboardsetdata} to put data
|
|
|
|
on the clipboard, or \helpref{wxClipboard::GetData}{wxclipboardgetdata} to
|
1999-01-13 14:23:31 +00:00
|
|
|
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.
|
1999-11-04 17:49:21 +00:00
|
|
|
wxTheClipboard->SetData( 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-11-01 18:20:39 +00:00
|
|
|
if (wxTheClipboard->IsSupported( wxDF_TEXT ))
|
1999-01-28 18:25:36 +00:00
|
|
|
{
|
1999-07-30 12:02:28 +00:00
|
|
|
wxTextDataObject data;
|
1999-11-01 18:20:39 +00:00
|
|
|
wxTheClipboard->GetData( data );
|
1999-07-30 12:02:28 +00:00
|
|
|
wxMessageBox( data.GetText() );
|
1999-01-28 18:25:36 +00:00
|
|
|
}
|
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}}}
|
|
|
|
|
2004-10-04 15:13:52 +00:00
|
|
|
\membersection{wxClipboard::wxClipboard}\label{wxclipboardctor}
|
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
|
|
|
|
2004-10-04 15:13:52 +00:00
|
|
|
\membersection{wxClipboard::\destruct{wxClipboard}}\label{wxclipboarddtor}
|
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
|
|
|
|
2000-01-06 15:09:35 +00:00
|
|
|
\membersection{wxClipboard::AddData}\label{wxclipboardadddata}
|
|
|
|
|
|
|
|
\func{bool}{AddData}{\param{wxDataObject*}{ data}}
|
|
|
|
|
|
|
|
Call this function to add the data object to the clipboard. You may call
|
|
|
|
this function repeatedly after having cleared the clipboard using \helpref{wxClipboard::Clear}{wxclipboardclear}.
|
|
|
|
|
|
|
|
After this function has been called, the clipboard owns the data, so do not delete
|
|
|
|
the data explicitly.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxClipboard::SetData}{wxclipboardsetdata}
|
|
|
|
|
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
|
|
|
|
2003-04-28 10:37:08 +00:00
|
|
|
\func{void}{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
|
|
|
|
2002-05-05 19:27:07 +00:00
|
|
|
\membersection{wxClipboard::Flush}\label{wxclipboardflush}
|
|
|
|
|
|
|
|
\func{bool}{Flush}{\void}
|
|
|
|
|
|
|
|
Flushes the clipboard: this means that the data which is currently on
|
|
|
|
clipboard will stay available even after the application exits (possibly
|
|
|
|
eating memory), otherwise the clipboard will be emptied on exit.
|
2004-10-22 19:15:35 +00:00
|
|
|
Returns false if the operation is unsuccessful for any reason.
|
2002-05-05 19:27:07 +00:00
|
|
|
|
1999-01-13 14:23:31 +00:00
|
|
|
\membersection{wxClipboard::GetData}\label{wxclipboardgetdata}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-11-01 18:20:39 +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
|
2003-01-18 00:16:34 +00:00
|
|
|
format. Returns true on success.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
2000-01-06 15:09:35 +00:00
|
|
|
\membersection{wxClipboard::IsOpened}\label{wxclipboardisopened}
|
|
|
|
|
|
|
|
\constfunc{bool}{IsOpened}{\void}
|
|
|
|
|
2003-01-18 00:16:34 +00:00
|
|
|
Returns true if the clipboard has been opened.
|
2000-01-06 15:09:35 +00:00
|
|
|
|
1999-01-28 18:25:36 +00:00
|
|
|
\membersection{wxClipboard::IsSupported}\label{wxclipboardissupported}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-11-01 18:20:39 +00:00
|
|
|
\func{bool}{IsSupported}{\param{const wxDataFormat\&}{ format}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
2003-01-18 00:16:34 +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
|
|
|
|
2003-01-18 00:16:34 +00:00
|
|
|
Returns true on success. This should be tested (as in the sample shown above).
|
1999-01-28 18:25:36 +00:00
|
|
|
|
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
|
|
|
|
2000-01-06 15:09:35 +00:00
|
|
|
After this function has been called, the clipboard owns the data, so do not delete
|
|
|
|
the data explicitly.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxClipboard::AddData}{wxclipboardadddata}
|
|
|
|
|
1999-07-30 13:16:45 +00:00
|
|
|
\membersection{wxClipboard::UsePrimarySelection}\label{wxclipboarduseprimary}
|
1999-07-30 12:02:28 +00:00
|
|
|
|
2003-01-18 00:16:34 +00:00
|
|
|
\func{void}{UsePrimarySelection}{\param{bool}{ primary = true}}
|
1999-07-30 12:02:28 +00:00
|
|
|
|
|
|
|
On platforms supporting it (currently only GTK), selects the so called
|
|
|
|
PRIMARY SELECTION as the clipboard as opposed to the normal clipboard,
|
2003-01-18 00:16:34 +00:00
|
|
|
if {\it primary} is true.
|
1999-07-30 12:02:28 +00:00
|
|
|
|
|
|
|
|