struct COLUMN
{
  dword	colwt;			//Column width.
	dword lpszhdrtext;//Pointer to header text.
	dword halign;			//Header text alignment.
	dword calign;			//Column text alignment.
	dword ctype;			//Column data type.
	dword ctextmax;		//Max text lenght for TYPE_EDITTEXT and TYPE_EDITLONG.
	dword lpszformat;	//Format string for TYPE_EDITLONG.
	dword himl;			  //Handle of image list. For the image columns and combobox only.
	dword hdrflag;		//Header flags.
	dword colxp;			//Column position. Internally used.
	dword edthwnd;			//Column control handle. Internally used.
};

struct GRIDNOTIFY
{
	NMHDR nmhdr;
	dword col;			//Column
	dword row;			//Row
	dword hwnd;			//Handle of column edit control
	dword lpdata;		//Pointer to data
	dword fcancel;	//Set to TRUE to cancel operation
};

#define GN_HEADERCLICK		1			//User clicked header
#define GN_BUTTONCLICK		2			//Sendt when user clicks the button in a button cell
#define GN_CHECKCLICK		  3			//Sendt when user double clicks the checkbox in a checkbox cell
#define GN_IMAGECLICK		  4			//Sendt when user double clicks the image in an image cell
#define GN_BEFORESELCHANGE 5		//Sendt when user request a selection change
#define GN_AFTERSELCHANGE 6			//Sendt after a selection change
#define GN_BEFOREEDIT		 7			//Sendt before the cell edit control shows
#define GN_AFTEREDIT		 8			//Sendt when the cell edit control is about to close
#define GN_BEFOREUPDATE	 9			//Sendt before a cell updates grid data
#define GN_AFTERUPDATE	 10			//Sendt after grid data has been updated
#define GN_USERCONVERT	 11			//Sendt when user cell needs to be converted.

//Messages
#define GM_ADDCOL			    WM_USER+1	//wParam=0, lParam=lpCOLUMN
#define GM_ADDROW			    WM_USER+2	//wParam=0, lParam=lpROWDATA (can be NULL)
#define GM_INSROW			    WM_USER+3	//wParam=nRow, lParam=lpROWDATA (can be NULL)
#define GM_DELROW			    WM_USER+4	//wParam=nRow, lParam=0
#define GM_MOVEROW			  WM_USER+5	//wParam=nFromRow, lParam=nToRow
#define GM_COMBOADDSTRING	WM_USER+6	//wParam=nCol, lParam=lpszString
#define GM_COMBOCLEAR		  WM_USER+7	//wParam=nCol, lParam=0
#define GM_GETCURSEL		  WM_USER+8	//wParam=0, lParam=0
#define GM_SETCURSEL		  WM_USER+9	//wParam=nCol, lParam=nRow
#define GM_GETCURCOL		  WM_USER+10	//wParam=0, lParam=0
#define GM_SETCURCOL		  WM_USER+11	//wParam=nCol, lParam=0
#define GM_GETCURROW		  WM_USER+12	//wParam=0, lParam=0
#define GM_SETCURROW		  WM_USER+13	//wParam=nRow, lParam=0
#define GM_GETCOLCOUNT		WM_USER+14	//wParam=0, lParam=0
#define GM_GETROWCOUNT		WM_USER+15	//wParam=0, lParam=0
#define GM_GETCELLDATA		WM_USER+16	//wParam=nRowCol, lParam=lpData
#define GM_SETCELLDATA		WM_USER+17	//wParam=nRowCol, lParam=lpData
#define GM_GETCELLRECT		WM_USER+18	//wParam=nRowCol, lParam=lpRECT
#define GM_SCROLLCELL		  WM_USER+19	//wParam=0, lParam=0
#define GM_GETBACKCOLOR		WM_USER+20	//wParam=0, lParam=0
#define GM_SETBACKCOLOR		WM_USER+21	//wParam=nColor, lParam=0
#define GM_GETGRIDCOLOR		WM_USER+22	//wParam=0, lParam=0
#define GM_SETGRIDCOLOR		WM_USER+23	//wParam=nColor, lParam=0
#define GM_GETTEXTCOLOR		WM_USER+24	//wParam=0, lParam=0
#define GM_SETTEXTCOLOR		WM_USER+25	//wParam=nColor, lParam=0
#define GM_ENTEREDIT		  WM_USER+26	//wParam=nCol, lParam=nRow
#define GM_ENDEDIT			  WM_USER+27	//wParam=nRowCol, lParam=fCancel
#define GM_GETCOLWIDTH		WM_USER+28	//wParam=nCol, lParam=0
#define GM_SETCOLWIDTH		WM_USER+29	//wParam=nCol, lParam=nWidth
#define GM_GETHDRHEIGHT		WM_USER+30	//wParam=0, lParam=0
#define GM_SETHDRHEIGHT		WM_USER+31	//wParam=0, lParam=nHeight
#define GM_GETROWHEIGHT		WM_USER+32	//wParam=0, lParam=0
#define GM_SETROWHEIGHT		WM_USER+33	//wParam=0, lParam=nHeight
#define GM_RESETCONTENT		WM_USER+34	//wParam=0, lParam=0
#define GM_COLUMNSORT		  WM_USER+35	//wParam=nCol, lParam=0=Ascending, 1=Descending, 2=Invert
#define GM_GETHDRTEXT		  WM_USER+36	//wParam=nCol, lParam=lpBuffer
#define GM_SETHDRTEXT		  WM_USER+37	//wParam=nCol, lParam=lpszText
#define GM_GETCOLFORMAT		WM_USER+38	//wParam=nCol, lParam=lpBuffer
#define GM_SETCOLFORMAT		WM_USER+39	//wParam=nCol, lParam=lpszText

//Column alignment
#define ALIGN_LEFT			  0
#define ALIGN_CENTER		  1
#define ALIGN_RIGHT			  2

//Column types
#define TYPE_EDITTEXT		0			//String
#define TYPE_EDITLONG		1			//Long
#define TYPE_CHECKBOX		2			//Long
#define TYPE_COMBOBOX		3			//Long
#define TYPE_HOTKEY			4			//Long
#define TYPE_BUTTON			5			//String
#define TYPE_IMAGE			6			//Long
#define TYPE_DATE			  7			//Long
#define TYPE_TIME			  8			//Long
#define TYPE_USER			  9			//0=String, 1 to 512 bytes binary data

//Column sorting
#define SORT_ASCENDING		0
#define SORT_DESCENDING		1
#define SORT_INVERT			  2

//Window styles
#define STYLE_NOSEL			  01h
#define STYLE_NOFOCUS		  02h
#define STYLE_HGRIDLINES	04h
#define STYLE_VGRIDLINES	08h
#define STYLE_GRIDFRAME		10h

byte szRAGridClass="RAGrid";

