| 1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
| 2 | .\" |
| 3 | .\" Standard preamble: |
| 4 | .\" ======================================================================== |
| 5 | .de Sh \" Subsection heading |
| 6 | .br |
| 7 | .if t .Sp |
| 8 | .ne 5 |
| 9 | .PP |
| 10 | \fB\\$1\fR |
| 11 | .PP |
| 12 | .. |
| 13 | .de Sp \" Vertical space (when we can't use .PP) |
| 14 | .if t .sp .5v |
| 15 | .if n .sp |
| 16 | .. |
| 17 | .de Vb \" Begin verbatim text |
| 18 | .ft CW |
| 19 | .nf |
| 20 | .ne \\$1 |
| 21 | .. |
| 22 | .de Ve \" End verbatim text |
| 23 | .ft R |
| 24 | .fi |
| 25 | .. |
| 26 | .\" Set up some character translations and predefined strings. \*(-- will |
| 27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 28 | .\" double quote, and \*(R" will give a right double quote. | will give a |
| 29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to |
| 30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' |
| 31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. |
| 32 | .tr \(*W-|\(bv\*(Tr |
| 33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 34 | .ie n \{\ |
| 35 | . ds -- \(*W- |
| 36 | . ds PI pi |
| 37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 39 | . ds L" "" |
| 40 | . ds R" "" |
| 41 | . ds C` "" |
| 42 | . ds C' "" |
| 43 | 'br\} |
| 44 | .el\{\ |
| 45 | . ds -- \|\(em\| |
| 46 | . ds PI \(*p |
| 47 | . ds L" `` |
| 48 | . ds R" '' |
| 49 | 'br\} |
| 50 | .\" |
| 51 | .\" If the F register is turned on, we'll generate index entries on stderr for |
| 52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index |
| 53 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
| 54 | .\" output yourself in some meaningful fashion. |
| 55 | .if \nF \{\ |
| 56 | . de IX |
| 57 | . tm Index:\\$1\t\\n%\t"\\$2" |
| 58 | .. |
| 59 | . nr % 0 |
| 60 | . rr F |
| 61 | .\} |
| 62 | .\" |
| 63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 64 | .\" way too many mistakes in technical documents. |
| 65 | .hy 0 |
| 66 | .if n .na |
| 67 | .\" |
| 68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 69 | .\" Fear. Run. Save yourself. No user-serviceable parts. |
| 70 | . \" fudge factors for nroff and troff |
| 71 | .if n \{\ |
| 72 | . ds #H 0 |
| 73 | . ds #V .8m |
| 74 | . ds #F .3m |
| 75 | . ds #[ \f1 |
| 76 | . ds #] \fP |
| 77 | .\} |
| 78 | .if t \{\ |
| 79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 80 | . ds #V .6m |
| 81 | . ds #F 0 |
| 82 | . ds #[ \& |
| 83 | . ds #] \& |
| 84 | .\} |
| 85 | . \" simple accents for nroff and troff |
| 86 | .if n \{\ |
| 87 | . ds ' \& |
| 88 | . ds ` \& |
| 89 | . ds ^ \& |
| 90 | . ds , \& |
| 91 | . ds ~ ~ |
| 92 | . ds / |
| 93 | .\} |
| 94 | .if t \{\ |
| 95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 101 | .\} |
| 102 | . \" troff and (daisy-wheel) nroff accents |
| 103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 110 | .ds ae a\h'-(\w'a'u*4/10)'e |
| 111 | .ds Ae A\h'-(\w'A'u*4/10)'E |
| 112 | . \" corrections for vroff |
| 113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 115 | . \" for low resolution devices (crt and lpr) |
| 116 | .if \n(.H>23 .if \n(.V>19 \ |
| 117 | \{\ |
| 118 | . ds : e |
| 119 | . ds 8 ss |
| 120 | . ds o a |
| 121 | . ds d- d\h'-1'\(ga |
| 122 | . ds D- D\h'-1'\(hy |
| 123 | . ds th \o'bp' |
| 124 | . ds Th \o'LP' |
| 125 | . ds ae ae |
| 126 | . ds Ae AE |
| 127 | .\} |
| 128 | .rm #[ #] #H #V #F C |
| 129 | .\" ======================================================================== |
| 130 | .\" |
| 131 | .IX Title "SELECTION 1" |
| 132 | .TH SELECTION 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" |
| 133 | .SH "NAME" |
| 134 | Tk::Selection \- Manipulate the X selection |
| 135 | .SH "SYNOPSIS" |
| 136 | .IX Header "SYNOPSIS" |
| 137 | \&\fI$widget\fR\->\fBSelection\fR\fIOption\fR?(\fIargs\fR)? |
| 138 | .SH "DESCRIPTION" |
| 139 | .IX Header "DESCRIPTION" |
| 140 | This command provides an interface to the X selection mechanism and |
| 141 | implements the full selection functionality described in the |
| 142 | X Inter-Client Communication Conventions Manual (\s-1ICCCM\s0). |
| 143 | .PP |
| 144 | The widget object used to invoke the methods below determines which |
| 145 | display is used to access the selection. |
| 146 | In order to avoid conflicts with \fBselection\fR methods of widget classes |
| 147 | (e.g. \fBText\fR) this set of methods uses the prefix \fBSelection\fR. |
| 148 | The following methods are currently supported: |
| 149 | .IP "\fI$widget\fR\->\fBSelectionClear\fR?(\fB\-selection\fR=>\fIselection\fR)?" 4 |
| 150 | .IX Item "$widget->SelectionClear?(-selection=>selection)?" |
| 151 | If \fIselection\fR exists anywhere on \fI$widget\fR's display, clear it |
| 152 | so that no window owns the selection anymore. \fISelection\fR |
| 153 | specifies the X selection that should be cleared, and should be an |
| 154 | atom name such as \s-1PRIMARY\s0 or \s-1CLIPBOARD\s0; see the Inter-Client |
| 155 | Communication Conventions Manual for complete details. |
| 156 | \&\fISelection\fR defaults to \s-1PRIMARY\s0. |
| 157 | Returns an empty string. |
| 158 | .IP "\fI$widget\fR\->\fBSelectionGet\fR?(?\fB\-selection\fR=>\fIselection\fR?,?\fB\-type\fR=>\fItype\fR?)?" 4 |
| 159 | .IX Item "$widget->SelectionGet?(?-selection=>selection?,?-type=>type?)?" |
| 160 | Retrieves the value of \fIselection\fR from \fI$widget\fR's display and |
| 161 | returns it as a result. \fISelection\fR defaults to \s-1PRIMARY\s0. |
| 162 | .Sp |
| 163 | \&\fIType\fR specifies the form in which the selection is to be returned |
| 164 | (the desired ``target'' for conversion, in \s-1ICCCM\s0 terminology), and |
| 165 | should be an atom name such as \s-1STRING\s0 or \s-1FILE_NAME\s0; see the |
| 166 | Inter-Client Communication Conventions Manual for complete details. |
| 167 | \&\fIType\fR defaults to \s-1STRING\s0. The selection owner may choose to |
| 168 | return the selection in any of several different representation |
| 169 | formats, such as \s-1STRING\s0, \s-1ATOM\s0, \s-1INTEGER\s0, etc. (this format is different |
| 170 | than the selection type; see the \s-1ICCCM\s0 for all the confusing details). |
| 171 | .Sp |
| 172 | If \fIformat\fR is not \s-1STRING\s0 then things get messy, the following |
| 173 | description is from the Tcl/Tk man page as yet incompetely translated for |
| 174 | the perl version \- it is misleading at best. |
| 175 | .Sp |
| 176 | If the selection is returned in a non-string format, such as \s-1INTEGER\s0 |
| 177 | or \s-1ATOM\s0, the \fBSelectionGet\fR converts it to a list of perl |
| 178 | values: atoms are converted to their |
| 179 | textual names, and anything else is converted integers. |
| 180 | .Sp |
| 181 | A goal of the perl port is to provide better handling of different |
| 182 | formats than Tcl/Tk does, which should be possible given perl's |
| 183 | wider range of ``types''. Although some thought went into this |
| 184 | in very early days of perl/Tk what exactly happens is still |
| 185 | \&\*(L"not quite right\*(R" and subject to change. |
| 186 | .IP "\fI$widget\fR\->\fBSelectionHandle\fR(?\fB\-selection\fR=>\fIselection\fR?,?\fB\-type\fR=>\fItype\fR?,?\fB\-format\fR=>\fIformat\fR? \fIcallback\fR)" 4 |
| 187 | .IX Item "$widget->SelectionHandle(?-selection=>selection?,?-type=>type?,?-format=>format? callback)" |
| 188 | Creates a handler for selection requests, such that \fIcallback\fR will |
| 189 | be executed whenever \fIselection\fR is owned by \fI$widget\fR and |
| 190 | someone attempts to retrieve it in the form given by \fItype\fR |
| 191 | (e.g. \fItype\fR is specified in the \fBselection get\fR command). |
| 192 | \&\fISelection\fR defaults to \s-1PRIMARY\s0, \fItype\fR defaults to \s-1STRING\s0, and |
| 193 | \&\fIformat\fR defaults to \s-1STRING\s0. If \fIcallback\fR is an empty string |
| 194 | then any existing handler for \fI$widget\fR, \fItype\fR, and |
| 195 | \&\fIselection\fR is removed. |
| 196 | .RS 4 |
| 197 | .Sp |
| 198 | .RS 8 |
| 199 | When \fIselection\fR is requested, \fI$widget\fR is the selection owner, |
| 200 | and \fItype\fR is the requested type, \fIcallback\fR will be executed |
| 201 | with two additional arguments. |
| 202 | The two additional arguments |
| 203 | are \fIoffset\fR and \fImaxBytes\fR: \fIoffset\fR specifies a starting |
| 204 | character position in the selection and \fImaxBytes\fR gives the maximum |
| 205 | number of bytes to retrieve. The command should return a value consisting |
| 206 | of at most \fImaxBytes\fR of the selection, starting at position |
| 207 | \&\fIoffset\fR. For very large selections (larger than \fImaxBytes\fR) |
| 208 | the selection will be retrieved using several invocations of \fIcallback\fR |
| 209 | with increasing \fIoffset\fR values. If \fIcallback\fR returns a string |
| 210 | whose length is less than \fImaxBytes\fR, the return value is assumed to |
| 211 | include all of the remainder of the selection; if the length of |
| 212 | \&\fIcallback\fR's result is equal to \fImaxBytes\fR then |
| 213 | \&\fIcallback\fR will be invoked again, until it eventually |
| 214 | returns a result shorter than \fImaxBytes\fR. The value of \fImaxBytes\fR |
| 215 | will always be relatively large (thousands of bytes). |
| 216 | .Sp |
| 217 | If \fIcallback\fR returns an error (e.g. via \fBdie\fR) |
| 218 | then the selection retrieval is rejected |
| 219 | just as if the selection didn't exist at all. |
| 220 | .Sp |
| 221 | The \fIformat\fR argument specifies the representation that should be |
| 222 | used to transmit the selection to the requester (the second column of |
| 223 | Table 2 of the \s-1ICCCM\s0), and defaults to \s-1STRING\s0. If \fIformat\fR is |
| 224 | \&\s-1STRING\s0, the selection is transmitted as 8\-bit \s-1ASCII\s0 characters (i.e. |
| 225 | just in the form returned by \fIcommand\fR). |
| 226 | .Sp |
| 227 | If \fIformat\fR is not \s-1STRING\s0 then things get messy, the following |
| 228 | description is from the Tcl/Tk man page as yet untranslated for |
| 229 | the perl version \- it is misleading at best. |
| 230 | .Sp |
| 231 | If \fIformat\fR is |
| 232 | \&\s-1ATOM\s0, then the return value from \fIcommand\fR is divided into fields |
| 233 | separated by white space; each field is converted to its atom value, |
| 234 | and the 32\-bit atom value is transmitted instead of the atom name. |
| 235 | For any other \fIformat\fR, the return value from \fIcommand\fR is |
| 236 | divided into fields separated by white space and each field is |
| 237 | converted to a 32\-bit integer; an array of integers is transmitted |
| 238 | to the selection requester. |
| 239 | .Sp |
| 240 | The \fIformat\fR argument is needed only for compatibility with |
| 241 | many selection requesters, except Tcl/Tk. If Tcl/Tk is being |
| 242 | used to retrieve the selection then the value is converted back to |
| 243 | a string at the requesting end, so \fIformat\fR is |
| 244 | irrelevant. |
| 245 | .Sp |
| 246 | A goal of the perl port is to provide better handling of different |
| 247 | formats than Tcl/Tk does, which should be possible given perl's |
| 248 | wider range of ``types''. Although some thought went into this |
| 249 | in very early days of perl/Tk what exactly happens is still |
| 250 | \&\*(L"not quite right\*(R" and subject to change. |
| 251 | .RE |
| 252 | .IP "\fI$widget\fR\->\fBSelectionOwner\fR?(\fB\-selection\fR=>\fIselection\fR)?" 8 |
| 253 | .IX Item "$widget->SelectionOwner?(-selection=>selection)?" |
| 254 | \&\fBSelectionOwner\fR returns the |
| 255 | window in this application that owns \fIselection\fR on the display |
| 256 | containing \fI$widget\fR, or an empty string if no window in this |
| 257 | application owns the selection. \fISelection\fR defaults to \s-1PRIMARY\s0. |
| 258 | .IP "\fI$widget\fR\->\fBSelectionOwn\fR?(?\fB\-command\fR=>\fIcallback\fR?,?\fB\-selection\fR=>\fIselection\fR?)?" 8 |
| 259 | .IX Item "$widget->SelectionOwn?(?-command=>callback?,?-selection=>selection?)?" |
| 260 | \&\fBSelectionOwn\fR causes \fI$widget\fR to become |
| 261 | the new owner of \fIselection\fR on \fI$widget\fR's display, returning |
| 262 | an empty string as result. The existing owner, if any, is notified |
| 263 | that it has lost the selection. |
| 264 | If \fIcallback\fR is specified, it will be executed when |
| 265 | some other window claims ownership of the selection away from |
| 266 | \&\fI$widget\fR. \fISelection\fR defaults to \s-1PRIMARY\s0. |
| 267 | .RE |
| 268 | .RS 4 |
| 269 | .RE |
| 270 | .SH "KEYWORDS" |
| 271 | .IX Header "KEYWORDS" |
| 272 | clear, format, handler, \s-1ICCCM\s0, own, selection, target, type |