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