Debian Codegraph @

pTk/mTk/tixGeneric/tixHList.h

raw symbols SCIP
1
2 /* $Id: tixHList.h,v 1.1.1.1 2000/05/17 11:08:42 idiscovery Exp $ */
3
4 /*
5 * tixHList.h --
6 *
7 * Defines the data structures and functions used by the tixHList
8 * widget.
9 *
10 * Copyright (c) 1996, Expert Interface Technologies
11 *
12 * See the file "license.terms" for information on usage and redistribution
13 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 *
15 */
16
17 #ifndef _TIX_HLIST_H_
18 #define _TIX_HLIST_H_
19
20 #ifndef _TIX_INT_H_
21 #include "tixInt.h"
22 #endif
23
24 #include "tkVMacro.h"
25
26 #define HLTYPE_COLUMN 1
27 #define HLTYPE_HEADER 2
28 #define HLTYPE_ENTRY 3
29
30 /* This is used to indetify what object has caused a DItemSizeChange
31 * All data structs for objects that manage DItems must have these two
32 * members as the beginning of the struct.
33 */
34 typedef struct HLItemTypeInfo {
35 int type;
36 char * self;
37 } HLItemTypeInfo;
38
39 typedef struct HListColumn {
40 /* generic type info section */
41 int type;
42 char * self;
43 struct _HListElement * chPtr;
44
45 /* other data */
46 Tix_DItem * iPtr;
47 int width;
48 } HListColumn;
49
50 typedef struct HListHeader {
51 /* generic type info section */
52 int type;
53 char * self;
54
55 struct HListStruct * wPtr;
56 /* other data */
57 Tix_DItem * iPtr;
58 int width;
59
60 Tk_3DBorder background; /* Used for drawing the 3d border. */
61 int relief; /* Indicates whether window as a whole is
62 * raised, sunken, or flat. */
63 int borderWidth;
64 } HListHeader;
65
66 /*----------------------------------------------------------------------
67 * A HListElement structure contain the information about each element
68 * inside the HList.
69 *
70 */
71 typedef struct _HListElement {
72 /* generic type info section */
73 int type;
74 char * self;
75
76 /* other data */
77 struct HListStruct * wPtr;
78 struct _HListElement * parent;
79 struct _HListElement * prev;
80 struct _HListElement * next;
81 struct _HListElement * childHead;
82 struct _HListElement * childTail;
83
84 int numSelectedChild; /* number of childs that has selection(s) in
85 * them (either this child is selected or some
86 * of its descendants are selected */
87 int numCreatedChild; /* this var gets increment by one each
88 * time a child is created */
89 char * pathName; /* Full pathname of this element */
90 char * name; /* Name of this element */
91 int height; /* Height of this element, including padding
92 * and selBorderWidth;
93 */
94 int allHeight; /* Height of all descendants and self */
95 Tk_Uid state; /* State of Tab's for display purposes:
96 * normal or disabled. */
97 Tcl_Obj * data; /* user data field */
98 /* bottom-middle position of the bitmap/image branch (offset from
99 * the top-left corner of the item)
100 */
101 int branchX;
102 int branchY;
103
104 /* offset of the left-middle position of the icon */
105 int iconX;
106 int iconY;
107 /*----------------------------------*/
108 /* Things to display in the element */
109 /*----------------------------------*/
110 HListColumn * col; /* the multi-column display items */
111 HListColumn _oneCol; /* If we have only one column, then this
112 * space is used (pointed to by column).
113 * This will save one Malloc */
114 int indent;
115 Tix_DItem * indicator; /* indicator: little triangle on Mac */
116
117 /*----------------------------------*/
118 /* Flags */
119 /*----------------------------------*/
120 Tix_DItemInfo * diTypePtr;
121
122 unsigned int selected : 1;
123 unsigned int hidden : 1;
124 unsigned int dirty : 1; /* If it is dirty then its geometry needs
125 * be recalculated */
126 } Tix_HListElement, HListElement;
127
128 /*
129 * A data structure of the following type is kept for each
130 * widget managed by this file:
131 */
132 typedef struct HListStruct {
133 Tix_DispData dispData;
134 Tcl_Command widgetCmd; /* Token for button's widget command. */
135
136 /*
137 * Information used when displaying widget:
138 */
139 LangCallback *command; /* Command prefix to use when invoking
140 * scrolling commands. NULL means don't
141 * invoke commands. Malloc'ed. */
142 int width, height; /* For app programmer to request size */
143
144 /*
145 * Information used when displaying widget:
146 */
147
148 /* Border and general drawing */
149 int borderWidth; /* Width of 3-D borders. */
150 int selBorderWidth; /* Width of 3-D borders for selected items */
151 int relief; /* Indicates whether window as a whole is
152 * raised, sunken, or flat. */
153 int indent; /* How much should the children be indented
154 * (to the right)?, in pixels */
155 Tk_3DBorder border; /* Used for drawing the 3d border. */
156 Tk_3DBorder selectBorder; /* Used for selected background. */
157 XColor *normalFg; /* Normal foreground for text. */
158 XColor *normalBg; /* Normal bachground for text. */
159 XColor *selectFg; /* Color for drawing selected text. */
160 TixFont font; /* The default font used in the DItems. */
161 GC backgroundGC; /* GC for drawing background. */
162 GC normalGC; /* GC for drawing text in normal mode. */
163 GC selectGC; /* GC for drawing selected background. */
164 GC anchorGC; /* GC for drawing dotted anchor highlight. */
165 GC dropSiteGC; /* GC for drawing dotted anchor highlight. */
166
167 Cursor cursor; /* Current cursor for window, or None. */
168
169 int topPixel; /* Vertical offset */
170 int leftPixel; /* Horizontal offset */
171 int bottomPixel;
172 int wideSelect; /* BOOL: if 1, use a wide selection: the
173 * selection background color covers the whole
174 * widget. If 0, only the "significant" part
175 * of a list entry is highlighted */
176 int selectWidth; /* Width of the selection: takes effect only
177 * if wideSelect == 1 */
178 int exportSelection; /* Do we grab X Selection */
179 /* For highlights */
180 int highlightWidth; /* Width in pixels of highlight to draw
181 * around widget when it has the focus.
182 * <= 0 means don't draw a highlight. */
183 XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
184 GC highlightGC; /* For drawing traversal highlight. */
185
186 /* default pad and gap values */
187 int gap, padX, padY;
188 char * separator;
189
190 Tk_Uid selectMode; /* Selection style: single, browse, multiple,
191 * or extended. This value isn't used in C
192 * code, but the Tcl bindings use it. */
193 int drawBranch; /* Whether to draw the "branch" lines from
194 * parent entry to children */
195 Tcl_HashTable childTable; /* Hash table to translate child names
196 * into (HListElement *) */
197 HListElement * root; /* Mother of all elements */
198 HListElement * anchor; /* The current anchor item */
199 HListElement * dragSite; /* The current drag site */
200 HListElement * dropSite; /* The current drop site */
201
202 LangCallback *yScrollCmd; /* Command prefix for communicating with
203 * vertical scrollbar. NULL means no command
204 * to issue. Malloc'ed. */
205 LangCallback *xScrollCmd; /* Command prefix for communicating with
206 * horizontal scrollbar. NULL means no command
207 * to issue. Malloc'ed. */
208 LangCallback *sizeCmd; /* The command to call when the size of
209 * the listbox changes. E.g., when the user
210 * add/deletes elements. Useful for
211 * auto-scrollbar geometry managers */
212 LangCallback *browseCmd; /* The command to call when the selection
213 * changes. */
214 LangCallback *indicatorCmd; /* The command to call when the user touches
215 * the indicator. */
216 LangCallback *dragCmd; /* The command to call when info about a
217 * drag source is needed */
218 LangCallback *dropCmd; /* The command to call when action at a drop
219 * side needs to be performed */
220 char *takeFocus; /* Value of -takefocus option; not used in
221 * the C code, but used by keyboard traversal
222 * scripts. Malloc'ed, but may be NULL. */
223
224 Tix_LinkList mappedWindows; /* Those windows that are are mapped by this
225 * widget*/
226 int serial; /* this number is incremented before each time
227 * the widget is redisplayed */
228
229 int numColumns; /* number of columns in the tixHList widget,
230 * cannot be changed after the widget's
231 * creation */
232
233 int totalSize[2];
234
235 HListColumn * reqSize; /* Requested column sizes by the user:
236 take precedence */
237 HListColumn * actualSize; /* Actual column sizes, calculated using
238 * the sizes of the ditems */
239
240 HListHeader ** headers; /* Stores all the headers for a HList widget */
241 int useHeader; /* whether headers should be used */
242 int headerHeight; /* required height of the header */
243
244 Tix_DItemInfo * diTypePtr; /* Default item type */
245 Tix_StyleTemplate stTmpl;
246
247 int useIndicator; /* should indicators be displayed */
248 int scrollUnit[2];
249
250 Tk_Window headerWin; /* subwindow, used to draw the headers */
251 char * elmToSee; /* name of element to "see" the next time
252 * this widget is redrawn */
253 unsigned redrawing : 1;
254 unsigned redrawingFrame : 1;
255 unsigned resizing : 1;
256 unsigned hasFocus : 1;
257 unsigned allDirty : 1;
258 unsigned initialized : 1;
259 unsigned headerDirty : 1;
260 unsigned needToRaise : 1; /* The header subwindow needs to be raised
261 * if we add a new window item into the
262 * HList widget (either in the list or
263 * in the header */
264 } HList;
265
266 #define TIX_X 0
267 #define TIX_Y 1
268 #define UNINITIALIZED -1
269
270 typedef HList WidgetRecord;
271 typedef HList * WidgetPtr;
272
273 EXTERN TIX_DECLARE_SUBCMD(Tix_HLColumn);
274 EXTERN TIX_DECLARE_SUBCMD(Tix_HLItem);
275
276 EXTERN HListColumn * Tix_HLAllocColumn _ANSI_ARGS_((
277 WidgetPtr wPtr, HListElement * chPtr));
278 EXTERN void Tix_HLCancelResizeWhenIdle _ANSI_ARGS_((
279 WidgetPtr wPtr));
280 EXTERN void Tix_HLComputeGeometry _ANSI_ARGS_((
281 ClientData clientData));
282 EXTERN HListElement * Tix_HLFindElement _ANSI_ARGS_((Tcl_Interp *interp,
283 WidgetPtr wPtr, char * pathName));
284 EXTERN void Tix_HLFreeMappedWindow _ANSI_ARGS_((WidgetPtr wPtr,
285 HListElement * chPtr));
286 EXTERN int Tix_HLElementTopOffset _ANSI_ARGS_((
287 WidgetPtr wPtr, HListElement *chPtr));
288 EXTERN int Tix_HLElementLeftOffset _ANSI_ARGS_((
289 WidgetPtr wPtr, HListElement *chPtr));
290 EXTERN int Tix_HLItemInfo _ANSI_ARGS_((Tcl_Interp *interp,
291 WidgetPtr wPtr, int argc, char** argv));
292 EXTERN int Tix_HLHeader _ANSI_ARGS_((ClientData clientData,
293 Tcl_Interp *interp, int argc, char **argv));
294 EXTERN int Tix_HLCreateHeaders _ANSI_ARGS_((
295 Tcl_Interp *interp, WidgetPtr wPtr));
296 EXTERN void Tix_HLFreeHeaders _ANSI_ARGS_((
297 Tcl_Interp *interp, WidgetPtr wPtr));
298 EXTERN void Tix_HLDrawHeader _ANSI_ARGS_((
299 WidgetPtr wPtr, Pixmap pixmap, GC gc,
300 int hdrX, int hdrY, int hdrW, int hdrH,
301 int xOffset));
302 EXTERN void Tix_HLComputeHeaderGeometry _ANSI_ARGS_((
303 WidgetPtr wPtr));
304
305 EXTERN void Tix_HLMarkElementDirty _ANSI_ARGS_((WidgetPtr wPtr,
306 HListElement *chPtr));
307 EXTERN void Tix_HLResizeWhenIdle _ANSI_ARGS_((WidgetPtr wPtr));
308 EXTERN void Tix_HLResizeNow _ANSI_ARGS_((WidgetPtr wPtr));
309 EXTERN void Tix_HLComputeGeometry _ANSI_ARGS_((
310 ClientData clientData));
311 EXTERN void Tix_HLCancelResizeWhenIdle _ANSI_ARGS_((
312 WidgetPtr wPtr));
313
314
315 /* in tixHLCol.c */
316 EXTERN TIX_DECLARE_SUBCMD(Tix_HLColumn);
317 EXTERN TIX_DECLARE_SUBCMD(Tix_HLItem);
318
319 /* in tixHLInd.c */
320 EXTERN TIX_DECLARE_SUBCMD(Tix_HLIndicator);
321
322 #endif /*_TIX_HLIST_H_ */
323