#include "GridP.h"
#include <assert.h>
int
XmLGridGetRowCount(Widget w)
{
XmLGridWidget g = (XmLGridWidget) w;
assert( g !=
NULL );
#ifdef DEBUG_ramiro
{
int rows =
0;
XtVaGetValues(w,XmNrows,&rows,
NULL);
assert( rows == g->grid.rowCount );
}
#endif
return g->grid.rowCount;
}
int
XmLGridGetColumnCount(Widget w)
{
XmLGridWidget g = (XmLGridWidget) w;
assert( g !=
NULL );
#ifdef DEBUG_ramiro
{
int columns =
0;
XtVaGetValues(w,XmNcolumns,&columns,
NULL);
assert( columns == g->grid.colCount );
}
#endif
return g->grid.colCount;
}
void
XmLGridXYToCellTracking(Widget widget,
int x,
int y,
Boolean * m_inGrid,
int * m_lastRow,
int * m_lastCol,
unsigned char * m_lastRowtype,
unsigned char * m_lastColtype,
int * outRow,
int * outCol,
Boolean * enter,
Boolean * leave)
{
int m_totalLines =
0;
int m_numcolumns =
0;
int row =
0;
int column =
0;
unsigned char rowtype = XmCONTENT;
unsigned char coltype = XmCONTENT;
if (
0 > XmLGridXYToRowColumn(widget,
x,
y,
&rowtype,
&row,
&coltype,
&column))
{
*enter =
FALSE;
*leave =
TRUE;
return;
}
m_totalLines = XmLGridGetRowCount(widget);
m_numcolumns = XmLGridGetColumnCount(widget);
if ((row < m_totalLines) &&
(column < m_numcolumns) &&
((*m_lastRow != row)||
(*m_lastCol != column) ||
(*m_lastRowtype != rowtype)||
(*m_lastColtype != coltype)))
{
*outRow = (rowtype == XmHEADING)?-
1:row;
*outCol = column;
if (*m_inGrid == False)
{
*m_inGrid = True;
*enter =
TRUE;
*leave =
FALSE;
}
else
{
*enter =
TRUE;
*leave =
TRUE;
}
*m_lastRow = row;
*m_lastCol = column;
*m_lastRowtype = rowtype ;
*m_lastColtype = coltype ;
}
}