OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [doc/] [CrtSelHdlr.3] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1990-1994 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: CrtSelHdlr.3,v 1.1.1.1 2002-01-16 10:25:48 markom Exp $
9
'\"
10
.so man.macros
11
.TH Tk_CreateSelHandler 3 4.0 Tk "Tk Library Procedures"
12
.BS
13
.SH NAME
14
Tk_CreateSelHandler, Tk_DeleteSelHandler \- arrange to handle requests for a selection
15
.SH SYNOPSIS
16
.nf
17
\fB#include \fR
18
.sp
19
\fBTk_CreateSelHandler\fR(\fItkwin, selection, target, proc, clientData, format\fR)
20
.sp
21
\fBTk_DeleteSelHandler\fR(\fItkwin, selection, target\fR)
22
.SH ARGUMENTS
23
.AS Tk_SelectionProc clientData
24
.AP Tk_Window tkwin in
25
Window for which \fIproc\fR will provide selection information.
26
.AP Atom selection in
27
The name of the selection for which \fIproc\fR will provide
28
selection information.
29
.AP Atom target in
30
Form in which \fIproc\fR can provide the selection (e.g. STRING
31
or FILE_NAME).  Corresponds to \fItype\fR arguments in \fBselection\fR
32
commands.
33
.AP Tk_SelectionProc *proc in
34
Procedure to invoke whenever the selection is owned by \fItkwin\fR
35
and the selection contents are requested in the format given by
36
\fItarget\fR.
37
.AP ClientData clientData in
38
Arbitrary one-word value to pass to \fIproc\fR.
39
.AP Atom format in
40
If the selection requestor isn't in this process, \fIformat\fR determines
41
the representation used to transmit the selection to its
42
requestor.
43
.BE
44
 
45
.SH DESCRIPTION
46
.PP
47
\fBTk_CreateSelHandler\fR arranges for a particular procedure
48
(\fIproc\fR) to be called whenever \fIselection\fR is owned by
49
\fItkwin\fR and the selection contents are requested in the
50
form given by \fItarget\fR.
51
\fITarget\fR should be one of
52
the entries defined in the left column of Table 2 of the
53
X Inter-Client Communication Conventions Manual (ICCCM) or
54
any other form in which an application is willing to present
55
the selection.  The most common form is STRING.
56
.PP
57
\fIProc\fR should have arguments and result that match the
58
type \fBTk_SelectionProc\fR:
59
.CS
60
typedef int Tk_SelectionProc(
61
        ClientData \fIclientData\fR,
62
        int \fIoffset\fR,
63
        char *\fIbuffer\fR,
64
        int \fImaxBytes\fR);
65
.CE
66
The \fIclientData\fR parameter to \fIproc\fR is a copy of the
67
\fIclientData\fR argument given to \fBTk_CreateSelHandler\fR.
68
Typically, \fIclientData\fR points to a data
69
structure containing application-specific information that is
70
needed to retrieve the selection.  \fIOffset\fR specifies an
71
offset position into the selection, \fIbuffer\fR specifies a
72
location at which to copy information about the selection, and
73
\fImaxBytes\fR specifies the amount of space available at
74
\fIbuffer\fR.  \fIProc\fR should place a NULL-terminated string
75
at \fIbuffer\fR containing \fImaxBytes\fR or fewer characters
76
(not including the terminating NULL), and it should return a
77
count of the number of non-NULL characters stored at
78
\fIbuffer\fR.  If the selection no longer exists (e.g. it once
79
existed but the user deleted the range of characters containing
80
it), then \fIproc\fR should return -1.
81
.PP
82
When transferring large selections, Tk will break them up into
83
smaller pieces (typically a few thousand bytes each) for more
84
efficient transmission.  It will do this by calling \fIproc\fR
85
one or more times, using successively higher values of \fIoffset\fR
86
to retrieve successive portions of the selection.  If \fIproc\fR
87
returns a count less than \fImaxBytes\fR it means that the entire
88
remainder of the selection has been returned.  If \fIproc\fR's return
89
value is \fImaxBytes\fR it means there may be additional information
90
in the selection, so Tk must make another call to \fIproc\fR to
91
retrieve the next portion.
92
.PP
93
\fIProc\fR always returns selection information in the form of a
94
character string.  However, the ICCCM allows for information to
95
be transmitted from the selection owner to the selection requestor
96
in any of several formats, such as a string, an array of atoms, an
97
array of integers, etc.  The \fIformat\fR argument to
98
\fBTk_CreateSelHandler\fR indicates what format should be used to
99
transmit the selection to its requestor (see the middle column of
100
Table 2 of the ICCCM for examples).  If \fIformat\fR is not
101
STRING, then Tk will take the value returned by \fIproc\fR and divided
102
it into fields separated by white space.  If \fIformat\fR is ATOM,
103
then Tk will return the selection as an array of atoms, with each
104
field in \fIproc\fR's result treated as the name of one atom.  For
105
any other value of \fIformat\fR, Tk will return the selection as an
106
array of 32-bit values where each field of \fIproc\fR's result is
107
treated as a number and translated to a 32-bit value.  In any event,
108
the \fIformat\fR atom is returned to the selection requestor along
109
with the contents of the selection.
110
.PP
111
If \fBTk_CreateSelHandler\fR is called when there already exists a
112
handler for \fIselection\fR and \fItarget\fR on \fItkwin\fR, then the
113
existing handler is replaced with a new one.
114
.PP
115
\fBTk_DeleteSelHandler\fR removes the handler given by \fItkwin\fR,
116
\fIselection\fR, and \fItarget\fR, if such a handler exists.
117
If there is no such handler then it has no effect.
118
 
119
.SH KEYWORDS
120
format, handler, selection, target

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.