Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / Canvas.pod
CommitLineData
86530b38
AT
1# Copyright (c) 1992-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=head1 NAME
8
9Tk::Canvas - Create and manipulate Canvas widgets
10
11=for category Tk Widget Classes
12
13=head1 SYNOPSIS
14
15I<$canvas> = I<$parent>-E<gt>B<Canvas>(?I<options>?);
16
17=head1 STANDARD OPTIONS
18
19B<-background> B<-highlightthickness> B<-insertwidth> B<-state>
20B<-borderwidth> B<-insertbackground> B<-relief> B<-tile>
21B<-cursor> B<-insertborderwidth> B<-selectbackground> B<-takefocus>
22B<-highlightbackground> B<-insertofftime> B<-selectborderwidth> B<-xscrollcommand>
23B<-highlightcolor> B<-insertontime> B<-selectforeground> B<-yscrollcommand>
24
25=head1 WIDGET-SPECIFIC OPTIONS
26
27=over 4
28
29=item Name: B<closeEnough>
30
31=item Class: B<CloseEnough>
32
33=item Switch: B<-closeenough>
34
35Specifies a floating-point value indicating how close the mouse cursor
36must be to an item before it is considered to be ``inside'' the item.
37Defaults to 1.0.
38
39=item Name: B<confine>
40
41=item Class: B<Confine>
42
43=item Switch: B<-confine>
44
45Specifies a boolean value that indicates whether or not it should be
46allowable to set the canvas's view outside the region defined by the
47B<scrollRegion> argument.
48Defaults to true, which means that the view will
49be constrained within the scroll region.
50
51=item Name: B<height>
52
53=item Class: B<Height>
54
55=item Switch: B<-height>
56
57Specifies a desired window height that the canvas widget should request from
58its geometry manager. The value may be specified in any
59of the forms described in the L<"COORDINATES"> section below.
60
61=item Name: B<scrollRegion>
62
63=item Class: B<ScrollRegion>
64
65=item Switch: B<-scrollregion>
66
67Specifies a list with four coordinates describing the left, top, right, and
68bottom coordinates of a rectangular region.
69This region is used for scrolling purposes and is considered to be
70the boundary of the information in the canvas.
71Each of the coordinates may be specified
72in any of the forms given in the L<"COORDINATES"> section below.
73
74=item Name: B<state>
75
76=item Class: B<State>
77
78=item Switch: B<-state>
79
80Modifies the default state of the canvas where I<state> may be set to one of:
81normal, disabled, or hidden. Individual canvas objects all have their own
82state option, which overrides the default state. Many options can take
83separate specifications such that the appearance of the item can be different
84in different situations. The options that start with "active" control the
85appearence when the mouse pointer is over it, while the option starting
86with "disabled" controls the appearence when the state is disabled.
87
88=item Name: B<width>
89
90=item Class: B<width>
91
92=item Switch: B<-width>
93
94Specifies a desired window width that the canvas widget should request from
95its geometry manager. The value may be specified in any
96of the forms described in the L<"COORDINATES"> section below.
97
98=item Name: B<xScrollIncrement>
99
100=item Class: B<ScrollIncrement>
101
102=item Switch: B<-xscrollincrement>
103
104Specifies an increment for horizontal scrolling, in any of the usual forms
105permitted for screen distances. If the value of this option is greater
106than zero, the horizontal view in the window will be constrained so that
107the canvas x coordinate at the left edge of the window is always an even
108multiple of B<xScrollIncrement>; furthermore, the units for scrolling
109(e.g., the change in view when the left and right arrows of a scrollbar
110are selected) will also be B<xScrollIncrement>. If the value of
111this option is less than or equal to zero, then horizontal scrolling
112is unconstrained.
113
114=item Name: B<yScrollIncrement>
115
116=item Class: B<ScrollIncrement>
117
118=item Switch: B<-yscrollincrement>
119
120Specifies an increment for vertical scrolling, in any of the usual forms
121permitted for screen distances. If the value of this option is greater
122than zero, the vertical view in the window will be constrained so that
123the canvas y coordinate at the top edge of the window is always an even
124multiple of B<yScrollIncrement>; furthermore, the units for scrolling
125(e.g., the change in view when the top and bottom arrows of a scrollbar
126are selected) will also be B<yScrollIncrement>. If the value of
127this option is less than or equal to zero, then vertical scrolling
128is unconstrained.
129
130=back
131
132=head1 DESCRIPTION
133
134The B<Canvas> method creates a new window (given
135by the $canvas argument) and makes it into a canvas widget.
136Additional options, described above, may be specified on the
137command line or in the option database
138to configure aspects of the canvas such as its colors and 3-D relief.
139The B<canvas> command returns its
140$canvas argument. At the time this command is invoked,
141there must not exist a window named $canvas, but
142$canvas's parent must exist.
143
144Canvas widgets implement structured graphics.
145A canvas displays any number of I<items>, which may be things like
146rectangles, circles, lines, and text.
147Items may be manipulated (e.g. moved or re-colored) and
148L<callbacks|Tk::callbacks> may
149be associated with items in much the same way that the L<bind|Tk::bind>
150method allows callbacks to be bound to widgets. For example,
151a particular callback may be associated with the B<E<lt>Button-1E<gt>> event
152so that the callback is invoked whenever button 1 is pressed with
153the mouse cursor over an item.
154This means that items in a canvas can have behaviors defined by
155the Callbacks bound to them.
156
157=head1 DISPLAY LIST
158
159The items in a canvas are ordered for purposes of display,
160with the first item in the display list being displayed
161first, followed by the next item in the list, and so on.
162Items later in the display list obscure those that are
163earlier in the display list and are sometimes referred to
164as being I<``on top''> of earlier items.
165When a new item is created it is placed at the end of the
166display list, on top of everything else.
167Widget methods may be used to re-arrange the order of the
168display list.
169
170Window items are an exception to the above rules. The underlying
171window systems require them always to be drawn on top of other items.
172In addition, the stacking order of window items
173is not affected by any of the canvas methods; you must use
174the L<raise|Tk::Widget> and L<lower|Tk::Widget> Tk widget methods instead.
175
176=head1 ITEM IDS AND TAGS
177
178Items in a canvas widget may be named in either of two ways:
179by id or by tag.
180Each item has a unique identifying number which is assigned to
181that item when it is created. The id of an item never changes
182and id numbers are never re-used within the lifetime of a
183canvas widget.
184
185Each item may also have any number of I<tags> associated
186with it. A tag is just a string of characters, and it may
187take any form except that of an integer.
188For example, ``x123'' is OK but ``123'' isn't.
189The same tag may be associated with many different items.
190This is commonly done to group items in various interesting
191ways; for example, all selected items might be given the
192tag ``selected''.
193
194The tag B<all> is implicitly associated with every item
195in the canvas; it may be used to invoke operations on
196all the items in the canvas.
197
198The tag B<current> is managed automatically by Tk;
199it applies to the I<current item>, which is the
200topmost item whose drawn area covers the position of
201the mouse cursor.
202If the mouse is not in the canvas widget or is not over
203an item, then no item has the B<current> tag.
204
205When specifying items in canvas methods, if the
206specifier is an integer then it is assumed to refer to
207the single item with that id.
208If the specifier is not an integer, then it is assumed to
209refer to all of the items in the canvas that have a tag
210matching the specifier.
211The symbol I<tagOrId> is used below to indicate that
212an argument specifies either an id that selects a single
213item or a tag that selects zero or more items.
214
215I<tagOrId> may contain a logical expressions of
216tags by using operators: 'E<amp>E<amp>', '||', '^' '!', and parenthezised
217subexpressions. For example:
218
219$c-E<gt>find('withtag', '(aE<amp>E<amp>!b)|(!aE<amp>E<amp>b)');
220
221or equivalently:
222
223$c-E<gt>find('withtag', 'a^b');
224
225will find only those items with either "a" or "b" tags, but not both.
226
227Some methods only operate on a single item at a
228time; if I<tagOrId> is specified in a way that
229names multiple items, then the normal behavior is for
230the methods is to use the first (lowest) of these items in
231the display list that is suitable for the method.
232Exceptions are noted in the method descriptions
233below.
234
235=head1 COORDINATES
236
237All coordinates related to canvases are stored as floating-point
238numbers.
239Coordinates and distances are specified in screen units,
240which are floating-point numbers optionally followed
241by one of several letters.
242If no letter is supplied then the distance is in pixels.
243If the letter is B<m> then the distance is in millimeters on
244the screen; if it is B<c> then the distance is in centimeters;
245B<i> means inches, and B<p> means printers points (1/72 inch).
246Larger y-coordinates refer to points lower on the screen; larger
247x-coordinates refer to points farther to the right.
248
249=head1 TRANSFORMATIONS
250
251Normally the origin of the canvas coordinate system is at the
252upper-left corner of the window containing the canvas.
253It is possible to adjust the origin of the canvas
254coordinate system relative to the origin of the window using the
255B<xview> and B<yview> methods; this is typically used
256for scrolling.
257Canvases do not support scaling or rotation of the canvas coordinate
258system relative to the window coordinate system.
259
260Individual items may be moved or scaled using methods
261described below, but they may not be rotated.
262
263=head1 INDICES
264
265Text items support the notion of an I<index> for identifying
266particular positions within the item.
267
268Indices are used for methods such as inserting text, deleting
269a range of characters, and setting the insertion cursor position.
270An index may be specified in any of a number of ways, and
271different types of items may support different forms for
272specifying indices.
273
274In a similar fashion, line and polygon items support I<index> for
275identifying, inserting and deleting subsets of their coordinates.
276Indices are used for commands such as inserting or deleting
277a range of characters or coordinates, and setting the insertion
278cursor position. An index may be specified in any of a number
279of ways, and different types of items may support different forms
280for specifying indices.
281
282Text items support the following forms for an index; if you
283define new types of text-like items, it would be advisable to
284support as many of these forms as practical.
285Note that it is possible to refer to the character just after
286the last one in the text item; this is necessary for such
287tasks as inserting new text at the end of the item.
288Lines and Polygons don't support the insertion cursor
289and the selection. Their indices are supposed to be even
290always, because coordinates always appear in pairs.
291
292=over 4
293
294=item I<number>
295
296A decimal number giving the position of the desired character
297within the text item.
2980 refers to the first character, 1 to the next character, and
299so on. If indexes are odd for lines and polygons, they will be
300automatically decremented by one.
301A number less than 0 is treated as if it were zero, and a
302number greater than the length of the text item is treated
303as if it were equal to the length of the text item. For
304polygons, numbers less than 0 or greater then the length
305of the coordinate list will be adjusted by adding or substracting
306the length until the result is between zero and the length,
307inclusive.
308
309=item B<end>
310
311Refers to the character or coordinate just after the last one
312in the item (same as the number of characters or coordinates
313in the item).
314
315=item B<insert>
316
317Refers to the character just before which the insertion cursor
318is drawn in this item. Not valid for lines and polygons.
319
320=item B<sel.first>
321
322Refers to the first selected character in the item.
323If the selection isn't in this item then this form is illegal.
324
325=item B<sel.last>
326
327Refers to the last selected character in the item.
328If the selection isn't in this item then this form is illegal.
329
330=item B<[>I<x,y>B<]>
331
332Refers to the character or coordinate at the point given by I<x> and
333I<y>, where I<x> and I<y> are specified in the coordinate
334system of the canvas.
335If I<x> and I<y> lie outside the coordinates covered by the
336text item, then they refer to the first or last character in the
337line that is closest to the given point.
338The Tcl string form "@x,y" is also allowed.
339
340=back
341
342=head1 DASH PATTERNS
343
344Many items support the notion of an dash pattern for outlines.
345
346The first possible syntax is a list of integers. Each element
347represents the number of pixels of a line segment. Only the odd
348segments are drawn using the "outline" color. The other segments
349are drawn transparant.
350
351The second possible syntax is a character list containing only
3525 possible characters B<[.,-_ ]>. The space can be used
353to enlarge the space between other line elements, and can not
354occur as the first position in the string. Some examples:
355
356 -dash . = -dash [2,4]
357 -dash - = -dash [6,4]
358 -dash -. = -dash [6,4,2,4]
359 -dash -.. = -dash [6,4,2,4,2,4]
360 -dash '. ' = -dash [2,8]
361 -dash ',' = -dash [4,4]
362
363The main difference of this syntax with the previous is that it
364it shape-conserving. This means that all values in the dash
365list will be multiplied by the line width before display. This
366assures that "." will always be displayed as a dot and "-"
367always as a dash regardless of the line width.
368
369On systems where only a limited set of dash patterns, the dash
370pattern will be displayed as the most close dash pattern that
371is available. For example, on Windows only the first 4 of the
372above examples are available. The last 2 examples will be
373displayed identically as the first one.
374
375=head1 WIDGET METHODS
376
377The B<Canvas> method creates a widget object.
378This object supports the B<configure> and B<cget> methods
379described in L<Tk::options> which can be used to enquire and
380modify the options described above.
381The widget also inherits all the methods provided by the generic
382L<Tk::Widget|Tk::Widget> class.
383
384The following additional methods are available for canvas widgets:
385
386=over 4
387
388=item I<$canvas>-E<gt>B<addtag>(I<tag, searchSpec, >?I<arg, arg, ...>?)
389
390For each item that meets the constraints specified by
391I<searchSpec> and the I<arg>s, add
392I<tag> to the list of tags associated with the item if it
393isn't already present on that list.
394It is possible that no items will satisfy the constraints
395given by I<searchSpec> and I<arg>s, in which case the
396method has no effect.
397This command returns an empty string as result.
398I<SearchSpec> and I<arg>'s may take any of the following
399forms:
400
401=over 8
402
403=item B<above >I<tagOrId>
404
405Selects the item just after (above) the one given by I<tagOrId>
406in the display list.
407If I<tagOrId> denotes more than one item, then the last (topmost)
408of these items in the display list is used.
409
410=item B<all>
411
412Selects all the items in the canvas.
413
414=item B<below >I<tagOrId>
415
416Selects the item just before (below) the one given by I<tagOrId>
417in the display list.
418If I<tagOrId> denotes more than one item, then the first (lowest)
419of these items in the display list is used.
420
421=item B<closest >I<x y >?I<halo>? ?I<start>?
422
423Selects the item closest to the point given by I<x> and I<y>.
424If more than one item is at the same closest distance (e.g. two
425items overlap the point), then the top-most of these items (the
426last one in the display list) is used.
427If I<halo> is specified, then it must be a non-negative
428value.
429Any item closer than I<halo> to the point is considered to
430overlap it.
431The I<start> argument may be used to step circularly through
432all the closest items.
433If I<start> is specified, it names an item using a tag or id
434(if by tag, it selects the first item in the display list with
435the given tag).
436Instead of selecting the topmost closest item, this form will
437select the topmost closest item that is below I<start> in
438the display list; if no such item exists, then the selection
439behaves as if the I<start> argument had not been specified.
440
441=item B<enclosed> I<x1> I<y1> I<x2> I<y2>
442
443Selects all the items completely enclosed within the rectangular
444region given by I<x1>, I<y1>, I<x2>, and I<y2>.
445I<X1> must be no greater then I<x2> and I<y1> must be
446no greater than I<y2>.
447
448=item B<overlapping> I<x1> I<y1> I<x2> I<y2>
449
450Selects all the items that overlap or are enclosed within the
451rectangular region given by I<x1>, I<y1>, I<x2>,
452and I<y2>.
453I<X1> must be no greater then I<x2> and I<y1> must be
454no greater than I<y2>.
455
456=item B<withtag >I<tagOrId>
457
458Selects all the items given by I<tagOrId>.
459
460=back
461
462=item I<$canvas>-E<gt>B<bbox>(I<tagOrId, >?I<tagOrId, tagOrId, ...>?)
463
464Returns a list with four elements giving an approximate bounding box
465for all the items named by the I<tagOrId> arguments.
466The list has the form ``I<x1 y1 x2 y2>'' such that the drawn
467areas of all the named elements are within the region bounded by
468I<x1> on the left, I<x2> on the right, I<y1> on the top,
469and I<y2> on the bottom.
470The return value may overestimate the actual bounding box by
471a few pixels.
472If no items match any of the I<tagOrId> arguments or if the
473matching items have empty bounding boxes (i.e. they have nothing
474to display)
475then an empty string is returned.
476
477=item I<$canvas>-E<gt>B<bind>(I<tagOrId>?, I<sequence>? ?,I<callback>?)
478
479This method associates I<callback> with all the items given by
480I<tagOrId> such that whenever the event sequence given by
481I<sequence> occurs for one of the items the callback will
482be invoked.
483This method is similar to the B<bind> method except that
484it operates on items in a canvas rather than entire widgets.
485See L<Tk::bind> for complete details
486on the syntax of I<sequence> and the substitutions performed
487on I<callback> before invoking it.
488If all arguments are specified then a new binding is created, replacing
489any existing binding for the same I<sequence> and I<tagOrId>
490(if the first character of I<command> is ``+'' then I<command>
491augments an existing binding rather than replacing it).
492In this case the return value is an empty string.
493If I<callback> is omitted then the method returns the I<callback>
494associated with I<tagOrId> and I<sequence> (an error occurs
495if there is no such binding).
496If both I<callback> and I<sequence> are omitted then the method
497returns a list of all the sequences for which bindings have been
498defined for I<tagOrId>.
499
500=over 8
501
502The only events for which bindings may be specified are those related to
503the mouse and keyboard (such as B<Enter>, B<Leave>,
504B<ButtonPress>, B<Motion>, and B<KeyPress>) or virtual events.
505The handling of events in canvases uses the current item defined
506in L<"ITEM IDS AND TAGS"> above. B<Enter> and B<Leave> events trigger for an
507item when it becomes the current item or ceases to be the current item;
508note that these events are different than B<Enter> and B<Leave>
509events for windows. Mouse-related events are directed to the current
510item, if any. Keyboard-related events are directed to the focus item, if
511any (see the L<focus|/focus> method below for more on this). If a
512virtual event is used in a binding, that binding can trigger only if the
513virtual event is defined by an underlying mouse-related or
514keyboard-related event.
515
516It is possible for multiple bindings to match a particular event.
517This could occur, for example, if one binding is associated with the
518item's id and another is associated with one of the item's tags.
519When this occurs, all of the matching bindings are invoked.
520A binding associated with the B<all> tag is invoked first,
521followed by one binding for each of the item's tags (in order),
522followed by a binding associated with the item's id.
523If there are multiple matching bindings for a single tag,
524then only the most specific binding is invoked.
525A B<continue> in a callback terminates that
526subroutine, and a B<break> method terminates that subroutine
527and skips any remaining callbacks for the event, just as for the
528B<bind> method.
529
530If bindings have been created for a canvas window using the B<CanvasBind>
531method, then they are invoked in addition to bindings created for
532the canvas's items using the B<bind> method.
533The bindings for items will be invoked before any of the bindings
534for the window as a whole.
535
536=back
537
538=item I<$canvas>-E<gt>B<canvasx>(I<screenx>?, I<gridspacing>?)
539
540Given a window x-coordinate in the canvas I<screenx>, this method returns
541the canvas x-coordinate that is displayed at that location.
542If I<gridspacing> is specified, then the canvas coordinate is
543rounded to the nearest multiple of I<gridspacing> units.
544
545=item I<$canvas>-E<gt>B<canvasy>(I<screeny, >?I<gridspacing>?)
546
547Given a window y-coordinate in the canvas I<screeny> this method returns
548the canvas y-coordinate that is displayed at that location.
549If I<gridspacing> is specified, then the canvas coordinate is
550rounded to the nearest multiple of I<gridspacing> units.
551
552=item I<$canvas>-E<gt>B<coords>(I<tagOrId >?I<x0,y0 ...>?)
553
554Query or modify the coordinates that define an item.
555If no coordinates are specified, this method returns a list
556whose elements are the coordinates of the item named by
557I<tagOrId>.
558If coordinates are specified, then they replace the current
559coordinates for the named item.
560If I<tagOrId> refers to multiple items, then
561the first one in the display list is used.
562
563=item I<$canvas>-E<gt>B<create>(I<type, x, y, >?I<x, y, ...>?, ?I<option, value, ...>?)
564
565Create a new item in I<$canvas> of type I<type>.
566The exact format of the arguments after B<type> depends
567on B<type>, but usually they consist of the coordinates for
568one or more points, followed by specifications for zero or
569more item options.
570See the subsections on individual item types below for more
571on the syntax of this method.
572This method returns the id for the new item.
573
574=item I<$canvas>-E<gt>B<dchars>(I<tagOrId, first, >?I<last>?)
575
576For each item given by I<tagOrId>, delete the characters, or coordinates,
577in the range given by I<first> and I<last>, inclusive.
578If some of the items given by I<tagOrId> don't support
579Text items interpret I<first> and I<last> as indices to a character,
580line and polygon items interpret them indices to a coordinate (an x,y pair).
581within the item(s) as described in L<"INDICES"> above.
582If I<last> is omitted, it defaults to I<first>.
583This method returns an empty string.
584
585=item I<$canvas>-E<gt>B<delete>(?I<tagOrId, tagOrId, ...>?)
586
587Delete each of the items given by each I<tagOrId>, and return
588an empty string.
589
590=item I<$canvas>-E<gt>B<dtag>(I<tagOrId, >?I<tagToDelete>?)
591
592For each of the items given by I<tagOrId>, delete the
593tag given by I<tagToDelete> from the list of those
594associated with the item.
595If an item doesn't have the tag I<tagToDelete> then
596the item is unaffected by the method.
597If I<tagToDelete> is omitted then it defaults to I<tagOrId>.
598This method returns an empty string.
599
600=item I<$canvas>-E<gt>B<find>(I<searchCommand, >?I<arg, arg, ...>?)
601
602This method returns a list consisting of all the items that
603meet the constraints specified by I<searchCommand> and
604I<arg>'s.
605I<SearchCommand> and I<args> have any of the forms
606accepted by the B<addtag> method.
607The items are returned in stacking order, with the lowest item first.
608
609=item focus
610
611=item I<$canvas>-E<gt>B<focus>(?I<tagOrId>?)
612
613Set the keyboard focus for the canvas widget to the item given by
614I<tagOrId>.
615If I<tagOrId> refers to several items, then the focus is set
616to the first such item in the display list that supports the
617insertion cursor.
618If I<tagOrId> doesn't refer to any items, or if none of them
619support the insertion cursor, then the focus isn't changed.
620If I<tagOrId> is an empty
621string, then the focus item is reset so that no item has the focus.
622If I<tagOrId> is not specified then the method returns the
623id for the item that currently has the focus, or an empty string
624if no item has the focus.
625
626=over 8
627
628Once the focus has been set to an item, the item will display
629the insertion cursor and all keyboard events will be directed
630to that item.
631The focus item within a canvas and the focus window on the
632screen (set with the B<focus> method) are totally independent:
633a given item doesn't actually have the input focus unless (a)
634its canvas is the focus window and (b) the item is the focus item
635within the canvas.
636In most cases it is advisable to follow the B<focus> widget
637method with the B<CanvasFocus> method to set the focus window to
638the canvas (if it wasn't there already).
639
640=back
641
642=item I<$canvas>-E<gt>B<gettags>(I<tagOrId>)
643
644Return a list whose elements are the tags associated with the
645item given by I<tagOrId>.
646If I<tagOrId> refers to more than one item, then the tags
647are returned from the first such item in the display list.
648If I<tagOrId> doesn't refer to any items, or if the item
649contains no tags, then an empty string is returned.
650
651=item I<$canvas>-E<gt>B<icursor>(I<tagOrId, index>)
652
653Set the position of the insertion cursor for the item(s) given by I<tagOrId>
654to just before the character whose position is given by I<index>.
655If some or all of the items given by I<tagOrId> don't support
656an insertion cursor then this method has no effect on them.
657See L<"INDICES"> above for a description of the
658legal forms for I<index>.
659Note: the insertion cursor is only displayed in an item if
660that item currently has the keyboard focus (see the widget
661method B<focus>, below), but the cursor position may
662be set even when the item doesn't have the focus.
663This method returns an empty string.
664
665=item I<$canvas>-E<gt>B<index>(I<tagOrId, index>)
666
667This method returns a decimal string giving the numerical index
668within I<tagOrId> corresponding to I<index>.
669I<Index> gives a textual description of the desired position
670as described in L<"INDICES"> above.
671Text items interpret I<index> as an index to a character,
672line and polygon items interpret it as an index to a coordinate (an x,y pair).
673The return value is guaranteed to lie between 0 and the number
674of characters, or coordinates, within the item, inclusive.
675If I<tagOrId> refers to multiple items, then the index
676is processed in the first of these items that supports indexing
677operations (in display list order).
678
679=item I<$canvas>-E<gt>B<insert>(I<tagOrId, beforeThis, string>)
680
681For each of the items given by I<tagOrId>, if the item supports
682text or coordinate, insertion then I<string> is inserted into the item's
683text just before the character, or coordinate, whose index is I<beforeThis>.
684Text items interpret I<beforethis> as an index to a character,
685line and polygon items interpret it as an index to a coordinate (an x,y pair).
686For lines and polygons the I<string> must be a valid coordinate
687sequence.
688See L<"INDICES"> above for information about the forms allowed
689for I<beforeThis>.
690This method returns an empty string.
691
692=item I<$canvas>-E<gt>B<itemcget>(I<tagOrId, >I<option>)
693
694Returns the current value of the configuration option for the
695item given by I<tagOrId> whose name is I<option>.
696This method is similar to the L<cget|Tk::option> method except that
697it applies to a particular item rather than the widget as a whole.
698I<Option> may have any of the values accepted by the B<create>
699method when the item was created.
700If I<tagOrId> is a tag that refers to more than one item,
701the first (lowest) such item is used.
702
703=item I<$canvas>-E<gt>B<itemconfigure>(I<tagOrId, >?I<option>?, ?I<value>?, ?I<option, value, ...>?)
704
705This method is similar to the L<configure|Tk::option> method except
706that it modifies item-specific options for the items given by
707I<tagOrId> instead of modifying options for the overall
708canvas widget.
709If no I<option> is specified, returns a list describing all of
710the available options for the first item given by I<tagOrId>
711(see L<Tk::options> for
712information on the format of this list). If I<option> is specified
713with no I<value>, then the method returns a list describing the
714one named option (this list will be identical to the corresponding
715sublist of the value returned if no I<option> is specified). If
716one or more I<option-value> pairs are specified, then the method
717modifies the given widget option(s) to have the given value(s) in
718each of the items given by I<tagOrId>; in
719this case the method returns an empty string.
720The I<option>s and I<value>s are the same as those permissible
721in the B<create> method when the item(s) were created;
722see the sections describing individual item types below for details
723on the legal options.
724
725=item I<$canvas>-E<gt>B<lower>(I<tagOrId, >?I<belowThis>?)
726
727Move all of the items given by I<tagOrId> to a new position
728in the display list just before the item given by I<belowThis>.
729If I<tagOrId> refers to more than one item then all are moved
730but the relative order of the moved items will not be changed.
731I<BelowThis> is a tag or id; if it refers to more than one
732item then the first (lowest) of these items in the display list is used
733as the destination location for the moved items.
734Note: this method has no effect on window items. Window items always
735obscure other item types, and the stacking order of window items is
736determined by the B<raise> and B<lower> methods of the widget, not the
737B<raise> and B<lower> methods for canvases.
738This method returns an empty string.
739
740=item I<$canvas>-E<gt>B<move>(I<tagOrId, xAmount, yAmount>)
741
742Move each of the items given by I<tagOrId> in the canvas coordinate
743space by adding I<xAmount> to the x-coordinate of each point
744associated with the item and I<yAmount> to the y-coordinate of
745each point associated with the item.
746This method returns an empty string.
747
748=item I<$canvas>-E<gt>B<postscript>(?I<option, value, option, value, ...>?)
749
750Generate a Postscript representation for part or all of the canvas.
751If the B<-file> option is specified then the Postscript is written
752to a file and an empty string is returned; otherwise the Postscript
753is returned as the result of the method.
754If the interpreter that owns the canvas is marked as safe, the operation
755will fail because safe interpreters are not allowed to write files.
756If the B<-channel> option is specified, the argument denotes the name
757of a channel already opened for writing. The Postscript is written to
758that channel, and the channel is left open for further writing at the end
759of the operation.
760The Postscript is created in Encapsulated Postscript form using
761version 3.0 of the Document Structuring Conventions.
762Note: by default Postscript is only generated for information that
763appears in the canvas's window on the screen. If the canvas is
764freshly created it may still have its initial size of 1x1 pixel
765so nothing will appear in the Postscript. To get around this problem
766either invoke the B<update> method to wait for the canvas window
767to reach its final size, or else use the B<-width> and B<-height>
768options to specify the area of the canvas to print.
769The I<option>-I<value> argument pairs provide additional
770information to control the generation of Postscript. The following
771options are supported:
772
773=over 8
774
775=item B<-colormap> =E<gt> I<hashRef>
776
777I<HashRef> must be a reference to a hash variable or an anonymous hash
778that specifies a color mapping to use in the Postscript.
779Each value of the hash must consist of Postscript
780code to set a particular color value (e.g. ``B<1.0 1.0 0.0 setrgbcolor>'').
781When outputting color information in the Postscript, Tk checks
782to see if there is a key in the hash with the same
783name as the color.
784If so, Tk uses the value of the element as the Postscript method
785to set the color.
786If this option hasn't been specified, or if there isn't a key
787in I<hashRef> for a given color, then Tk uses the red, green,
788and blue intensities from the X color.
789
790=item B<-colormode> =E<gt> I<mode>
791
792Specifies how to output color information. I<Mode> must be either
793B<color> (for full color output), B<gray> (convert all colors
794to their gray-scale equivalents) or B<mono> (convert all colors
795to black or white).
796
797=item B<-file> =E<gt> I<fileName>
798
799Specifies the name of the file in which to write the Postscript.
800If this option isn't specified then the Postscript is returned as the
801result of the method instead of being written to a file.
802
803=item B<-fontmap> =E<gt> I<hashRef>
804
805I<HashRef> must be a reference to a hash variable or an anonymous hash
806that specifies a font mapping to use in the Postscript.
807Each value of the hash must consist of an array reference with
808two elements, which are the name and point size of a Postscript font.
809When outputting Postscript commands for a particular font, Tk
810checks to see if I<hashRef> contains a value with the same
811name as the font.
812If there is such an element, then the font information contained in
813that element is used in the Postscript.
814Otherwise Tk attempts to guess what Postscript font to use.
815Tk's guesses generally only work for well-known fonts such as
816Times and Helvetica and Courier, and only if the X font name does not
817omit any dashes up through the point size.
818For example, B<-*-Courier-Bold-R-Normal--*-120-*> will work but
819B<*Courier-Bold-R-Normal*120*> will not; Tk needs the dashes to
820parse the font name).
821
822=item B<-height> =E<gt> I<size>
823
824Specifies the height of the area of the canvas to print.
825Defaults to the height of the canvas window.
826
827=item B<-pageanchor> =E<gt> I<anchor>
828
829Specifies which point of the printed area of the canvas should appear over
830the positioning point on the page (which is given by the B<-pagex>
831and B<-pagey> options).
832For example, B<-pageanchor>=>B<n> means that the top center of the
833area of the canvas being printed (as it appears in the canvas window)
834should be over the positioning point. Defaults to B<center>.
835
836=item B<-pageheight> =E<gt> I<size>
837
838Specifies that the Postscript should be scaled in both x and y so
839that the printed area is I<size> high on the Postscript page.
840I<Size> consists of a floating-point number followed by
841B<c> for centimeters, B<i> for inches, B<m> for millimeters,
842or B<p> or nothing for printer's points (1/72 inch).
843Defaults to the height of the printed area on the screen.
844If both B<-pageheight> and B<-pagewidth> are specified then
845the scale factor from B<-pagewidth> is used (non-uniform scaling
846is not implemented).
847
848=item B<-pagewidth> =E<gt> I<size>
849
850Specifies that the Postscript should be scaled in both x and y so
851that the printed area is I<size> wide on the Postscript page.
852I<Size> has the same form as for B<-pageheight>.
853Defaults to the width of the printed area on the screen.
854If both B<-pageheight> and B<-pagewidth> are specified then
855the scale factor from B<-pagewidth> is used (non-uniform scaling
856is not implemented).
857
858=item B<-pagex> =E<gt> I<position>
859
860I<Position> gives the x-coordinate of the positioning point on
861the Postscript page, using any of the forms allowed for B<-pageheight>.
862Used in conjunction with the B<-pagey> and B<-pageanchor> options
863to determine where the printed area appears on the Postscript page.
864Defaults to the center of the page.
865
866=item B<-pagey> =E<gt> I<position>
867
868I<Position> gives the y-coordinate of the positioning point on
869the Postscript page, using any of the forms allowed for B<-pageheight>.
870Used in conjunction with the B<-pagex> and B<-pageanchor> options
871to determine where the printed area appears on the Postscript page.
872Defaults to the center of the page.
873
874=item B<-rotate> =E<gt> I<boolean>
875
876I<Boolean> specifies whether the printed area is to be rotated 90
877degrees.
878In non-rotated output the x-axis of the printed area runs along
879the short dimension of the page (``portrait'' orientation);
880in rotated output the x-axis runs along the long dimension of the
881page (``landscape'' orientation).
882Defaults to non-rotated.
883
884=item B<-width> =E<gt> I<size>
885
886Specifies the width of the area of the canvas to print.
887Defaults to the width of the canvas window.
888
889=item B<-x> => I<position>
890
891Specifies the x-coordinate of the left edge of the area of the
892canvas that is to be printed, in canvas coordinates, not window
893coordinates.
894Defaults to the coordinate of the left edge of the window.
895
896=item B<-y> => I<position>
897
898Specifies the y-coordinate of the top edge of the area of the
899canvas that is to be printed, in canvas coordinates, not window
900coordinates.
901Defaults to the coordinate of the top edge of the window.
902
903=back
904
905=item I<$canvas>-E<gt>B<raise>(I<tagOrId, >?I<aboveThis>?)
906
907Move all of the items given by I<tagOrId> to a new position
908in the display list just after the item given by I<aboveThis>.
909If I<tagOrId> refers to more than one item then all are moved
910but the relative order of the moved items will not be changed.
911I<AboveThis> is a tag or id; if it refers to more than one
912item then the last (topmost) of these items in the display list is used
913as the destination location for the moved items.
914Note: this method has no effect on window items. Window items always
915obscure other item types, and the stacking order of window items is
916determined by the B<raise> and B<lower> widget commands, not the
917B<raise> and B<lower> methods for canvases.
918This method returns an empty string.
919
920=item I<$canvas>-E<gt>B<scale>(I<tagOrId, xOrigin, yOrigin, xScale, yScale>)
921
922Rescale all of the items given by I<tagOrId> in canvas coordinate
923space.
924I<XOrigin> and I<yOrigin> identify the origin for the scaling
925operation and I<xScale> and I<yScale> identify the scale
926factors for x- and y-coordinates, respectively (a scale factor of
9271.0 implies no change to that coordinate).
928For each of the points defining each item, the x-coordinate is
929adjusted to change the distance from I<xOrigin> by a factor
930of I<xScale>.
931Similarly, each y-coordinate is adjusted to change the distance
932from I<yOrigin> by a factor of I<yScale>.
933This method returns an empty string.
934
935=item I<$canvas>-E<gt>B<scan>(I<option, args>)
936
937This method is used to implement scanning on canvases. It has
938two forms, depending on I<option>:
939
940=over 8
941
942=item I<$canvas>-E<gt>B<scanMark>(I<x, y>)
943
944Records I<x> and I<y> and the canvas's current view; used
945in conjunction with later B<scanDragto> method.
946Typically this method is associated with a mouse button press in
947the widget and I<x> and I<y> are the coordinates of the
948mouse. It returns an empty string.
949
950=item I<$canvas>-E<gt>B<scanDragto>(I<x, y, ?gain?>.)
951
952This method computes the difference between its I<x> and I<y>
953arguments (which are typically mouse coordinates) and the I<x> and
954I<y> arguments to the last B<scanMark> method for the widget.
955It then adjusts the view by 10 times the
956difference in coordinates. This method is typically associated
957It then adjusts the view by I<gain> times the
958difference in coordinates, where I<gain> defaults to 10.
959This command is typically associated
960with mouse motion events in the widget, to produce the effect of
961dragging the canvas at high speed through its window. The return
962value is an empty string.
963
964=back
965
966=item I<$canvas>-E<gt>B<select>(I<option, >?I<tagOrId, arg>?)
967
968Manipulates the selection in one of several ways, depending on
969I<option>.
970The method may take any of the forms described below.
971In all of the descriptions below, I<tagOrId> must refer to
972an item that supports indexing and selection; if it refers to
973multiple items then the first of
974these that supports indexing and the selection is used.
975I<Index> gives a textual description of a position
976within I<tagOrId>, as described in L<"INDICES"> above.
977
978=over 8
979
980=item I<$canvas>-E<gt>B<selectAdjust>(I<tagOrId, index>)
981
982Locate the end of the selection in I<tagOrId> nearest
983to the character given by I<index>, and adjust that
984end of the selection to be at I<index> (i.e. including
985but not going beyond I<index>).
986The other end of the selection is made the anchor point
987for future B<selectTo> method calls.
988If the selection isn't currently in I<tagOrId> then
989this method behaves the same as the B<selectTo> widget
990method.
991Returns an empty string.
992
993=item I<$canvas>-E<gt>B<selectClear>
994
995Clear the selection if it is in this widget.
996If the selection isn't in this widget then the method
997has no effect.
998Returns an empty string.
999
1000=item I<$canvas>-E<gt>B<selectFrom>(I<tagOrId, index>)
1001
1002Set the selection anchor point for the widget to be just
1003before the character
1004given by I<index> in the item given by I<tagOrId>.
1005This method doesn't change the selection; it just sets
1006the fixed end of the selection for future B<selectTo>
1007method calls.
1008Returns an empty string.
1009
1010=item I<$canvas>-E<gt>B<selectItem>
1011
1012Returns the id of the selected item, if the selection is in an
1013item in this canvas.
1014If the selection is not in this canvas then an empty string
1015is returned.
1016
1017=item I<$canvas>-E<gt>B<selectTo>(I<tagOrId, index>)
1018
1019Set the selection to consist of those characters of I<tagOrId>
1020between the selection anchor point and
1021I<index>.
1022The new selection will include the character given by I<index>;
1023it will include the character given by the anchor point only if
1024I<index> is greater than or equal to the anchor point.
1025The anchor point is determined by the most recent B<selectAdjust>
1026or B<selectFrom> method calls for this widget.
1027If the selection anchor point for the widget isn't currently in
1028I<tagOrId>, then it is set to the same character given
1029by I<index>.
1030Returns an empty string.
1031
1032=back
1033
1034=item I<$canvas>-E<gt>B<type>(I<tagOrId>)
1035
1036Returns the type of the item given by I<tagOrId>, such as
1037B<rectangle> or B<text>.
1038If I<tagOrId> refers to more than one item, then the type
1039of the first item in the display list is returned.
1040If I<tagOrId> doesn't refer to any items at all then
1041an empty string is returned.
1042
1043=item I<$canvas>-E<gt>B<xview>(?I<args>?)
1044
1045This method is used to query and change the horizontal position of the
1046information displayed in the canvas's window.
1047It can take any of the following forms:
1048
1049=over 8
1050
1051=item I<$canvas>-E<gt>B<xview>
1052
1053Returns a list containing two elements.
1054Each element is a real fraction between 0 and 1; together they describe
1055the horizontal span that is visible in the window.
1056For example, if the first element is .2 and the second element is .6,
105720% of the canvas's area (as defined by the B<-scrollregion> option)
1058is off-screen to the left, the middle 40% is visible
1059in the window, and 40% of the canvas is off-screen to the right.
1060These are the same values passed to scrollbars via the B<-xscrollcommand>
1061option.
1062
1063=item I<$canvas>-E<gt>B<xviewMoveto>(I<fraction>)
1064
1065Adjusts the view in the window so that I<fraction> of the
1066total width of the canvas is off-screen to the left.
1067I<Fraction> must be a fraction between 0 and 1.
1068
1069=item I<$canvas>-E<gt>B<xviewScroll>(I<number, what>)
1070
1071This method shifts the view in the window left or right according to
1072I<number> and I<what>.
1073I<Number> must be an integer.
1074I<What> must be either B<units> or B<pages> or an abbreviation
1075of one of these.
1076If I<what> is B<units>, the view adjusts left or right in units
1077of the B<xScrollIncrement> option, if it is greater than zero,
1078or in units of one-tenth the window's width otherwise.
1079If I<what is >B<pages> then the view
1080adjusts in units of nine-tenths the window's width.
1081If I<number> is negative then information farther to the left
1082becomes visible; if it is positive then information farther to the right
1083becomes visible.
1084
1085=back
1086
1087=item I<$canvas>-E<gt>B<yview>(I<?args>?)
1088
1089This method is used to query and change the vertical position of the
1090information displayed in the canvas's window.
1091It can take any of the following forms:
1092
1093=over 8
1094
1095=item I<$canvas>-E<gt>B<yview>
1096
1097Returns a list containing two elements.
1098Each element is a real fraction between 0 and 1; together they describe
1099the vertical span that is visible in the window.
1100For example, if the first element is .6 and the second element is 1.0,
1101the lowest 40% of the canvas's area (as defined by the B<-scrollregion>
1102option) is visible in the window.
1103These are the same values passed to scrollbars via the B<-yscrollcommand>
1104option.
1105
1106=item I<$canvas>-E<gt>B<yviewMoveto>(I<fraction>)
1107
1108Adjusts the view in the window so that I<fraction> of the canvas's
1109area is off-screen to the top.
1110I<Fraction> is a fraction between 0 and 1.
1111
1112=item I<$canvas>-E<gt>B<yviewScroll>(I<number, what>)
1113
1114This method adjusts the view in the window up or down according to
1115I<number> and I<what>.
1116I<Number> must be an integer.
1117I<What> must be either B<units> or B<pages>.
1118If I<what> is B<units>, the view adjusts up or down in units
1119of the B<yScrollIncrement> option, if it is greater than zero,
1120or in units of one-tenth the window's height otherwise.
1121If I<what> is B<pages> then
1122the view adjusts in units of nine-tenths the window's height.
1123If I<number> is negative then higher information becomes
1124visible; if it is positive then lower information
1125becomes visible.
1126
1127=back
1128
1129=back
1130
1131=head1 OVERVIEW OF ITEM TYPES
1132
1133The sections below describe the various types of items supported
1134by canvas widgets. Each item type is characterized by two things:
1135first, the form of the B<create> method used to create
1136instances of the type; and second, a set of configuration options
1137for items of that type, which may be used in the
1138B<create> and B<itemconfigure> methods.
1139Most items don't support indexing or selection or the methods
1140related to them, such as B<index> and B<insert>.
1141Where items do support these facilities, it is noted explicitly
1142in the descriptions below.
1143At present, text, line and polygon items provide this support.
1144For lines and polygons the indexing facility is used to manipulate
1145the coordinates of the item.
1146
1147=head1 ARC ITEMS
1148
1149Items of type B<arc> appear on the display as arc-shaped regions.
1150An arc is a section of an oval delimited by two angles (specified
1151by the B<-start> and B<-extent> options) and displayed in
1152one of several ways (specified by the B<-style> option).
1153Arcs are created with methods of the following form:
1154
1155 $canvas->createArc(x1, y1, x2, y2, ?option, value, option, value, ...?)
1156
1157The arguments I<x1>, I<y1>, I<x2>, and I<y2> give
1158the coordinates of two diagonally opposite corners of a
1159rectangular region enclosing the oval that defines the arc.
1160After the coordinates there may be any number of I<option>-I<value>
1161pairs, each of which sets one of the configuration options
1162for the item. These same I<option>-I<value> pairs may be
1163used in B<itemconfigure> methods to change the item's
1164configuration.
1165The following options are supported for arcs:
1166
1167=over 4
1168
1169=item B<-dash> =E<gt> I<pattern>
1170
1171=item B<-activedash> =E<gt> I<pattern>
1172
1173=item B<-disableddash> =E<gt> I<pattern>
1174
1175This option specifies dash patterns for the normal state, the active
1176state, and the disabled state of an arc item.
1177I<pattern> may have any of the forms accepted by B<Tk_GetDash>.
1178If the dash options are omitted then the default is a solid outline.
1179
1180=item B<-dashoffset> =E<gt> I<offset>
1181
1182The starting I<offset> into the pattern provided by the
1183B<-dash> option.
1184B<-dashoffset> is ignored if there is no B<-dash> pattern.
1185
1186=item B<-extent> =E<gt> I<degrees>
1187
1188Specifies the size of the angular range occupied by the arc.
1189The arc's range extends for I<degrees> degrees counter-clockwise
1190from the starting angle given by the B<-start> option.
1191I<Degrees> may be negative.
1192If it is greater than 360 or less than -360, then I<degrees>
1193modulo 360 is used as the extent.
1194
1195=item B<-fill> =E<gt> I<color>
1196
1197=item B<-activefill> =E<gt> I<color>
1198
1199=item B<-disabledfill> =E<gt> I<color>
1200
1201Specifies the color to be used to fill the arc region in its normal, active, and
1202disabled states,
1203I<Color> may have any of the forms accepted by B<Tk_GetColor>.
1204If I<color> is an empty string (the default), then
1205then the arc will not be filled.
1206
1207=item B<-outline> =E<gt> I<color>
1208
1209=item B<-activeoutline> =E<gt> I<color>
1210
1211=item B<-disabledoutline> =E<gt> I<color>
1212
1213This option specifies the color that should be used to draw the
1214outline of the arc in its normal, active and disabled states.
1215I<Color> may have any of the forms accepted by B<Tk_GetColor>.
1216This option defaults to B<black>. If I<color> is specified
1217as undef then no outline is drawn for the arc.
1218
1219=item B<-outlinestipple> =E<gt> I<bitmap>
1220
1221=item B<-activeoutlinestipple> =E<gt> I<bitmap>
1222
1223=item B<-disabledoutlinestipple> =E<gt> I<bitmap>
1224
1225This option specifies stipple patterns that should be used to draw the
1226outline of the arc in its normal, active and disabled states.
1227Indicates that the outline for the arc should be drawn with a stipple pattern;
1228I<bitmap> specifies the stipple pattern to use, in any of the
1229forms accepted by B<Tk_GetBitmap>.
1230If the B<-outline> option hasn't been specified then this option
1231has no effect.
1232If I<bitmap> is an empty string (the default), then the outline is drawn
1233in a solid fashion.
1234
1235=item B<-start> =E<gt> I<degrees>
1236
1237Specifies the beginning of the angular range occupied by the
1238arc.
1239I<Degrees> is given in units of degrees measured counter-clockwise
1240from the 3-o'clock position; it may be either positive or negative.
1241
1242=item B<-state> =E<gt> I<state>
1243
1244Modifies the state of the arc item where I<state> may be set to one of:
1245normal, disabled, hidden or "". If set to empty, the state of the canvas
1246itself is used. An arc item may also be in the "active"
1247state if the mouse is currently over it. Many options can take
1248separate specifications in normal, active and disabled states such that the
1249appearance of the item can be different in each state.
1250
1251=item B<-stipple> =E<gt> I<bitmap>
1252
1253=item B<-activestipple> =E<gt> I<bitmap>
1254
1255=item B<-disabledstipple> =E<gt> I<bitmap>
1256
1257This option specifies stipple patterns that should be used to fill the
1258the arc in its normal, active and disabled states.
1259I<bitmap> specifies the stipple pattern to use, in any of the
1260forms accepted by B<Tk_GetBitmap>.
1261If the B<-fill> option hasn't been specified then this option
1262has no effect.
1263If I<bitmap> is an empty string (the default), then filling is done
1264in a solid fashion.
1265
1266=item B<-style> =E<gt> I<type>
1267
1268Specifies how to draw the arc. If I<type> is B<pieslice>
1269(the default) then the arc's region is defined by a section
1270of the oval's perimeter plus two line segments, one between the center
1271of the oval and each end of the perimeter section.
1272If I<type> is B<chord> then the arc's region is defined
1273by a section of the oval's perimeter plus a single line segment
1274connecting the two end points of the perimeter section.
1275If I<type> is B<arc> then the arc's region consists of
1276a section of the perimeter alone.
1277In this last case the B<-fill> option is ignored.
1278
1279=item B<-tags> =E<gt> I<tagList>
1280
1281Specifies a set of tags to apply to the item.
1282I<TagList> consists of a list of tag names, which replace any
1283existing tags for the item.
1284I<TagList> may be an empty list.
1285
1286=item B<-updatecommand> =E<gt> I<command>
1287
1288Specifies a callback that is to be executed every time
1289the arc item is updated on the screen.
1290
1291=item B<-width> =E<gt> I<outlineWidth>
1292
1293=item B<-activewidth> =E<gt> I<outlineWidth>
1294
1295=item B<-disabledwidth> =E<gt> I<outlineWidth>
1296
1297Specifies the width of the outline to be drawn around
1298the arc's region, in its normal, active and disabled states.
1299I<outlineWidth> may be in any of the forms described in
1300the L<"COORDINATES"> section above.
1301If the B<-outline> option has been specified as undef
1302then this option has no effect.
1303Wide outlines will be drawn centered on the edges of the arc's region.
1304This option defaults to 1.0.
1305
1306=back
1307
1308=head1 BITMAP ITEMS
1309
1310Items of type B<bitmap> appear on the display as images with
1311two colors, foreground and background.
1312Bitmaps are created with methods of the following form:
1313
1314 $canvas->createBitmap(x, y, ?option, value, option, value, ...?)
1315
1316The arguments I<x> and I<y> specify the coordinates of a
1317point used to position the bitmap on the display (see the B<-anchor>
1318option below for more information on how bitmaps are displayed).
1319After the coordinates there may be any number of I<option>-I<value>
1320pairs, each of which sets one of the configuration options
1321for the item. These same I<option>-I<value> pairs may be
1322used in B<itemconfigure> methods to change the item's
1323configuration.
1324The following options are supported for bitmaps:
1325
1326=over 4
1327
1328=item B<-anchor> =E<gt> I<anchorPos>
1329
1330I<AnchorPos> tells how to position the bitmap relative to the
1331positioning point for the item; it may have any of the forms
1332accepted by B<Tk_GetAnchor>. For example, if I<anchorPos>
1333is B<center> then the bitmap is centered on the point; if
1334I<anchorPos> is B<n> then the bitmap will be drawn so that
1335its top center point is at the positioning point.
1336This option defaults to B<center>.
1337
1338=item B<-background> =E<gt> I<color>
1339
1340=item B<-activebackground> =E<gt> I<color>
1341
1342=item B<-disabledbackground> =E<gt> I<color>
1343
1344Specifies the color to use for each of the bitmap's '0' valued pixels
1345in its normal, active and disabled states.
1346I<Color> may have any of the forms accepted by B<Tk_GetColor>.
1347If this option isn't specified, or if it is specified as undef,
1348then nothing is displayed where the bitmap pixels are 0; this
1349produces a transparent effect.
1350
1351=item B<-bitmap> =E<gt> I<bitmap>
1352
1353=item B<-activebitmap> =E<gt> I<bitmap>
1354
1355=item B<-disabledbitmap> =E<gt> I<bitmap>
1356
1357Specifies the bitmaps to display in the item in its normal, active and
1358disabled states.
1359I<Bitmap> may have any of the forms accepted by B<Tk_GetBitmap>.
1360
1361=item B<-foreground> =E<gt> I<color>
1362
1363=item B<-activeforeground> =E<gt> I<bitmap>
1364
1365=item B<-disabledforeground> =E<gt> I<bitmap>
1366
1367Specifies the color to use for each of the bitmap's '1' valued pixels
1368in its normal, active and disabled states.
1369I<Color> may have any of the forms accepted by B<Tk_GetColor> and
1370defaults to B<black>.
1371
1372=item B<-state> =E<gt> I<state>
1373
1374Modifies the state of the bitmap item where I<state> may be set to one of:
1375normal, disabled, or hidden. An bitmap item may also be in the "active"
1376state if the mouse is currently over it. Many options can take
1377separate specifications in normal, active and disabled states such that the
1378appearance of the item can be different in each state.
1379
1380=item B<-tags> =E<gt> I<tagList>
1381
1382Specifies a set of tags to apply to the item.
1383I<TagList> consists of a list of tag names, which replace any
1384existing tags for the item.
1385I<TagList> may be an empty list.
1386
1387=item B<-updatecommand> =E<gt> I<command>
1388
1389Specifies a callback that is to be executed every time
1390the bitmap item is updated on the screen.
1391
1392=back
1393
1394=head1 GRID ITEMS
1395
1396Items of type B<grid> are intended for producing a visual reference for
1397interpreting other items. They can be drawn as either lines (with dash
1398style) or as rectangular "dots" at each grid point.
1399
1400Items of type B<grid> are unlike other items they always cover the
1401whole of the canvas, but are never enclosed by nor overlap any area
1402and are not near any point. That is they are intended to be always visible
1403but not "pickable", as such they do support the "active" state.
1404They are like other items in that: multiple
1405grids are permitted, they can be raised and lowered relative to other
1406items, they can be moved and scaled. As yet grids do not apear in
1407PostScript output.
1408
1409Grids have outline like configure options. Grids are created with methods of the
1410following form:
1411
1412 $canvas->createGrid(x1, y1, x2, y2, ?option, value, option, value, ...?)
1413
1414The arguments I<x1>, I<y1> give the origin of the grid. I<x2>, and I<y2> give
1415the coordinates of the next grid point in their respective directions.
1416After the coordinates there may be any number of I<option>-I<value>
1417pairs, each of which sets one of the configuration options
1418for the item. These same I<option>-I<value> pairs may be
1419used in B<itemconfigure> methods to change the item's
1420configuration.
1421The following options are supported for grids:
1422
1423=over 4
1424
1425=item B<-lines> =E<gt> I<boolean>
1426
1427If B<-lines> is set to a true value then lines are drawn for both X and Y
1428grids in the style determined by B<-dash>. Otherwise retangular "dots"
1429are drawn at each grid point.
1430
1431=item B<-dash> =E<gt> I<pattern>
1432
1433=item B<-disableddash> =E<gt> I<pattern>
1434
1435This option specifies dash patterns for the normal state,
1436and the disabled state of a grid item.
1437I<pattern> may have any of the forms accepted by B<Tk_GetDash>.
1438If the dash options are omitted then the default is a solid outline.
1439
1440=item B<-dashoffset> =E<gt> I<offset>
1441
1442The starting I<offset> into the pattern provided by the
1443B<-dash> option.
1444B<-dashoffset> is ignored if there is no B<-dash> pattern.
1445
1446=item B<-color> =E<gt> I<color>
1447
1448=item B<-disabledcolor> =E<gt> I<color>
1449
1450This option specifies the color that should be used to draw the
1451outline of the grid in its normal and disabled states.
1452I<Color> may have any of the forms accepted by B<Tk_GetColor>.
1453This option defaults to B<black>.
1454If I<color> is undef then no grid will be drawn.
1455
1456=item B<-stipple> =E<gt> I<bitmap>
1457
1458=item B<-disabledstipple> =E<gt> I<bitmap>
1459
1460This option specifies stipple patterns that should be used to draw the
1461outline of the rectangle in its normal and disabled states.
1462I<bitmap> specifies the stipple pattern to use, in any of the
1463forms accepted by B<Tk_GetBitmap>.
1464If I<bitmap> is an empty string (the default), then the outline is drawn
1465in a solid fashion.
1466
1467=item B<-state> =E<gt> I<state>
1468
1469Modifies the state of the rectangle item where I<state> may be set to one of:
1470normal, disabled, or hidden. Many options can take
1471separate specifications in normal and disabled states such that the
1472appearance of the item can be different in each state.
1473
1474=item B<-tags> =E<gt> I<tagList>
1475
1476Specifies a set of tags to apply to the item.
1477I<TagList> consists of a list of tag names, which replace any
1478existing tags for the item.
1479I<TagList> may be an empty list.
1480
1481=item B<-updatecommand> =E<gt> I<command>
1482
1483Specifies a callback that is to be executed every time
1484the grid item is updated on the screen.
1485
1486=item B<-width> =E<gt> I<outlineWidth>
1487
1488=item B<-disabledwidth> =E<gt> I<outlineWidth>
1489
1490Specifies the width of the lines drawn by the grid or the size (in both X and Y)
1491of the dots, in its normal and disabled states.
1492This option defaults to 1.0.
1493
1494=back
1495
1496=head1 IMAGE ITEMS
1497
1498Items of type B<image> are used to display images on a
1499canvas.
1500Images are created with methods of the following form:
1501
1502 $canvas->createImage(x, y, ?option, value, option, value, ...?)
1503
1504The arguments I<x> and I<y> specify the coordinates of a
1505point used to position the image on the display (see the B<-anchor>
1506option below for more information).
1507After the coordinates there may be any number of I<option>-I<value>
1508pairs, each of which sets one of the configuration options
1509for the item. These same I<option>-I<value> pairs may be
1510used in B<itemconfigure> methods to change the item's
1511configuration.
1512The following options are supported for images:
1513
1514=over 4
1515
1516=item B<-anchor> =E<gt> I<anchorPos>
1517
1518I<AnchorPos> tells how to position the image relative to the
1519positioning point for the item; it may have any of the forms
1520accepted by B<Tk_GetAnchor>. For example, if I<anchorPos>
1521is B<center> then the image is centered on the point; if
1522I<anchorPos> is B<n> then the image will be drawn so that
1523its top center point is at the positioning point.
1524This option defaults to B<center>.
1525
1526=item B<-image> =E<gt> I<name>
1527
1528=item B<-activeimage> =E<gt> I<name>
1529
1530=item B<-disabledimage> =E<gt> I<name>
1531
1532Specifies the name of the images to display in the item in is normal,
1533active and disabled states.
1534This image must have been created previously with the
1535B<imageCreate> method.
1536
1537=item B<-state> =E<gt> I<state>
1538
1539Modifies the state of the image item where I<state> may be set to one of:
1540normal, disabled, or hidden. An image item may also be in the "active"
1541state if the mouse is currently over it. Many options can take
1542separate specifications in normal, active and disabled states such that the
1543appearance of the item can be different in each state.
1544
1545=item B<-tags> =E<gt> I<tagList>
1546
1547Specifies a set of tags to apply to the item.
1548I<TagList> consists of a list of tag names, which replace any
1549existing tags for the item; it may be an empty list.
1550
1551=item B<-updatecommand> =E<gt> I<command>
1552
1553Specifies a callback that is to be executed every time
1554the image item is updated on the screen.
1555
1556=back
1557
1558=head1 LINE ITEMS
1559
1560Items of type B<line> appear on the display as one or more connected
1561line segments or curves.
1562Line items support coordinate indexing operations using the canvas
1563methods: B<dchars, index, insert.>
1564Lines are created with methods of the following form:
1565
1566 $canvas->createLine(x1, y1..., xn, yn, ?option, value, option, value, ...?)
1567
1568The arguments I<x1> through I<yn> give
1569the coordinates for a series of two or more points that describe
1570a series of connected line segments.
1571After the coordinates there may be any number of I<option>-I<value>
1572pairs, each of which sets one of the configuration options
1573for the item. These same I<option>-I<value> pairs may be
1574used in B<itemconfigure> methods to change the item's
1575configuration.
1576The following options are supported for lines:
1577
1578=over 4
1579
1580=item B<-arrow> =E<gt> I<where>
1581
1582Indicates whether or not arrowheads are to be drawn at one or both
1583ends of the line.
1584I<Where> must have one of the values B<none> (for no arrowheads),
1585B<first> (for an arrowhead at the first point of the line),
1586B<last> (for an arrowhead at the last point of the line), or
1587B<both> (for arrowheads at both ends).
1588This option defaults to B<none>.
1589
1590=item B<-arrowshape> =E<gt> I<shape>
1591
1592This option indicates how to draw arrowheads.
1593The I<shape> argument must be a list with three elements, each
1594specifying a distance in any of the forms described in
1595the L<"COORDINATES"> section above.
1596The first element of the list gives the distance along the line
1597from the neck of the arrowhead to its tip.
1598The second element gives the distance along the line from the
1599trailing points of the arrowhead to the tip, and the third
1600element gives the distance from the outside edge of the line to the
1601trailing points.
1602If this option isn't specified then Tk picks a ``reasonable'' shape.
1603
1604=item B<-capstyle> =E<gt> I<style>
1605
1606Specifies the ways in which caps are to be drawn at the endpoints
1607of the line.
1608I<Style> may have any of the forms accepted by B<Tk_GetCapStyle>
1609(B<butt>, B<projecting>, or B<round>).
1610If this option isn't specified then it defaults to B<butt>.
1611Where arrowheads are drawn the cap style is ignored.
1612
1613=item B<-dash> =E<gt> I<pattern>
1614
1615=item B<-activedash> =E<gt> I<pattern>
1616
1617=item B<-disableddash> =E<gt> I<pattern>
1618
1619This option specifies dash patterns for the normal state, the active
1620state, and the disabled state of a line item.
1621I<pattern> may have any of the forms accepted by B<Tk_GetDash>.
1622If the dash options are omitted then the default is a solid outline.
1623
1624=item B<-dashoffset> =E<gt> I<offset>
1625
1626The starting I<offset> into the pattern provided by the
1627B<-dash> option.
1628B<-dashoffset> is ignored if there is no B<-dash> pattern.
1629
1630=item B<-fill> =E<gt> I<color>
1631
1632=item B<-activefill> =E<gt> I<color>
1633
1634=item B<-disabledfill> =E<gt> I<color>
1635
1636Specifies the color to be used to fill the line in its normal, active, and
1637disabled states.
1638I<Color> may have
1639any of the forms acceptable to B<Tk_GetColor>. It may also be undef,
1640in which case the line will be transparent.
1641This option defaults to B<black>.
1642
1643=item B<-joinstyle> =E<gt> I<style>
1644
1645Specifies the ways in which joints are to be drawn at the vertices
1646of the line.
1647I<Style> may have any of the forms accepted by B<Tk_GetCapStyle>
1648(B<bevel>, B<miter>, or B<round>).
1649If this option isn't specified then it defaults to B<miter>.
1650If the line only contains two points then this option is
1651irrelevant.
1652
1653=item B<-smooth> =E<gt> I<boolean>
1654
1655I<Boolean> must have one of the forms accepted by B<Tk_GetBoolean>.
1656It indicates whether or not the line should be drawn as a curve.
1657If so, the line is rendered as a set of parabolic splines: one spline
1658is drawn for the first and second line segments, one for the second
1659and third, and so on. Straight-line segments can be generated within
1660a curve by duplicating the end-points of the desired line segment.
1661
1662=item B<-splinesteps> =E<gt> I<number>
1663
1664Specifies the degree of smoothness desired for curves: each spline
1665will be approximated with I<number> line segments. This
1666option is ignored unless the B<-smooth> option is true.
1667
1668=item B<-state> =E<gt> I<state>
1669
1670Modifies the state of the line item where I<state> may be set to one of:
1671normal, disabled, or hidden. A line item may also be in the "active"
1672state if the mouse is currently over it. Many options can take
1673separate specifications in normal, active and disabled states such that the
1674appearance of the item can be different in each state.
1675
1676=item B<-stipple> =E<gt> I<bitmap>
1677
1678=item B<-activestipple> =E<gt> I<bitmap>
1679
1680=item B<-disabledstipple> =E<gt> I<bitmap>
1681
1682This option specifies stipple patterns that should be used to fill the
1683the line in its normal, active and disabled states.
1684I<bitmap> specifies the stipple pattern to use, in any of the
1685forms accepted by B<Tk_GetBitmap>.
1686If I<bitmap> is an empty string (the default), then filling is
1687done in a solid fashion.
1688
1689=item B<-tags> =E<gt> I<tagList>
1690
1691Specifies a set of tags to apply to the item.
1692I<TagList> consists of a list of tag names, which replace any
1693existing tags for the item.
1694I<TagList> may be an empty list.
1695
1696=item B<-updatecommand> =E<gt> I<command>
1697
1698Specifies a callback that is to be executed every time
1699the line item is updated on the screen.
1700
1701=item B<-width> =E<gt> I<lineWidth>
1702
1703=item B<-activewidth> =E<gt> I<lineWidth>
1704
1705=item B<-disabledwidth> =E<gt> I<lineWidth>
1706
1707Specifies the width of the line
1708in its normal, active and disabled states.
1709I<lineWidth> may be in any of the forms
1710described in the L<"COORDINATES"> section above.
1711
1712Wide lines will be drawn centered on the path specified by the
1713points.
1714If this option isn't specified then it defaults to 1.0.
1715
1716=back
1717
1718=head1 OVAL ITEMS
1719
1720Items of type B<oval> appear as circular or oval regions on
1721the display. Each oval may have an outline, a fill, or
1722both. Ovals are created with methods of the
1723following form:
1724
1725 $canvas->createOval(x1, y1, x2, y2, ?option, value, option, value, ...?)
1726
1727The arguments I<x1>, I<y1>, I<x2>, and I<y2> give
1728the coordinates of two diagonally opposite corners of a
1729rectangular region enclosing the oval.
1730The oval will include the top and left edges of the rectangle
1731not the lower or right edges.
1732If the region is square then the resulting oval is circular;
1733otherwise it is elongated in shape.
1734After the coordinates there may be any number of I<option>-I<value>
1735pairs, each of which sets one of the configuration options
1736for the item. These same I<option>-I<value> pairs may be
1737used in B<itemconfigure> methods to change the item's
1738configuration.
1739The following options are supported for ovals:
1740
1741=over 4
1742
1743=item B<-dash> =E<gt> I<pattern>
1744
1745=item B<-activedash> =E<gt> I<pattern>
1746
1747=item B<-disableddash> =E<gt> I<pattern>
1748
1749This option specifies dash patterns for the normal state, the active
1750state, and the disabled state of an oval item.
1751I<pattern> may have any of the forms accepted by B<Tk_GetDash>.
1752If the dash options are omitted then the default is a solid outline.
1753
1754=item B<-dashoffset> =E<gt> I<offset>
1755
1756The starting I<offset> into the pattern provided by the
1757B<-dash> option.
1758B<-dashoffset> is ignored if there is no B<-dash> pattern.
1759
1760=item B<-fill> =E<gt> I<color>
1761
1762=item B<-activefill> =E<gt> I<color>
1763
1764=item B<-disabledfill> =E<gt> I<color>
1765
1766Specifies the color to be used to fill the oval in its normal, active, and
1767disabled states.
1768I<Color> may have any of the forms accepted by B<Tk_GetColor>.
1769If I<color> is undef (the default), then
1770then the oval will not be filled.
1771
1772=item B<-outline> =E<gt> I<color>
1773
1774=item B<-activeoutline> =E<gt> I<color>
1775
1776=item B<-disabledoutline> =E<gt> I<color>
1777
1778This option specifies the color that should be used to draw the
1779outline of the oval in its normal, active and disabled states.
1780I<Color> may have any of the forms accepted by B<Tk_GetColor>.
1781This option defaults to B<black>.
1782If I<color> is undef then no outline will be
1783drawn for the oval.
1784
1785=item B<-outlinestipple> =E<gt> I<bitmap>
1786
1787=item B<-activeoutlinestipple> =E<gt> I<bitmap>
1788
1789=item B<-disabledoutlinestipple> =E<gt> I<bitmap>
1790
1791This option specifies stipple patterns that should be used to draw the
1792outline of the oval in its normal, active and disabled states.
1793I<bitmap> specifies the stipple pattern to use, in any of the
1794forms accepted by B<Tk_GetBitmap>.
1795If the B<-outline> option hasn't been specified then this option
1796has no effect.
1797If I<bitmap> is an empty string (the default), then the outline is drawn
1798in a solid fashion.
1799
1800=item B<-state> =E<gt> I<state>
1801
1802Modifies the state of the oval item where I<state> may be set to one of:
1803normal, disabled, or hidden. An oval item may also be in the "active"
1804state if the mouse is currently over it. Many options can take
1805separate specifications in normal, active and disabled states such that the
1806appearance of the item can be different in each state.
1807
1808=item B<-stipple> =E<gt> I<bitmap>
1809
1810=item B<-activestipple> =E<gt> I<bitmap>
1811
1812=item B<-disabledstipple> =E<gt> I<bitmap>
1813
1814This option specifies stipple patterns that should be used to fill the
1815the oval in its normal, active and disabled states.
1816I<bitmap> specifies the stipple pattern to use, in any of the
1817forms accepted by B<Tk_GetBitmap>.
1818If the B<-fill> option hasn't been specified then this option
1819has no effect.
1820If I<bitmap> is an empty string (the default), then filling is done
1821in a solid fashion.
1822
1823=item B<-tags> =E<gt> I<tagList>
1824
1825Specifies a set of tags to apply to the item.
1826I<TagList> consists of a list of tag names, which replace any
1827existing tags for the item.
1828I<TagList> may be an empty list.
1829
1830=item B<-updatecommand> =E<gt> I<command>
1831
1832Specifies a callback that is to be executed every time
1833the oval item is updated on the screen.
1834
1835=item B<-width> =E<gt> I<outlineWidth>
1836
1837=item B<-activewidth> =E<gt> I<outlineWidth>
1838
1839=item B<-disabledwidth> =E<gt> I<outlineWidth>
1840
1841Specifies the width of the outline to be drawn around
1842the oval, in its normal, active and disabled states.
1843I<outlineWidth> specifies the width of the outline to be drawn around
1844the oval, in any of the forms described in the L<"COORDINATES"> section above.
1845
1846If the B<-outline> option hasn't been specified then this option
1847has no effect.
1848Wide outlines are drawn centered on the oval path defined by
1849I<x1>, I<y1>, I<x2>, and I<y2>.
1850This option defaults to 1.0.
1851
1852=back
1853
1854=head1 POLYGON ITEMS
1855
1856Items of type B<polygon> appear as polygonal or curved filled regions
1857on the display.
1858Polygon items support coordinate indexing operations using the canvas
1859methods: B<dchars, index, insert.>
1860Polygons are created with methods of the following form:
1861
1862 $canvas->createPolygon(x1, y1, ..., xn, yn, ?option, value, option, value, ...?)
1863
1864The arguments I<x1> through I<yn> specify the coordinates for
1865three or more points that define a closed polygon.
1866The first and last points may be the same; whether they are or not,
1867Tk will draw the polygon as a closed polygon.
1868After the coordinates there may be any number of I<option>-I<value>
1869pairs, each of which sets one of the configuration options
1870for the item. These same I<option>-I<value> pairs may be
1871used in B<itemconfigure> methods to change the item's
1872configuration.
1873The following options are supported for polygons:
1874
1875=over 4
1876
1877=item B<-dash> =E<gt> I<pattern>
1878
1879=item B<-activedash> =E<gt> I<pattern>
1880
1881=item B<-disableddash> =E<gt> I<pattern>
1882
1883This option specifies dash patterns for the normal state, the active
1884state, and the disabled state of an polygon item.
1885I<pattern> may have any of the forms accepted by B<Tk_GetDash>.
1886If the dash options are omitted then the default is a solid outline.
1887
1888=item B<-dashoffset> =E<gt> I<offset>
1889
1890The starting I<offset> into the pattern provided by the
1891B<-dash> option.
1892B<-dashoffset> is ignored if there is no B<-dash> pattern.
1893
1894=item B<-fill> =E<gt> I<color>
1895
1896=item B<-activefill> =E<gt> I<color>
1897
1898=item B<-disabledfill> =E<gt> I<color>
1899
1900Specifies the color to be used to fill the polygon in its normal, active, and
1901disabled states.
1902I<Color>
1903may have any of the forms acceptable to B<Tk_GetColor>.
1904If I<color> is undef then the polygon will be
1905transparent.
1906This option defaults to B<black>.
1907
1908=item B<-joinstyle> =E<gt> I<style>
1909
1910Specifies the ways in which joints are to be drawn at the vertices
1911of the outline.
1912I<Style> may have any of the forms accepted by B<Tk_GetCapStyle>
1913(B<bevel>, B<miter>, or B<round>).
1914If this option isn't specified then it defaults to B<miter>.
1915
1916=item B<-outline> =E<gt> I<color>
1917
1918=item B<-activeoutline> =E<gt> I<color>
1919
1920=item B<-disabledoutline> =E<gt> I<color>
1921
1922This option specifies the color that should be used to draw the
1923outline of the polygon in its normal, active and disabled states.
1924I<Color> may have any of the forms accepted by B<Tk_GetColor>.
1925If I<color> is undef then no outline will be
1926drawn for the polygon.
1927This option defaults to undef (no outline).
1928
1929=item B<-outlinestipple> =E<gt> I<bitmap>
1930
1931=item B<-activeoutlinestipple> =E<gt> I<bitmap>
1932
1933=item B<-disabledoutlinestipple> =E<gt> I<bitmap>
1934
1935This option specifies stipple patterns that should be used to draw the
1936outline of the polygon in its normal, active and disabled states.
1937I<bitmap> specifies the stipple pattern to use, in any of the
1938forms accepted by B<Tk_GetBitmap>.
1939If the B<-outline> option hasn't been specified then this option
1940has no effect.
1941If I<bitmap> is an empty string (the default), then the outline is drawn
1942in a solid fashion.
1943
1944=item B<-smooth> =E<gt> I<boolean>
1945
1946I<Boolean> must have one of the forms accepted by B<Tk_GetBoolean>
1947It indicates whether or not the polygon should be drawn with a
1948curved perimeter.
1949If so, the outline of the polygon becomes a set of parabolic splines,
1950one spline for the first and second line segments, one for the second
1951and third, and so on. Straight-line segments can be generated in a
1952smoothed polygon by duplicating the end-points of the desired line segment.
1953
1954=item B<-splinesteps> =E<gt> I<number>
1955
1956Specifies the degree of smoothness desired for curves: each spline
1957will be approximated with I<number> line segments. This
1958option is ignored unless the B<-smooth> option is true.
1959
1960=item B<-state> =E<gt> I<state>
1961
1962Modifies the state of the polygon item where I<state> may be set to one of:
1963normal, disabled, or hidden. A polygon item may also be in the "active"
1964state if the mouse is currently over it. Many options can take
1965separate specifications in normal, active and disabled states such that the
1966appearance of the item can be different in each state.
1967
1968=item B<-stipple> =E<gt> I<bitmap>
1969
1970=item B<-activestipple> =E<gt> I<bitmap>
1971
1972=item B<-disabledstipple> =E<gt> I<bitmap>
1973
1974This option specifies stipple patterns that should be used to fill the
1975the polygon in its normal, active and disabled states.
1976I<bitmap> specifies the stipple pattern to use, in any of the
1977forms accepted by B<Tk_GetBitmap>.
1978If I<bitmap> is an empty string (the default), then filling is
1979done in a solid fashion.
1980
1981=item B<-tags> =E<gt> I<tagList>
1982
1983Specifies a set of tags to apply to the item.
1984I<TagList> consists of a list of tag names, which replace any
1985existing tags for the item.
1986I<TagList> may be an empty list.
1987
1988=item B<-updatecommand> =E<gt> I<command>
1989
1990Specifies a callback that is to be executed every time
1991the polygon item is updated on the screen.
1992
1993=item B<-width> =E<gt> I<outlineWidth>
1994
1995=item B<-activewidth> =E<gt> I<outlineWidth>
1996
1997=item B<-disabledwidth> =E<gt> I<outlineWidth>
1998
1999=item Specifies the width of the outline to be drawn around
2000
2001the polygon, in its normal, active and disabled states.
2002I<outlineWidth> may be in any of the forms described in the COORDINATES
2003section above.
2004I<OutlineWidth> specifies the width of the outline to be drawn around
2005the polygon, in any of the forms described in the L<"COORDINATES"> section above.
2006If the B<-outline> option hasn't been specified then this option
2007has no effect. This option defaults to 1.0.
2008
2009Polygon items are different from other items such as rectangles, ovals
2010and arcs in that interior points are considered to be ``inside'' a
2011polygon (e.g. for purposes of the B<find closest> and
2012B<find overlapping> methods) even if it is not filled.
2013For most other item types, an
2014interior point is considered to be inside the item only if the item
2015is filled or if it has neither a fill nor an outline. If you would
2016like an unfilled polygon whose interior points are not considered
2017to be inside the polygon, use a line item instead.
2018
2019=back
2020
2021=head1 RECTANGLE ITEMS
2022
2023Items of type B<rectangle> appear as rectangular regions on
2024the display. Each rectangle may have an outline, a fill, or
2025both. Rectangles are created with methods of the
2026following form:
2027
2028 $canvas->createRectangle(x1, y1, x2, y2, ?option, value, option, value, ...?)
2029
2030The arguments I<x1>, I<y1>, I<x2>, and I<y2> give
2031the coordinates of two diagonally opposite corners of the rectangle
2032(the rectangle will include its upper and left edges but not
2033its lower or right edges).
2034After the coordinates there may be any number of I<option>-I<value>
2035pairs, each of which sets one of the configuration options
2036for the item. These same I<option>-I<value> pairs may be
2037used in B<itemconfigure> methods to change the item's
2038configuration.
2039The following options are supported for rectangles:
2040
2041=over 4
2042
2043=item B<-dash> =E<gt> I<pattern>
2044
2045=item B<-activedash> =E<gt> I<pattern>
2046
2047=item B<-disableddash> =E<gt> I<pattern>
2048
2049This option specifies dash patterns for the normal state, the active
2050state, and the disabled state of a rectangle item.
2051I<pattern> may have any of the forms accepted by B<Tk_GetDash>.
2052If the dash options are omitted then the default is a solid outline.
2053
2054=item B<-dashoffset> =E<gt> I<offset>
2055
2056The starting I<offset> into the pattern provided by the
2057B<-dash> option.
2058B<-dashoffset> is ignored if there is no B<-dash> pattern.
2059
2060=item B<-fill> =E<gt> I<color>
2061
2062=item B<-activefill> =E<gt> I<color>
2063
2064=item B<-disabledfill> =E<gt> I<color>
2065
2066Specifies the color to be used to fill the rectangle in its normal, active, and
2067disabled states.
2068I<Color>
2069may be specified in any of the forms accepted by B<Tk_GetColor>.
2070If I<color> is undef (the default),
2071then the rectangle will not be filled.
2072
2073=item B<-outline> =E<gt> I<color>
2074
2075=item B<-activeoutline> =E<gt> I<color>
2076
2077=item B<-disabledoutline> =E<gt> I<color>
2078
2079This option specifies the color that should be used to draw the
2080outline of the rectangle in its normal, active and disabled states.
2081I<Color> may have any of the forms accepted by B<Tk_GetColor>.
2082This option defaults to B<black>.
2083If I<color> is undef then no outline will be
2084drawn for the rectangle.
2085
2086=item B<-outlinestipple> =E<gt> I<bitmap>
2087
2088=item B<-activeoutlinestipple> =E<gt> I<bitmap>
2089
2090=item B<-disabledoutlinestipple> =E<gt> I<bitmap>
2091
2092This option specifies stipple patterns that should be used to draw the
2093outline of the rectangle in its normal, active and disabled states.
2094I<bitmap> specifies the stipple pattern to use, in any of the
2095forms accepted by B<Tk_GetBitmap>.
2096If the B<-outline> option hasn't been specified then this option
2097has no effect.
2098If I<bitmap> is an empty string (the default), then the outline is drawn
2099in a solid fashion.
2100
2101=item B<-state> =E<gt> I<state>
2102
2103Modifies the state of the rectangle item where I<state> may be set to one of:
2104normal, disabled, or hidden. A rectangle item may also be in the "active"
2105state if the mouse is currently over it. Many options can take
2106separate specifications in normal, active and disabled states such that the
2107appearance of the item can be different in each state.
2108
2109=item B<-stipple> =E<gt> I<bitmap>
2110
2111=item B<-activestipple> =E<gt> I<bitmap>
2112
2113=item B<-disabledstipple> =E<gt> I<bitmap>
2114
2115This option specifies stipple patterns that should be used to fill the
2116the rectangle in its normal, active and disabled states.
2117I<bitmap> specifies the stipple pattern to use, in any of the
2118forms accepted by B<Tk_GetBitmap>.
2119If the B<-fill> option hasn't been specified then this option
2120has no effect.
2121If I<bitmap> is an empty string (the default), then filling
2122is done in a solid fashion.
2123
2124=item B<-tags> =E<gt> I<tagList>
2125
2126Specifies a set of tags to apply to the item.
2127I<TagList> consists of a list of tag names, which replace any
2128existing tags for the item.
2129I<TagList> may be an empty list.
2130
2131=item B<-updatecommand> =E<gt> I<command>
2132
2133Specifies a callback that is to be executed every time
2134the rectangle item is updated on the screen.
2135
2136=item B<-width> =E<gt> I<outlineWidth>
2137
2138=item B<-activewidth> =E<gt> I<outlineWidth>
2139
2140=item B<-disabledwidth> =E<gt> I<outlineWidth>
2141
2142Specifies the width of the outline to be drawn around
2143the rectangle, in its normal, active and disabled states.
2144I<OutlineWidth> specifies the width of the outline to be drawn around
2145the rectangle, in any of the forms described in the L<"COORDINATES"> section above.
2146
2147If the B<-outline> option hasn't been specified then this option
2148has no effect.
2149Wide outlines are drawn centered on the rectangular path
2150defined by I<x1>, I<y1>, I<x2>, and I<y2>.
2151This option defaults to 1.0.
2152
2153=back
2154
2155=head1 TEXT ITEMS
2156
2157A text item displays a string of characters on the screen in one
2158or more lines.
2159Text items support indexing and selection, along with the
2160following text-related canvas methods: B<dchars>,
2161B<focus>, B<icursor>, B<index>, B<insert>,
2162B<select>.
2163Text items are created with methods of the following
2164form:
2165
2166 $canvas->createText(x, y, ?option, value, option, value, ...?)
2167
2168The arguments I<x> and I<y> specify the coordinates of a
2169point used to position the text on the display (see the options
2170below for more information on how text is displayed).
2171After the coordinates there may be any number of I<option>-I<value>
2172pairs, each of which sets one of the configuration options
2173for the item. These same I<option>-I<value> pairs may be
2174used in B<itemconfigure> methods to change the item's
2175configuration.
2176The following options are supported for text items:
2177
2178=over 4
2179
2180=item B<-anchor> =E<gt> I<anchorPos>
2181
2182I<AnchorPos> tells how to position the text relative to the
2183positioning point for the text; it may have any of the forms
2184accepted by B<Tk_GetAnchor>. For example, if I<anchorPos>
2185is B<center> then the text is centered on the point; if
2186I<anchorPos> is B<n> then the text will be drawn such that
2187the top center point of the rectangular region occupied by the
2188text will be at the positioning point.
2189This option defaults to B<center>.
2190
2191=item B<-fill> =E<gt> I<color>
2192
2193=item B<-activefill> =E<gt> I<color>
2194
2195=item B<-disabledfill> =E<gt> I<color>
2196
2197Specifies the color to be used to fill the text in its normal, active, and
2198disabled states.
2199I<Color> may have any of the forms accepted by B<Tk_GetColor>.
2200If I<color> is undef then the text will be transparent.
2201If this option isn't specified then it defaults to B<black>.
2202
2203=item B<-font> =E<gt> I<fontName>
2204
2205Specifies the font to use for the text item.
2206I<FontName> may be any string acceptable to B<Tk_GetFontStruct>.
2207If this option isn't specified, it defaults to a system-dependent
2208font.
2209
2210=item B<-justify> =E<gt> I<how>
2211
2212Specifies how to justify the text within its bounding region.
2213I<How> must be one of the values B<left>, B<right>,
2214or B<center>.
2215This option will only matter if the text is displayed as multiple
2216lines.
2217If the option is omitted, it defaults to B<left>.
2218
2219=item B<-state> =E<gt> I<state>
2220
2221Modifies the state of the text item where I<state> may be set to one of:
2222normal, disabled, or hidden. A text item may also be in the "active"
2223state if the mouse is currently over it. Many options can take
2224separate specifications in normal, active and disabled states such that the
2225appearance of the item can be different in each state.
2226
2227=item B<-stipple> =E<gt> I<bitmap>
2228
2229=item B<-activestipple> =E<gt> I<bitmap>
2230
2231=item B<-disabledstipple> =E<gt> I<bitmap>
2232
2233This option specifies stipple patterns that should be used to fill the
2234the text in its normal, active and disabled states.
2235I<bitmap> specifies the stipple pattern to use, in any of the
2236forms accepted by B<Tk_GetBitmap>.
2237If I<bitmap> is an empty string (the default) then the text
2238is drawn in a solid fashion.
2239
2240=item B<-tags> =E<gt> I<tagList>
2241
2242Specifies a set of tags to apply to the item.
2243I<TagList> consists of a list of tag names, which replace any
2244existing tags for the item.
2245I<TagList> may be an empty list.
2246
2247=item B<-text> =E<gt> I<string>
2248
2249I<String> specifies the characters to be displayed in the text item.
2250Newline characters cause line breaks.
2251The characters in the item may also be changed with the
2252B<insert> and B<delete> methods.
2253This option defaults to an empty string.
2254
2255=item B<-updatecommand> =E<gt> I<command>
2256
2257Specifies a callback that is to be executed every time
2258the text item is updated on the screen.
2259
2260=item B<-width> =E<gt> I<lineLength>
2261
2262Specifies a maximum line length for the text, in any of the forms
2263described in the L<"COORDINATES"> section above.
2264If this option is zero (the default) the text is broken into
2265lines only at newline characters.
2266However, if this option is non-zero then any line that would
2267be longer than I<lineLength> is broken just before a space
2268character to make the line shorter than I<lineLength>; the
2269space character is treated as if it were a newline
2270character.
2271
2272=back
2273
2274=head1 WINDOW ITEMS
2275
2276Items of type B<window> cause a particular window to be displayed
2277at a given position on the canvas.
2278Window items are created with methods of the following form:
2279
2280S< >I<$canvas>->B<createWindow>(I<x, y>?, I<-option>=>I<value>, I<-option>=>I<value>, ...?)
2281
2282The arguments I<x> and I<y> specify the coordinates of a
2283point used to position the window on the display (see the B<-anchor>
2284option below for more information on how bitmaps are displayed).
2285After the coordinates there may be any number of I<option-value>
2286pairs, each of which sets one of the configuration options
2287for the item. These same I<option>-I<value> pairs may be
2288used in B<itemconfigure> method to change the item's
2289configuration.
2290The following options are supported for window items:
2291
2292=over 4
2293
2294=item B<-anchor> =E<gt> I<anchorPos>
2295
2296I<AnchorPos> tells how to position the window relative to the
2297positioning point for the item; it may have any of the forms
2298accepted by B<Tk_GetAnchor>. For example, if I<anchorPos>
2299is B<center> then the window is centered on the point; if
2300I<anchorPos> is B<n> then the window will be drawn so that
2301its top center point is at the positioning point.
2302This option defaults to B<center>.
2303
2304=item B<-height> =E<gt> I<pixels>
2305
2306Specifies the height to assign to the item's window.
2307I<Pixels> may have any of the
2308forms described in the L<"COORDINATES"> section above.
2309If this option isn't specified, or if it is specified as an empty
2310string, then the window is given whatever height it requests internally.
2311
2312=item B<-state> =E<gt> I<state>
2313
2314Modifies the state of the window item where I<state> may be set to one of:
2315normal, disabled, or hidden.
2316
2317=item B<-tags> =E<gt> I<tagList>
2318
2319Specifies a set of tags to apply to the item.
2320I<TagList> consists of a list of tag names, which replace any
2321existing tags for the item.
2322I<TagList> may be an empty list.
2323
2324=item B<-updatecommand> =E<gt> I<command>
2325
2326Specifies a callback that is to be executed every time
2327the window item is updated on the screen.
2328
2329=item B<-width> =E<gt> I<pixels>
2330
2331Specifies the width to assign to the item's window.
2332I<Pixels> may have any of the
2333forms described in the L<"COORDINATES"> section above.
2334If this option isn't specified, or if it is specified as an empty
2335string, then the window is given whatever width it requests internally.
2336
2337=item B<-window> =E<gt> I<$widget>
2338
2339Specifies the window to associate with this item.
2340The window specified by $widget must either be a child of
2341the canvas widget or a child of some ancestor of the canvas widget.
2342I<PathName> may not refer to a top-level window.
2343
2344Note: due to restrictions in the ways that windows are managed, it is not
2345possible to draw other graphical items (such as lines and images) on top
2346of window items. A window item always obscures any graphics that
2347overlap it, regardless of their order in the display list.
2348
2349=back
2350
2351=head1 APPLICATION-DEFINED ITEM TYPES
2352
2353It is possible for individual applications to define new item
2354types for canvas widgets using C code.
2355See the documentation for B<Tk_CreateItemType>.
2356
2357=head1 BINDINGS
2358
2359Canvas has default bindings to allow scrolling if necessary:
2360<Up>, <Down>, <Left> and <Right> (and their <Control-*> counter
2361parts). Further <Proir>, <Next>, <Home> and <End>. These
2362bindings allow you to navigate the same way as in other
2363widgets that can scroll.
2364
2365=head1 CREDITS
2366
2367Tk's canvas widget is a blatant ripoff of ideas from Joel Bartlett's
2368I<ezd> program. I<Ezd> provides structured graphics in a Scheme
2369environment and preceded canvases by a year or two. Its simple
2370mechanisms for placing and animating graphical objects inspired the
2371functions of canvases.
2372
2373=head1 KEYWORDS
2374
2375canvas, widget
2376
2377=cut
2378