Debian Codegraph @

pTk/mTk/tixGeneric/tixGrData.h

raw symbols SCIP
1
2 /* $Id: tixGrData.h,v 1.1.1.1 2000/05/17 11:08:42 idiscovery Exp $ */
3
4 /*
5 * tixGData.h --
6 *
7 * Defines portable data structure for tixGrid.
8 *
9 * Copyright (c) 1996, Expert Interface Technologies
10 *
11 * See the file "license.terms" for information on usage and redistribution
12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 *
14 */
15
16 #ifndef _TIX_GRID_DATA_H_
17 #define _TIX_GRID_DATA_H_
18
19 /*
20 * Data structure that stored the cells in a Grid widget. It is optimized
21 * for column/row insertion and deletion.
22 *
23 * - A grid is divideded into a set of rows and columns. Each row and column
24 * is divided into a set of cells.
25 *
26 * - The following discusses the structure of a row. The structure of a
27 * column is the reverse of a row.
28 *
29 * Row y is stored in the hash table TixGridDataSet.index[1] with
30 * the index y. Hence, to search for row y, we use the FindHashEntry
31 * operation:
32 *
33 * row_y = TixGridDataSet.index[1].FindHashEntry(y);
34 *
35 * To locate a cell (x,y), we can first find the row y, and then
36 * locate the cell at column x of this row. Note that the cell is
37 * *not* indexed by its column position (y), but rather by the hash
38 * table of the column y. The following example illustrates how cell
39 * (x,y) can be searched:
40 *
41 * row_y = TixGridDataSet.index[1].FindHashEntry(y);
42 * col_x = TixGridDataSet.index[0].FindHashEntry(x);
43 *
44 * cell_xy = row_x.list.FindHashEntry(&col_x);
45 *
46 * The advantage of this arrangement is it is very efficient to
47 * insert a row into into the grid -- we just have to fix the
48 * indices of the rows table. For example, if, after the insertion,
49 * row_y is now moved to the row y1, we change its index from y to
50 * y1. In general, an insertion operation takes log(n) time in a
51 * grid that contains n items.
52 *
53 */
54 typedef struct TixGridDataSet {
55 Tcl_HashTable index[2]; /* the row and column indices */
56 /* index[0] holds the columns
57 * (horizontal index)
58 */
59 int maxIdx[2]; /* the max row/col, or {-1,-1}
60 * if there are no rows/col
61 */
62 } TixGridDataSet;
63
64 #define TIX_GR_AUTO 0
65 #define TIX_GR_DEFAULT 1
66 #define TIX_GR_DEFINED_PIXEL 2
67 #define TIX_GR_DEFINED_CHAR 3
68
69 typedef struct TixGridSize {
70 int sizeType;
71 int sizeValue; /* width or height */
72 int pixels;
73 int pad0, pad1;
74 double charValue;
75 } TixGridSize;
76
77 typedef struct TixGridRowCol {
78 /* private: */
79 Tcl_HashTable table;
80
81 /* public: */
82 int dispIndex; /* the row or column in which
83 * this TixGridRowCol is displayed */
84 TixGridSize size;
85 } TixGridRowCol;
86
87
88 #endif