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.
|
|
|
|
|
1999-12-29 11:52:51 +00:00
|
|
|
See also the \helpref{wxDataObject overview}{wxdataobjectoverview} for further information.
|
|
|
|
|
1999-01-14 11:23:37 +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}}}
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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.
|
|
|
|
Returns FALSE if the operation is unsuccesful for any reason.
|
|
|
|
|
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
|
1999-01-28 18:25:36 +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}
|
|
|
|
|
|
|
|
Returns TRUE if the clipboard has been opened.
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
1999-07-30 13:16:45 +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,
|
1999-07-30 13:16:45 +00:00
|
|
|
if {\it primary} is TRUE.
|
1999-07-30 12:02:28 +00:00
|
|
|
|
|
|
|
|