OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tk8.6.12 / doc / CanvTxtInfo.3
1 '\"
2 '\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\"
7 .TH Tk_CanvasTextInfo 3 4.0 Tk "Tk Library Procedures"
8 .so man.macros
9 .BS
10 .SH NAME
11 Tk_CanvasTextInfo \- additional information for managing text items in canvases
12 .SH SYNOPSIS
13 .nf
14 \fB#include <tk.h>\fR
15 .sp
16 Tk_CanvasTextInfo *
17 \fBTk_CanvasGetTextInfo\fR(\fIcanvas\fR)
18 .SH ARGUMENTS
19 .AS Tk_Canvas canvas
20 .AP Tk_Canvas canvas in
21 A token that identifies a particular canvas widget.
22 .BE
23 .SH DESCRIPTION
24 .PP
25 Textual canvas items are somewhat more complicated to manage than
26 other items, due to things like the selection and the input focus.
27 \fBTk_CanvasGetTextInfo\fR may be invoked by a type manager
28 to obtain additional information needed for items that display text.
29 The return value from \fBTk_CanvasGetTextInfo\fR is a pointer to
30 a structure that is shared between Tk and all the items that display
31 text.
32 The structure has the following form:
33 .CS
34 typedef struct Tk_CanvasTextInfo {
35     Tk_3DBorder \fIselBorder\fR;
36     int \fIselBorderWidth\fR;
37     XColor *\fIselFgColorPtr\fR;
38     Tk_Item *\fIselItemPtr\fR;
39     int \fIselectFirst\fR;
40     int \fIselectLast\fR;
41     Tk_Item *\fIanchorItemPtr\fR;
42     int \fIselectAnchor\fR;
43     Tk_3DBorder \fIinsertBorder\fR;
44     int \fIinsertWidth\fR;
45     int \fIinsertBorderWidth\fR;
46     Tk_Item *\fIfocusItemPtr\fR;
47     int \fIgotFocus\fR;
48     int \fIcursorOn\fR;
49 } \fBTk_CanvasTextInfo\fR;
50 .CE
51 The \fBselBorder\fR field identifies a Tk_3DBorder that should be
52 used for drawing the background under selected text.
53 \fIselBorderWidth\fR gives the width of the raised border around
54 selected text, in pixels.
55 \fIselFgColorPtr\fR points to an XColor that describes the foreground
56 color to be used when drawing selected text.
57 \fIselItemPtr\fR points to the item that is currently selected, or
58 NULL if there is no item selected or if the canvas does not have the
59 selection.
60 \fIselectFirst\fR and \fIselectLast\fR give the indices of the first
61 and last selected characters in \fIselItemPtr\fR, as returned by the
62 \fIindexProc\fR for that item.
63 \fIanchorItemPtr\fR points to the item that currently has the selection
64 anchor;  this is not necessarily the same as \fIselItemPtr\fR.
65 \fIselectAnchor\fR is an index that identifies the anchor position
66 within \fIanchorItemPtr\fR.
67 \fIinsertBorder\fR contains a Tk_3DBorder to use when drawing the
68 insertion cursor;  \fIinsertWidth\fR gives the total width of the
69 insertion cursor in pixels, and \fIinsertBorderWidth\fR gives the
70 width of the raised  border around the insertion cursor.
71 \fIfocusItemPtr\fR identifies the item that currently has the input
72 focus, or NULL if there is no such item.
73 \fIgotFocus\fR is 1 if the canvas widget has the input focus and
74 0 otherwise.
75 \fIcursorOn\fR is 1 if the insertion cursor should be drawn in
76 \fIfocusItemPtr\fR and 0 if it should not be drawn;  this field
77 is toggled on and off by Tk to make the cursor blink.
78 .PP
79 The structure returned by \fBTk_CanvasGetTextInfo\fR
80 is shared between Tk and the type managers;  typically the type manager
81 calls \fBTk_CanvasGetTextInfo\fR once when an item is created and
82 then saves the pointer in the item's record.
83 Tk will update information in the Tk_CanvasTextInfo;  for example,
84 a \fBconfigure\fR widget command might change the \fIselBorder\fR
85 field, or a \fBselect\fR widget command might change the \fIselectFirst\fR
86 field, or Tk might change \fIcursorOn\fR in order to make the insertion
87 cursor flash on and off during successive redisplays.
88 .PP
89 Type managers should treat all of the fields of the Tk_CanvasTextInfo
90 structure as read-only, except for \fIselItemPtr\fR, \fIselectFirst\fR,
91 \fIselectLast\fR, and \fIselectAnchor\fR.
92 Type managers may change \fIselectFirst\fR, \fIselectLast\fR, and
93 \fIselectAnchor\fR to adjust for insertions and deletions in the
94 item (but only if the item is the current owner of the selection or
95 anchor, as determined by \fIselItemPtr\fR or \fIanchorItemPtr\fR).
96 If all of the selected text in the item is deleted, the item should
97 set \fIselItemPtr\fR to NULL to indicate that there is no longer a
98 selection.
99 .SH KEYWORDS
100 canvas, focus, insertion cursor, selection, selection anchor, text