OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tix/] [generic/] [tixHList.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
2
 * tixHList.h --
3
 *
4
 *      Defines the data structures and functions used by the tixHList
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_HLIST_H_
15
#define _TIX_HLIST_H_
16
 
17
#ifndef  _TIX_INT_H_
18
#include <tixInt.h>
19
#endif
20
 
21
#ifdef BUILD_tix
22
# undef TCL_STORAGE_CLASS
23
# define TCL_STORAGE_CLASS DLLEXPORT
24
#endif
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
    char * data;                /* user data field */
98
 
99
    /* bottom-middle position of the bitmap/image branch (offset from
100
     * the top-left corner of the item)
101
     */
102
    int branchX;
103
    int branchY;
104
 
105
    /*  offset of the left-middle position of the icon */
106
    int iconX;
107
    int iconY;
108
    /*----------------------------------*/
109
    /* Things to display in the element */
110
    /*----------------------------------*/
111
    HListColumn * col;          /* the multi-column display items */
112
    HListColumn  _oneCol;       /* If we have only one column, then this
113
                                 * space is used (pointed to by column).
114
                                 * This will save one Malloc */
115
    int indent;
116
    Tix_DItem * indicator;      /* indicator: little triangle on Mac */
117
 
118
    /*----------------------------------*/
119
    /* Flags                            */
120
    /*----------------------------------*/
121
    Tix_DItemInfo * diTypePtr;
122
 
123
    unsigned int selected : 1;
124
    unsigned int hidden   : 1;
125
    unsigned int dirty    : 1;  /* If it is dirty then its geometry needs
126
                                 * be recalculated */
127
} Tix_HListElement, HListElement;
128
 
129
/*
130
 * A data structure of the following type is kept for each
131
 * widget managed by this file:
132
 */
