1Tk_CanvasTextInfo(3)         Tk Library Procedures        Tk_CanvasTextInfo(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_CanvasTextInfo  -  additional information for managing text items in
9       canvases
10

SYNOPSIS

12       #include <tk.h>
13
14       Tk_CanvasTextInfo *
15       Tk_CanvasGetTextInfo(canvas)
16

ARGUMENTS

18       Tk_Canvas canvas (in)          A token  that  identifies  a  particular
19                                      canvas widget.
20______________________________________________________________________________
21

DESCRIPTION

23       Textual canvas items are somewhat more complicated to manage than other
24       items, due to things like the selection and the input  focus.   Tk_Can‐
25       vasGetTextInfo  may  be  invoked by a type manager to obtain additional
26       information needed for items that display text.  The return value  from
27       Tk_CanvasGetTextInfo is a pointer to a structure that is shared between
28       Tk and all the items that display text.  The structure has the  follow‐
29       ing form:
30              typedef struct Tk_CanvasTextInfo {
31                  Tk_3DBorder selBorder;
32                  int selBorderWidth;
33                  XColor *selFgColorPtr;
34                  Tk_Item *selItemPtr;
35                  int selectFirst;
36                  int selectLast;
37                  Tk_Item *anchorItemPtr;
38                  int selectAnchor;
39                  Tk_3DBorder insertBorder;
40                  int insertWidth;
41                  int insertBorderWidth;
42                  Tk_Item *focusItemPtr;
43                  int gotFocus;
44                  int cursorOn;
45              } Tk_CanvasTextInfo;
46       The  selBorder  field  identifies a Tk_3DBorder that should be used for
47       drawing the background under selected text.  selBorderWidth  gives  the
48       width  of the raised border around selected text, in pixels.  selFgCol‐
49       orPtr points to an XColor that describes the  foreground  color  to  be
50       used when drawing selected text.  selItemPtr points to the item that is
51       currently selected, or NULL if there is no item selected or if the can‐
52       vas  does  not have the selection.  selectFirst and selectLast give the
53       indices of the first and last selected characters in selItemPtr, as re‐
54       turned  by  the  indexProc  for that item.  anchorItemPtr points to the
55       item that currently has the selection anchor;  this is not  necessarily
56       the  same  as selItemPtr.  selectAnchor is an index that identifies the
57       anchor  position  within  anchorItemPtr.    insertBorder   contains   a
58       Tk_3DBorder  to  use  when  drawing  the insertion cursor;  insertWidth
59       gives the total width of the insertion cursor in pixels, and insertBor‐
60       derWidth  gives  the  width  of the raised  border around the insertion
61       cursor.  focusItemPtr identifies the item that currently has the  input
62       focus,  or  NULL if there is no such item.  gotFocus is 1 if the canvas
63       widget has the input focus and 0 otherwise.  cursorOn is 1 if  the  in‐
64       sertion  cursor  should be drawn in focusItemPtr and 0 if it should not
65       be drawn;  this field is toggled on and off by Tk to  make  the  cursor
66       blink.
67
68       The structure returned by Tk_CanvasGetTextInfo is shared between Tk and
69       the type managers;  typically the type manager  calls  Tk_CanvasGetTex‐
70       tInfo  once  when  an item is created and then saves the pointer in the
71       item's record.  Tk will update information  in  the  Tk_CanvasTextInfo;
72       for  example,  a  configure  widget  command might change the selBorder
73       field, or a select widget command might change the  selectFirst  field,
74       or Tk might change cursorOn in order to make the insertion cursor flash
75       on and off during successive redisplays.
76
77       Type managers should treat all of the fields of  the  Tk_CanvasTextInfo
78       structure as read-only, except for selItemPtr, selectFirst, selectLast,
79       and selectAnchor.  Type managers may  change  selectFirst,  selectLast,
80       and  selectAnchor  to  adjust  for insertions and deletions in the item
81       (but only if the item is the current owner of the selection or  anchor,
82       as  determined by selItemPtr or anchorItemPtr).  If all of the selected
83       text in the item is deleted, the item should set selItemPtr to NULL  to
84       indicate that there is no longer a selection.
85

KEYWORDS

87       canvas, focus, insertion cursor, selection, selection anchor, text
88
89
90
91Tk                                    4.0                 Tk_CanvasTextInfo(3)
Impressum