1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 #include "GridP.h"
63
64 #include <assert.h>
65
66
67 int
68 XmLGridGetRowCount(Widget w)
69 {
70 XmLGridWidget g = (XmLGridWidget) w;
71
72 assert( g !=
NULL );
73
74 #ifdef DEBUG_ramiro
75 {
76 int rows =
0;
77
78 XtVaGetValues(w,XmNrows,&rows,
NULL);
79
80 assert( rows == g->grid.rowCount );
81 }
82 #endif
83
84 return g->grid.rowCount;
85 }
86
87 int
88 XmLGridGetColumnCount(Widget w)
89 {
90 XmLGridWidget g = (XmLGridWidget) w;
91
92 assert( g !=
NULL );
93
94 #ifdef DEBUG_ramiro
95 {
96 int columns =
0;
97
98 XtVaGetValues(w,XmNcolumns,&columns,
NULL);
99
100 assert( columns == g->grid.colCount );
101 }
102 #endif
103
104 return g->grid.colCount;
105 }
106
107 void
108 XmLGridXYToCellTracking(Widget widget,
109 int x,
110 int y,
111 Boolean * m_inGrid,
112 int * m_lastRow,
113 int * m_lastCol,
114 unsigned char * m_lastRowtype,
115 unsigned char * m_lastColtype,
116 int * outRow,
117 int * outCol,
118 Boolean * enter,
119 Boolean * leave)
120 {
121 int m_totalLines =
0;
122 int m_numcolumns =
0;
123 int row =
0;
124 int column =
0;
125 unsigned char rowtype = XmCONTENT;
126 unsigned char coltype = XmCONTENT;
127
128 if (
0 > XmLGridXYToRowColumn(widget,
129 x,
130 y,
131 &rowtype,
132 &row,
133 &coltype,
134 &column))
135 {
136
137
138
139
140 *enter =
FALSE;
141 *leave =
TRUE;
142 return;
143 }
144
145 m_totalLines = XmLGridGetRowCount(widget);
146 m_numcolumns = XmLGridGetColumnCount(widget);
147
148 if ((row < m_totalLines) &&
149 (column < m_numcolumns) &&
150 ((*m_lastRow != row)||
151 (*m_lastCol != column) ||
152 (*m_lastRowtype != rowtype)||
153 (*m_lastColtype != coltype)))
154 {
155 *outRow = (rowtype == XmHEADING)?-
1:row;
156 *outCol = column;
157
158 if (*m_inGrid == False)
159 {
160 *m_inGrid = True;
161
162
163
164 *enter =
TRUE;
165 *leave =
FALSE;
166
167 }
168 else
169 {
170
171
172 *enter =
TRUE;
173 *leave =
TRUE;
174 }
175 *m_lastRow = row;
176 *m_lastCol = column;
177 *m_lastRowtype = rowtype ;
178 *m_lastColtype = coltype ;
179 }
180 }
181
182