Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * tixTList.h -- | |
3 | * | |
4 | * This header file defines the data structures used by the tixTList | |
5 | * widget. | |
6 | * | |
7 | * Copyright (c) 1996, Expert Interface Technologies | |
8 | * | |
9 | * See the file "license.terms" for information on usage and redistribution | |
10 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
11 | * | |
12 | */ | |
13 | ||
14 | #ifndef _TIX_TLIST_H_ | |
15 | #define _TIX_TLIST_H_ | |
16 | ||
17 | #ifndef _TIX_INT_H_ | |
18 | #include "tixInt.h" | |
19 | #endif | |
20 | ||
21 | #include "tkVMacro.h" | |
22 | ||
23 | #define TIX_X 0 | |
24 | #define TIX_Y 1 | |
25 | ||
26 | typedef struct ListEntry { | |
27 | struct ListEntry * next; | |
28 | Tix_DItem * iPtr; | |
29 | Tk_Uid state; | |
30 | Arg data; /* user data field */ | |
31 | int size[2]; | |
32 | unsigned int selected : 1; | |
33 | } ListEntry; | |
34 | ||
35 | typedef struct ListRow { | |
36 | ListEntry * chPtr; | |
37 | int size[2]; | |
38 | int numEnt; | |
39 | } ListRow; | |
40 | ||
41 | /* | |
42 | * A data structure of the following type is kept for each | |
43 | * widget managed by this file: | |
44 | */ | |
45 | typedef struct ListStruct { | |
46 | Tix_DispData dispData; | |
47 | ||
48 | Tcl_Command widgetCmd; /* Token for button's widget command. */ | |
49 | ||
50 | /* | |
51 | * Information used when displaying widget: | |
52 | */ | |
53 | int width, height; /* For app programmer to request size */ | |
54 | ||
55 | /* | |
56 | * Information used when displaying widget: | |
57 | */ | |
58 | ||
59 | /* Border and general drawing */ | |
60 | int borderWidth; /* Width of 3-D borders. */ | |
61 | int selBorderWidth; /* Width of 3-D borders for selected items */ | |
62 | int relief; /* Indicates whether window as a whole is | |
63 | * raised, sunken, or flat. */ | |
64 | Tk_3DBorder border; /* Used for drawing the 3d border. */ | |
65 | Tk_3DBorder selectBorder; /* Used for selected background. */ | |
66 | XColor *normalFg; /* Normal foreground for text. */ | |
67 | XColor *normalBg; /* Normal background for text. */ | |
68 | XColor *selectFg; /* Color for drawing selected text. */ | |
69 | ||
70 | /* GC and stuff */ | |
71 | GC backgroundGC; /* GC for drawing background. */ | |
72 | GC selectGC; /* GC for drawing selected background. */ | |
73 | GC anchorGC; /* GC for drawing dotted anchor highlight. */ | |
74 | TixFont font; /* Default font used by the DItems. */ | |
75 | ||
76 | /* Text drawing */ | |
77 | Cursor cursor; /* Current cursor for window, or None. */ | |
78 | ||
79 | /* For highlights */ | |
80 | int highlightWidth; /* Width in pixels of highlight to draw | |
81 | * around widget when it has the focus. | |
82 | * <= 0 means don't draw a highlight. */ | |
83 | XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ | |
84 | GC highlightGC; /* For drawing traversal highlight. */ | |
85 | ||
86 | /* default pad and gap values */ | |
87 | int padX, padY; | |
88 | ||
89 | Tk_Uid selectMode; /* Selection style: single, browse, multiple, | |
90 | * or extended. This value isn't used in C | |
91 | * code, but the Tcl bindings use it. */ | |
92 | Tk_Uid state; /* State can only be normal or disabled. */ | |
93 | Tix_LinkList entList; | |
94 | ||
95 | int numRowAllocd; | |
96 | int numRow; | |
97 | ListRow * rows; | |
98 | ||
99 | ListEntry * seeElemPtr; /* The current item to "see" */ | |
100 | ListEntry * anchor; /* The current anchor item */ | |
101 | ListEntry * active; /* The current active item */ | |
102 | ListEntry * dropSite; /* The current drop site */ | |
103 | ListEntry * dragSite; /* The current drop site */ | |
104 | ||
105 | /* | |
106 | * Commands | |
107 | */ | |
108 | LangCallback *command; /* The command when user double-clicks */ | |
109 | LangCallback *browseCmd; /* The command to call when the selection | |
110 | * changes. */ | |
111 | LangCallback *sizeCmd; /* The command to call when the size of | |
112 | * the listbox changes. E.g., when the user | |
113 | * add/deletes elements. Useful for | |
114 | * auto-scrollbar geometry managers */ | |
115 | ||
116 | /* These options control how the items are arranged on the list */ | |
117 | Tk_Uid orientUid; /* Can be "vertical" or "horizontal" */ | |
118 | int packMode[2]; /* is row and column packed */ | |
119 | int numMajor[2]; /* num of rows and columns */ | |
120 | int itemSize[2]; /* horizontal and vertical size of items, -1 | |
121 | * means natural size */ | |
122 | ||
123 | /* Info for laying out */ | |
124 | int maxSize[2]; /* max size of all elements in X and Y, (they | |
125 | * do not need to be the same element, may be | |
126 | * invalid according to mode */ | |
127 | char *takeFocus; /* Value of -takefocus option; not used in | |
128 | * the C code, but used by keyboard traversal | |
129 | * scripts. Malloc'ed, but may be NULL. */ | |
130 | ||
131 | int serial; /* this number is incremented before each time | |
132 | * the widget is redisplayed */ | |
133 | ||
134 | Tix_DItemInfo * diTypePtr; /* Default item type */ | |
135 | Tix_IntScrollInfo scrollInfo[2]; | |
136 | unsigned int redrawing : 1; | |
137 | unsigned int resizing : 1; | |
138 | unsigned int hasFocus : 1; | |
139 | unsigned int isVertical : 1; | |
140 | } TixTListWidget; | |
141 | ||
142 | typedef TixTListWidget WidgetRecord; | |
143 | typedef TixTListWidget * WidgetPtr; | |
144 | ||
145 | #endif /* _TIX_TLIST_H_ */ |