OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / share / man / mann / itcldelegate.n
1 '\"
2 '\" Copyright (c) 2008 Arnulf Wiedemann
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\"
7 .TH delegation n 4.0 itcl "[incr\ Tcl]"
8 '\" The definitions below are for supplemental macros used in Tcl/Tk
9 '\" manual entries.
10 '\"
11 '\" .AP type name in/out ?indent?
12 '\"     Start paragraph describing an argument to a library procedure.
13 '\"     type is type of argument (int, etc.), in/out is either "in", "out",
14 '\"     or "in/out" to describe whether procedure reads or modifies arg,
15 '\"     and indent is equivalent to second arg of .IP (shouldn't ever be
16 '\"     needed;  use .AS below instead)
17 '\"
18 '\" .AS ?type? ?name?
19 '\"     Give maximum sizes of arguments for setting tab stops.  Type and
20 '\"     name are examples of largest possible arguments that will be passed
21 '\"     to .AP later.  If args are omitted, default tab stops are used.
22 '\"
23 '\" .BS
24 '\"     Start box enclosure.  From here until next .BE, everything will be
25 '\"     enclosed in one large box.
26 '\"
27 '\" .BE
28 '\"     End of box enclosure.
29 '\"
30 '\" .CS
31 '\"     Begin code excerpt.
32 '\"
33 '\" .CE
34 '\"     End code excerpt.
35 '\"
36 '\" .VS ?version? ?br?
37 '\"     Begin vertical sidebar, for use in marking newly-changed parts
38 '\"     of man pages.  The first argument is ignored and used for recording
39 '\"     the version when the .VS was added, so that the sidebars can be
40 '\"     found and removed when they reach a certain age.  If another argument
41 '\"     is present, then a line break is forced before starting the sidebar.
42 '\"
43 '\" .VE
44 '\"     End of vertical sidebar.
45 '\"
46 '\" .DS
47 '\"     Begin an indented unfilled display.
48 '\"
49 '\" .DE
50 '\"     End of indented unfilled display.
51 '\"
52 '\" .SO
53 '\"     Start of list of standard options for a Tk widget.  The
54 '\"     options follow on successive lines, in four columns separated
55 '\"     by tabs.
56 '\"
57 '\" .SE
58 '\"     End of list of standard options for a Tk widget.
59 '\"
60 '\" .OP cmdName dbName dbClass
61 '\"     Start of description of a specific option.  cmdName gives the
62 '\"     option's name as specified in the class command, dbName gives
63 '\"     the option's name in the option database, and dbClass gives
64 '\"     the option's class in the option database.
65 '\"
66 '\" .UL arg1 arg2
67 '\"     Print arg1 underlined, then print arg2 normally.
68 '\"
69 '\" SCCS: @(#) man.macros 1.9 97/08/22 18:50:59
70 '\"
71 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
72 .if t .wh -1.3i ^B
73 .nr ^l \n(.l
74 .ad b
75 '\"     # Start an argument description
76 .de AP
77 .ie !"\\$4"" .TP \\$4
78 .el \{\
79 .   ie !"\\$2"" .TP \\n()Cu
80 .   el          .TP 15
81 .\}
82 .ie !"\\$3"" \{\
83 .ta \\n()Au \\n()Bu
84 \&\\$1  \\fI\\$2\\fP    (\\$3)
85 .\".b
86 .\}
87 .el \{\
88 .br
89 .ie !"\\$2"" \{\
90 \&\\$1  \\fI\\$2\\fP
91 .\}
92 .el \{\
93 \&\\fI\\$1\\fP
94 .\}
95 .\}
96 ..
97 '\"     # define tabbing values for .AP
98 .de AS
99 .nr )A 10n
100 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
101 .nr )B \\n()Au+15n
102 .\"
103 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
104 .nr )C \\n()Bu+\\w'(in/out)'u+2n
105 ..
106 .AS Tcl_Interp Tcl_CreateInterp in/out
107 '\"     # BS - start boxed text
108 '\"     # ^y = starting y location
109 '\"     # ^b = 1
110 .de BS
111 .br
112 .mk ^y
113 .nr ^b 1u
114 .if n .nf
115 .if n .ti 0
116 .if n \l'\\n(.lu\(ul'
117 .if n .fi
118 ..
119 '\"     # BE - end boxed text (draw box now)
120 .de BE
121 .nf
122 .ti 0
123 .mk ^t
124 .ie n \l'\\n(^lu\(ul'
125 .el \{\
126 .\"     Draw four-sided box normally, but don't draw top of
127 .\"     box if the box started on an earlier page.
128 .ie !\\n(^b-1 \{\
129 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
130 .\}
131 .el \}\
132 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
133 .\}
134 .\}
135 .fi
136 .br
137 .nr ^b 0
138 ..
139 '\"     # VS - start vertical sidebar
140 '\"     # ^Y = starting y location
141 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
142 .de VS
143 .if !"\\$2"" .br
144 .mk ^Y
145 .ie n 'mc \s12\(br\s0
146 .el .nr ^v 1u
147 ..
148 '\"     # VE - end of vertical sidebar
149 .de VE
150 .ie n 'mc
151 .el \{\
152 .ev 2
153 .nf
154 .ti 0
155 .mk ^t
156 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
157 .sp -1
158 .fi
159 .ev
160 .\}
161 .nr ^v 0
162 ..
163 '\"     # Special macro to handle page bottom:  finish off current
164 '\"     # box/sidebar if in box/sidebar mode, then invoked standard
165 '\"     # page bottom macro.
166 .de ^B
167 .ev 2
168 'ti 0
169 'nf
170 .mk ^t
171 .if \\n(^b \{\
172 .\"     Draw three-sided box if this is the box's first page,
173 .\"     draw two sides but no top otherwise.
174 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
175 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
176 .\}
177 .if \\n(^v \{\
178 .nr ^x \\n(^tu+1v-\\n(^Yu
179 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
180 .\}
181 .bp
182 'fi
183 .ev
184 .if \\n(^b \{\
185 .mk ^y
186 .nr ^b 2
187 .\}
188 .if \\n(^v \{\
189 .mk ^Y
190 .\}
191 ..
192 '\"     # DS - begin display
193 .de DS
194 .RS
195 .nf
196 .sp
197 ..
198 '\"     # DE - end display
199 .de DE
200 .fi
201 .RE
202 .sp
203 ..
204 '\"     # SO - start of list of standard options
205 .de SO
206 .SH "STANDARD OPTIONS"
207 .LP
208 .nf
209 .ta 4c 8c 12c
210 .ft B
211 ..
212 '\"     # SE - end of list of standard options
213 .de SE
214 .fi
215 .ft R
216 .LP
217 See the \\fBoptions\\fR manual entry for details on the standard options.
218 ..
219 '\"     # OP - start of full description for a single option
220 .de OP
221 .LP
222 .nf
223 .ta 4c
224 Command-Line Name:      \\fB\\$1\\fR
225 Database Name:  \\fB\\$2\\fR
226 Database Class: \\fB\\$3\\fR
227 .fi
228 .IP
229 ..
230 '\"     # CS - begin code excerpt
231 .de CS
232 .RS
233 .nf
234 .ta .25i .5i .75i 1i
235 ..
236 '\"     # CE - end code excerpt
237 .de CE
238 .fi
239 .RE
240 ..
241 .de UL
242 \\$1\l'|0\(ul'\\$2
243 ..
244 .BS
245 '\" Note:  do not modify the .SH NAME line immediately below!
246 .SH NAME
247 itcl::delegation \- delegate methods, procs or options to other objects
248 .PP
249 Parts of this description are "borrowed" from Tcl extension [snit], as the functionality is mostly identical.
250 .SH WARNING!
251 This is new functionality in [incr Tcl] where the API can still change!!
252 .SH SYNOPSIS
253 .nf
254 \fBdelegate method \fImethodName\fB to \fIcomponentName\fR ?\fBas \fItargetName\fR?
255 \fBdelegate method \fImethodName\fR ?\fBto \fIcomponentName\fR? \fBusing \fIpattern\fR
256 \fBdelegate method \fI* ?\fBto \fIcomponentName\fR? ?\fBusing \fIpattern\fR? ?\fBexcept \fImethodName methodName ...\fR?
257
258 \fBdelegate proc \fIprocName\fB to \fIcomponentName\fR ?\fBas \fItargetName\fR?
259 \fBdelegate proc \fIprocName\fR ?\fBto \fIcomponentName\fR? \fBusing \fIpattern\fR
260 \fBdelegate proc \fI*\fR ?\fBto \fIcomponentName\fR? ?\fBusing \fIpattern\fR? ?\fBexcept \fIprocName procName ...\fR?
261
262 \fBdelegate option \fIoptionSpec\fB to \fIcomponentName\fR
263 \fBdelegate option \fIoptionSpec\fB to \fIcomponentName\fR \fBas \fItargetname\fR?
264 \fBdelegate option \fI* \fBto \fIcomponentName\fR
265 \fBdelegate option \fI* \fBto \fIcomponentName\fR \fBexcept \fIoptionName optionname ...\fR
266 .fi
267 .BE
268
269 .SH DESCRIPTION
270 .PP
271 The \fBdelegate\fR command is used inside an \fB[incr\ Tcl]\fR
272 extendedclass/widget/widgetadaptor definition to delegate
273 methods/procs/options to other objects for handling.
274 .TP
275 \fBdelegate method \fImethodName\fB to \fIcomponentName\fR ?\fBas \fItargetName\fR?
276 .
277 This form of delegate method delegates method methodName to component
278 componentName. That is, when method methdoNameame is called on an instance of
279 this type, the method and its arguments will be passed to the named component's
280 command instead. That is, the following statement
281 .RS
282 .PP
283 .CS
284 delegate method wag to tail
285 .CE
286 .PP
287 is roughly equivalent to this explicitly defined method:
288 .PP
289 .CS
290 method wag {args} {
291     uplevel $tail wag $args
292 }
293 .CE
294 .PP
295 The optional \fBas\fR clause allows you to specify the delegated method
296 name and possibly add some arguments:
297 .PP
298 .CS
299 delegate method wagtail to tail as "wag briskly"
300 .CE
301 .PP
302 A method cannot be both locally defined and delegated. 
303 .RE
304 .TP
305 \fBdelegate method \fImethodName\fR ?\fBto \fIcomponentName\fR? \fBusing \fIpattern\fR
306 .
307 In this form of the delegate statement, the \fBusing\fR clause is used to
308 specify the precise form of the command to which method name name is delegated.
309 The \fBto\fR clause is optional, since the chosen command might not involve
310 any particular component.
311 .RS
312 .PP
313 The value of the using clause is a list that may contain any or all of the
314 following substitution codes; these codes are substituted with the described
315 value to build the delegated command prefix. Note that the following two
316 statements are equivalent:
317 .PP
318 .CS
319 delegate method wag to tail
320 delegate method wag to tail using "%c %m"
321 .CE
322 .PP
323 Each element of the list becomes a single element of the delegated command 
324 --it is never reparsed as a string.
325 .PP
326 Substitutions:
327 .TP
328 \fB%%\fR
329 .
330 This is replaced with a single "%". Thus, to pass the string "%c" to the
331 command as an argument, you'd write "%%c".
332 .TP
333 \fB%c\fR
334 .
335 This is replaced with the named component's command. 
336 .TP
337 \fB%j\fR
338 .
339 This is replaced by the method name; if the name consists of multiple tokens,
340 they are joined by underscores ("_").
341 .TP
342 \fB%m\fR
343 .
344 This is replaced with the final token of the method name; if the method name
345 has one token, this is identical to \fB%M\fR.
346 .TP
347 \fB%M\fR
348 .
349 This is replaced by the method name; if the name consists of multiple tokens,
350 they are joined by space characters.
351 .TP
352 \fB%n\fR
353 .
354 This is replaced with the name of the instance's private namespace.
355 .TP
356 \fB%s\fR
357 .
358 This is replaced with the name of the instance command. 
359 .TP
360 \fB%t\fR
361 .
362 This is replaced with the fully qualified type name. 
363 .TP
364 \fB%w\fR
365 .
366 This is replaced with the original name of the instance command; for Itcl
367 widgets and widget adaptors, it will be the Tk window name. It remains
368 constant, even if the instance command is renamed.
369 .RE
370 .TP
371 \fBdelegate method \fI*\fR ?\fBto \fIcomponentName\fR? ?\fBusing \fIpattern\fR? ?\fBexcept \fImethodName methodName ...\fR?
372 .
373 In this form all unknown method names are delegeted to the specified
374 component. The except clause can be used to specify a list of exceptions,
375 i.e., method names that will not be so delegated. The using clause
376 is defined as given above. In this form, the statement must
377 contain the to clause, the using clause, or both.
378 .RS
379 .PP
380 In fact, the "*" can be a list of two or more tokens whose last element
381 is "*", as in the following example:
382 .PP
383 .CS
384 delegate method {tail *} to tail
385 .CE
386 .PP
387 This implicitly defines the method tail whose subcommands will be
388 delegated to the tail component. 
389 .PP
390 The definitions for \fBdelegate proc\fR ... are the same as for method,
391 the only difference being, that this is for procs.
392 .RE
393 .TP
394 \fBdelegate option \fInamespec\fB to \fIcomp\fR
395 .TP
396 \fBdelegate option namespec to comp as target\fR
397 .TP
398 \fBdelegate option * to \fIcomp\fR
399 .TP
400 \fBdelegate option * to \fIcomp \fBexcept \fIexceptions\fR
401 .
402 Defines a delegated option; the namespec is defined as for the option
403 statement. When the configure, configurelist, or cget instance method is
404 used to set or retrieve the option's value, the equivalent configure or
405 cget command will be applied to the component as though the option was
406 defined with the following \fB-configuremethod\fR and \fB-cgetmethod\fR:
407 .RS
408 .PP
409 .CS
410 method ConfigureMethod {option value} {
411     $comp configure $option $value
412 }
413
414 method CgetMethod {option} {
415     return [$comp cget $option]
416 }
417 .CE
418 .PP
419 Note that delegated options never appear in the \fBitcl_options\fR array.
420 If the as clause is specified, then the target option name is used in place
421 of name.
422 .RE
423 .TP
424 \fBdelegate \fIoption\fB *\fR ?\fBexcept\fI optionName optionName ...\fR?
425 .
426 This form delegates all unknown options to the specified component.
427 The except clause can be used to specify a list of exceptions,
428 i.e., option names that will not be so delegated.
429 .RS
430 .PP
431 \fBWarning:\fR options can only be delegated to a component if it supports the
432 \fBconfigure\fR and \fBcget\fR instance methods.
433 .PP
434 An option cannot be both locally defined and delegated. TBD: Continue from here.
435 .RE
436 .SH KEYWORDS
437 delegation, option, method, proc