1 \section{\class{wxClipboard
}}\label{wxclipboard
}
3 A class for manipulating the clipboard. Note that this is not compatible with the
4 clipboard class from wxWindows
1.xx, which has the same name but a different implementation.
6 To use the clipboard, you call member functions of the global
{\bf wxTheClipboard
} object.
8 Call
\helpref{wxClipboard::Open
}{wxclipboardopen
} to get ownership of the clipboard. If this operation returns TRUE, you
9 now own the clipboard. Call
\helpref{wxClipboard::SetData
}{wxclipboardsetdata
} to put data
10 on the clipboard (one or more times), or
\helpref{wxClipboard::GetData
}{wxclipboardgetdata
} to
11 retrieve data from the clipboard. Call
\helpref{wxClipboard::Close
}{wxclipboardclose
} to close
12 the clipboard and relinquish ownership. You should keep the clipboard open only momentarily.
17 // Write some text to the clipboard
18 if (wxTheClipboard->Open())
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();
27 if (wxTheClipboard->Open() && wxTheClipboard->IsSupportedFormat(wxDF_TEXT))
29 wxTextDataObject object;
30 wxTheClipboard->GetData(& object);
31 wxTheClipboard->Close();
33 wxMessageBox(object.GetText());
37 \wxheading{Derived from
}
39 \helpref{wxObject
}{wxobject
}
43 \helpref{Drag and drop overview
}{wxdndoverview
},
\helpref{wxDataObject
}{wxdataobject
}
45 \latexignore{\rtfignore{\wxheading{Members
}}}
47 \membersection{wxClipboard::wxClipboard
}
49 \func{}{wxClipboard
}{\void}
53 \membersection{wxClipboard::
\destruct{wxClipboard
}}
55 \func{}{\destruct{wxClipboard
}}{\void}
59 \membersection{wxClipboard::Clear
}\label{wxclipboardclear
}
61 \func{void
}{Clear
}{\void}
63 Clears the global clipboard object and the system's clipboard if possible.
65 \membersection{wxClipboard::Close
}\label{wxclipboardclose
}
67 \func{bool
}{Close
}{\void}
69 Call this function to close the clipboard, having opened it with
\helpref{wxClipboard::Close
}{wxclipboardclose
}.
71 \membersection{wxClipboard::GetData
}\label{wxclipboardgetdata
}
73 \func{bool
}{GetData
}{\param{wxDataObject*
}{ data
}}
75 Call this function to fill
{\it data
} with data on the clipboard, if available in the required
78 \membersection{wxClipboard::IsSupportedFormat
}\label{wxclipboardissupportedformat
}
80 \func{bool
}{IsSupportedFormat
}{\param{wxDataFormat
}{ format
},
\param{const wxString\&
}{ id = ""
}}
82 Returns TRUE if the given format is available on the clipboard.
84 \wxheading{Parameters
}
86 \docparam{format
}{The format. See
\helpref{wxDataObject
}{wxdataobject
} for a list of formats.
}
88 \docparam{id
}{ If
{\it format
} is wxDF
\_PRIVATE,
{\it id
} is the identifier of the private data format.
}
90 \membersection{wxClipboard::Open
}\label{wxclipboardopen
}
92 \func{bool
}{Open
}{\void}
94 Call this function to open the clipboard before calling
\helpref{wxClipboard::SetData
}{wxclipboardsetdata
}
95 and
\helpref{wxClipboard::GetData
}{wxclipboardgetdata
}.
97 Call
\helpref{wxClipboard::Close
}{wxclipboardclose
} when you have finished with the clipboard. You
98 should keep the clipboard open for only a very short time.
100 \membersection{wxClipboard::SetData
}\label{wxclipboardsetdata
}
102 \func{bool
}{SetData
}{\param{wxDataObject*
}{ data
}}
104 Call this function to set a data object to the clipboard. This function can be called several times
105 to put different formats on the clipboard.