Debian Codegraph @

pod/pTk/Clipboard.pod

raw
1 # Copyright (c) 1994 The Regents of the University of California.
2 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk_ClipboardClear, Tk_ClipboardAppend - Manage the clipboard
11
12 =for category C Programming
13
14 =head1 SYNOPSIS
15
16 B<#include E<lt>tk.hE<gt>>
17
18 int
19 B<Tk_ClipboardClear>(I<interp, tkwin>)
20
21 int
22 B<Tk_ClipboardAppend>(I<interp, tkwin, target, format, buffer>)
23
24 =head1 ARGUMENTS
25
26 =over 4
27
28 =item Tcl_Interp *interp (in)
29
30 Interpreter to use for reporting errors.
31
32 =item Tk_Window tkwin (in)
33
34 Window that determines which display's clipboard to manipulate.
35
36 =item Atom target (in)
37
38 Conversion type for this clipboard item; has same meaning as
39 I<target> argument to B<Tk_CreateSelHandler>.
40
41 =item Atom format (in)
42
43 Representation to use when data is retrieved; has same meaning as
44 I<format> argument to B<Tk_CreateSelHandler>.
45
46 =item char *buffer (in)
47
48 Null terminated string containing the data to be appended to the clipboard.
49
50 =back
51
52 =head1 DESCRIPTION
53
54 These two procedures manage the clipboard for Tk.
55 The clipboard is typically managed by calling B<Tk_ClipboardClear>
56 once, then calling B<Tk_ClipboardAppend> to add data for any
57 number of targets.
58
59 B<Tk_ClipboardClear> claims the CLIPBOARD selection and frees any
60 data items previously stored on the clipboard in this application.
61 It normally returns TCL_OK, but if an error occurs it returns
62 TCL_ERROR and leaves an error message in I<interp-E<gt>result>.
63 B<Tk_ClipboardClear> must be called before a sequence of
64 B<Tk_ClipboardAppend> calls can be issued.
65
66 B<Tk_ClipboardAppend> appends a buffer of data to the clipboard.
67 The first buffer for a given I<target> determines the I<format>
68 for that I<target>.
69 Any successive appends for that I<target> must have
70 the same format or an error will be returned.
71 B<Tk_ClipboardAppend> returns TCL_OK if the buffer is
72 successfully copied onto the clipboard. If the clipboard is not
73 currently owned by the application, either
74 because B<Tk_ClipboardClear> has not been called or because
75 ownership of the clipboard has changed since the last call to
76 B<Tk_ClipboardClear>,
77 B<Tk_ClipboardAppend> returns TCL_ERROR and leaves an error message in
78 I<interp-E<gt>result>.
79
80 In order to guarantee atomicity, no event handling should occur
81 between B<Tk_ClipboardClear> and the following
82 B<Tk_ClipboardAppend> calls (otherwise someone could retrieve
83 a partially completed clipboard or claim ownership away from
84 this application).
85
86 B<Tk_ClipboardClear> may invoke callbacks, including arbitrary
87 Callbacks, as a result of losing the CLIPBOARD selection, so
88 any calling function should take care to be reentrant at the point
89 B<Tk_ClipboardClear> is invoked.
90
91 =head1 KEYWORDS
92
93 append, clipboard, clear, format, type