# Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # =head1 NAME Tk_ClipboardClear, Tk_ClipboardAppend - Manage the clipboard =for category C Programming =head1 SYNOPSIS B<#include Etk.hE> int B(I) int B(I) =head1 ARGUMENTS =over 4 =item Tcl_Interp *interp (in) Interpreter to use for reporting errors. =item Tk_Window tkwin (in) Window that determines which display's clipboard to manipulate. =item Atom target (in) Conversion type for this clipboard item; has same meaning as I argument to B. =item Atom format (in) Representation to use when data is retrieved; has same meaning as I argument to B. =item char *buffer (in) Null terminated string containing the data to be appended to the clipboard. =back =head1 DESCRIPTION These two procedures manage the clipboard for Tk. The clipboard is typically managed by calling B once, then calling B to add data for any number of targets. B claims the CLIPBOARD selection and frees any data items previously stored on the clipboard in this application. It normally returns TCL_OK, but if an error occurs it returns TCL_ERROR and leaves an error message in Iresult>. B must be called before a sequence of B calls can be issued. B appends a buffer of data to the clipboard. The first buffer for a given I determines the I for that I. Any successive appends for that I must have the same format or an error will be returned. B returns TCL_OK if the buffer is successfully copied onto the clipboard. If the clipboard is not currently owned by the application, either because B has not been called or because ownership of the clipboard has changed since the last call to B, B returns TCL_ERROR and leaves an error message in Iresult>. In order to guarantee atomicity, no event handling should occur between B and the following B calls (otherwise someone could retrieve a partially completed clipboard or claim ownership away from this application). B may invoke callbacks, including arbitrary Callbacks, as a result of losing the CLIPBOARD selection, so any calling function should take care to be reentrant at the point B is invoked. =head1 KEYWORDS append, clipboard, clear, format, type