Debian Codegraph @

pod/pTk/CanvTxtInfo.pod

raw
1 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
2 # See the file "license.terms" for information on usage and redistribution
3 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
4 #
5 #
6
7 =head1 NAME
8
9 Tk_CanvasTextInfo - additional information for managing text items in canvases
10
11 =for category C Programming
12
13 =head1 SYNOPSIS
14
15 B<#include E<lt>tk.hE<gt>>
16
17 Tk_CanvasTextInfo *
18 B<Tk_CanvasGetTextInfo>(I<canvas>)
19
20 =head1 ARGUMENTS
21
22 =over 4
23
24 =item Tk_Canvas canvas (in)
25
26 A token that identifies a particular canvas widget.
27
28 =back
29
30 =head1 DESCRIPTION
31
32 Textual canvas items are somewhat more complicated to manage than
33 other items, due to things like the selection and the input focus.
34 B<Tk_CanvasGetTextInfo> may be invoked by a type manager
35 to obtain additional information needed for items that display text.
36 The return value from B<Tk_CanvasGetTextInfo> is a pointer to
37 a structure that is shared between Tk and all the items that display
38 text.
39 The structure has the following form:
40
41 typedef struct Tk_CanvasTextInfo {
42 Tk_3DBorder selBorder;
43 int selBorderWidth;
44 XColor *selFgColorPtr;
45 Tk_Item *selItemPtr;
46 int selectFirst;
47 int selectLast;
48 Tk_Item *anchorItemPtr;
49 int selectAnchor;
50 Tk_3DBorder insertBorder;
51 int insertWidth;
52 int insertBorderWidth;
53 Tk_Item *focusItemPtr;
54 int gotFocus;
55 int cursorOn;
56 } Tk_CanvasTextInfo;
57
58 The B<selBorder> field identifies a Tk_3DBorder that should be
59 used for drawing the background under selected text.
60 I<selBorderWidth> gives the width of the raised border around
61 selected text, in pixels.
62 I<selFgColorPtr> points to an XColor that describes the foreground
63 color to be used when drawing selected text.
64 I<selItemPtr> points to the item that is currently selected, or
65 NULL if there is no item selected or if the canvas doesn't have the
66 selection.
67 I<selectFirst> and I<selectLast> give the indices of the first
68 and last selected characters in I<selItemPtr>, as returned by the
69 I<indexProc> for that item.
70 I<anchorItemPtr> points to the item that currently has the selection
71 anchor; this is not necessarily the same as I<selItemPtr>.
72 I<selectAnchor> is an index that identifies the anchor position
73 within I<anchorItemPtr>.
74 I<insertBorder> contains a Tk_3DBorder to use when drawing the
75 insertion cursor; I<insertWidth> gives the total width of the
76 insertion cursor in pixels, and I<insertBorderWidth> gives the
77 width of the raised border around the insertion cursor.
78 I<focusItemPtr> identifies the item that currently has the input
79 focus, or NULL if there is no such item.
80 I<gotFocus> is 1 if the canvas widget has the input focus and
81 0 otherwise.
82 I<cursorOn> is 1 if the insertion cursor should be drawn in
83 I<focusItemPtr> and 0 if it should not be drawn; this field
84 is toggled on and off by Tk to make the cursor blink.
85
86 The structure returned by B<Tk_CanvasGetTextInfo>
87 is shared between Tk and the type managers; typically the type manager
88 calls B<Tk_CanvasGetTextInfo> once when an item is created and
89 then saves the pointer in the item's record.
90 Tk will update information in the Tk_CanvasTextInfo; for example,
91 a B<configure> method might change the I<selBorder>
92 field, or a B<select> method might change the I<selectFirst>
93 field, or Tk might change I<cursorOn> in order to make the insertion
94 cursor flash on and off during successive redisplays.
95
96 Type managers should treat all of the fields of the Tk_CanvasTextInfo
97 structure as read-only, except for I<selItemPtr>, I<selectFirst>,
98 I<selectLast>, and I<selectAnchor>.
99 Type managers may change I<selectFirst>, I<selectLast>, and
100 I<selectAnchor> to adjust for insertions and deletions in the
101 item (but only if the item is the current owner of the selection or
102 anchor, as determined by I<selItemPtr> or I<anchorItemPtr>).
103 If all of the selected text in the item is deleted, the item should
104 set I<selItemPtr> to NULL to indicate that there is no longer a
105 selection.
106
107 =head1 KEYWORDS
108
109 canvas, focus, insertion cursor, selection, selection anchor, text