133
typedef struct HListStruct {
134
    Tix_DispData dispData;
135
    Tcl_Command widgetCmd;      /* Token for button's widget command. */
136
 
137
    /*
138
     * Information used when displaying widget:
139
     */
140
    char *command;              /* Command prefix to use when invoking
141
                                 * scrolling commands.  NULL means don't
142
                                 * invoke commands.  Malloc'ed. */
143
    int width, height;          /* For app programmer to request size */
144
 
145
    /*
146
     * Information used when displaying widget:
147
     */
148
 
149
    /* Border and general drawing */
150
    int borderWidth;            /* Width of 3-D borders. */
151
    int selBorderWidth;         /* Width of 3-D borders for selected items */
152
    int relief;                 /* Indicates whether window as a whole is
153
                                 * raised, sunken, or flat. */
154
    int indent;                 /* How much should the children be indented
155
                                 * (to the right)?, in pixels */
156
    Tk_3DBorder border;         /* Used for drawing the 3d border. */
157
    Tk_3DBorder selectBorder;   /* Used for selected background. */
158
    XColor *normalFg;           /* Normal foreground for text. */
159
    XColor *normalBg;           /* Normal bachground for  text. */
160
    XColor *selectFg;           /* Color for drawing selected text. */
161
    TixFont font;               /* The default font used in the DItems. */
162
    GC backgroundGC;            /* GC for drawing background. */
163
    GC normalGC;                /* GC for drawing text in normal mode. */
164
    GC selectGC;                /* GC for drawing selected background. */
165
    GC anchorGC;                /* GC for drawing dotted anchor highlight. */
166
    GC dropSiteGC;              /* GC for drawing dotted anchor highlight. */
167
 
168
    Cursor cursor;              /* Current cursor for window, or None. */
169
 
170
    int topPixel;               /* Vertical offset */
171
    int leftPixel;              /* Horizontal offset */
172
    int bottomPixel;
173
    int wideSelect;             /* BOOL: if 1, use a wide selection: the
174
                                 * selection background color covers the whole
175
                                 * widget. If 0, only the "significant" part
176
                                 * of a list entry is highlighted */
177
    int selectWidth;            /* Width of the selection: takes effect only
178
                                 * if wideSelect == 1 */
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
    char *yScrollCmd;           /* Command prefix for communicating with
203
                                 * vertical scrollbar.  NULL means no command
204
                                 * to issue.  Malloc'ed. */
205
    char *xScrollCmd;           /* Command prefix for communicating with
206
                                 * horizontal scrollbar. NULL means no command
207
                                 * to issue.  Malloc'ed. */
208
    char *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
    char *browseCmd;            /* The command to call when the selection
213
                                 * changes. */
214
    char *indicatorCmd;         /* The command to call when the user touches
215
                                 * the indicator. */
216
    char *dragCmd;              /* The command to call when info about a
217
                                 * drag source is needed */
218
    char *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 HListColumn *    Tix_HLAllocColumn _ANSI_ARGS_((
274
                            WidgetPtr wPtr, HListElement * chPtr));
275
EXTERN void             Tix_HLCancelResizeWhenIdle _ANSI_ARGS_((
276
                            WidgetPtr wPtr));
277
EXTERN void             Tix_HLComputeGeometry _ANSI_ARGS_((
278
                            ClientData clientData));
279
EXTERN HListElement *   Tix_HLFindElement _ANSI_ARGS_((Tcl_Interp *interp,
280
                            WidgetPtr wPtr, char * pathName));
281
EXTERN void             Tix_HLFreeMappedWindow _ANSI_ARGS_((WidgetPtr wPtr,
282
                            HListElement * chPtr));
283
EXTERN int              Tix_HLElementTopOffset _ANSI_ARGS_((
284
                            WidgetPtr wPtr, HListElement *chPtr));
285
EXTERN int              Tix_HLElementLeftOffset _ANSI_ARGS_((
286
                            WidgetPtr wPtr, HListElement *chPtr));
287
EXTERN int              Tix_HLItemInfo _ANSI_ARGS_((Tcl_Interp *interp,
288
                            WidgetPtr wPtr, int argc, char** argv));
289
EXTERN int              Tix_HLHeader _ANSI_ARGS_((ClientData clientData,
290
                            Tcl_Interp *interp, int argc, char **argv));
291
EXTERN int              Tix_HLCreateHeaders _ANSI_ARGS_((
292
                            Tcl_Interp *interp, WidgetPtr wPtr));
293
EXTERN void             Tix_HLFreeHeaders _ANSI_ARGS_((
294
                            Tcl_Interp *interp, WidgetPtr wPtr));
295
EXTERN void             Tix_HLDrawHeader _ANSI_ARGS_((
296
                            WidgetPtr wPtr, Pixmap pixmap, GC gc,
297
                            int hdrX, int hdrY, int hdrW, int hdrH,
298
                            int xOffset));
299
EXTERN void             Tix_HLComputeHeaderGeometry _ANSI_ARGS_((
300
                            WidgetPtr wPtr));
301
 
302
EXTERN void             Tix_HLMarkElementDirty _ANSI_ARGS_((WidgetPtr wPtr,
303
                            HListElement *chPtr));
304
EXTERN void             Tix_HLResizeWhenIdle _ANSI_ARGS_((WidgetPtr wPtr));
305
EXTERN void             Tix_HLResizeNow _ANSI_ARGS_((WidgetPtr wPtr));
306
EXTERN void             Tix_HLComputeGeometry _ANSI_ARGS_((
307
                            ClientData clientData));
308
EXTERN void             Tix_HLCancelResizeWhenIdle _ANSI_ARGS_((
309
                            WidgetPtr wPtr));
310
 
311
 
312
/* in tixHLCol.c */
313
EXTERN TIX_DECLARE_SUBCMD(Tix_HLColumn);
314
EXTERN TIX_DECLARE_SUBCMD(Tix_HLItem);
315
 
316
/* in tixHLInd.c */
317
EXTERN TIX_DECLARE_SUBCMD(Tix_HLIndicator);
318
 
319
#undef TCL_STORAGE_CLASS
320
#define TCL_STORAGE_CLASS DLLIMPORT
321
 
322
#endif /*_TIX_HLIST_H_ */
323
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.