home *** CD-ROM | disk | FTP | other *** search
- #define WC_TcTbl "TcTable"
-
- #define WS_TBL_MULTIPLESEL 0x0004
- #define WS_TBL_PRIVATEIMAGE 0x0008
- #define WS_TBL_ALWAYSEDIT 0x0010
- #define WS_TBL_AUTO 0x0020
-
- //***********************************************************
- enum
- {
- TBL_DT_TEXT,
- TBL_DT_BOOL,
- TBL_DT_INT,
- TBL_DT_FLOAT,
- TBL_DT_PTR,
- TBL_DT_CUSTOM
- };
- enum
- {
- // TBL_CTRL_NONE,
- TBL_CTRL_EDIT,
- TBL_CTRL_MLEDIT,
- TBL_CTRL_ECOMBO,
- TBL_CTRL_LCOMBO,
- TBL_CTRL_CHECK,
- TBL_CTRL_3STATE,
- TBL_CTRL_CUSTOM,
- };
- //***********************************************************
- #define TBLCF_READONLY (1U<<0)
- #define TBLCF_TITLEIMAGE (1U<<1)
- #define TBLCF_ALIGNRIGHT (1U<<2)
- #define TBLCF_ALIGNCENTER (1U<<3)
- #define TBLCF_HWND_AS_ID (1U<<4)
- //***********************************************************
- struct ADDTBLCOLUMN
- {
- WORD ctrlType;
- WORD dataType;
- WORD dataSize; // only for TBL_DT_CUSTOM, TBL_DT_TEXT
- WORD textLength; // only for TBL_DT_CUSTOM
-
- WORD iTblGrp;
- short iTitleImgIdx;
- WORD exRows;
- WORD dummy1;
-
- DWORD dwFlags;
- short iWidth; // Column in Pixels (0:Default, -1:Hidden)
- short dummy2;
-
- HIMAGELIST hImageListCB; // Combo box
- HIMAGELIST hImageListTitle; // 1, 2, 3 = Standard
-
- HWND hwnd;
-
- char * Title;
- };
- //***********************************************************
- typedef struct _TBL_GETFIELD {
- long row;
- long col;
- char buf[256];
- WORD changed; // FOR GET ONLY
- WORD dummy1;
- }
- TBL_GETFIELD;
- //***********************************************************
- enum
- {
- WM_TBL_INSERTCOLUMN // wParam - Column Index; (-1)-Add ; lParam - (ADDTBLCOLUMN*)
- = (0x1000+1),
- WM_TBL_INIT, // wParam - numCols, lParam - (ADDTBLCOLUMN*)
- WM_TBL_RESET, //
- WM_TBL_CLEAR, //
- WM_TBL_USERCACHE,
-
- WM_TBL_GRPTITLE, // wParam - num, lParam = Title
-
- WM_TBL_HWNDCONTROL, // wParam - Column Index; Return HWND
- WM_TBL_SHOWCTRL, // wParam - 0-Hide,1-Show,2-Switch
- WM_TBL_GETCURCOL, // Return CURRENT CONTROL COLUMN
-
- WM_TBL_GETROWCOUNT, // Return Rows
- WM_TBL_GETCURROW, // Return CurRow
- WM_TBL_SETCURROW, // wParam = row; Return CurRow
-
- WM_TBL_INSERTROW, // wParam - Row_Index, lParam = flags; Return Row_Index
- #define INSROW_SETCUR 1
- #define INSROW_NODRAW 2
- WM_TBL_DELETEROW, // wParam - Row_Index
-
- WM_TBL_GETFIELD, // lParam = (TBL_GETFIELD*)
- WM_TBL_SETFIELD, // lParam = (TBL_GETFIELD*), if(row==FocusRow ) wParam = ChgFlag(1)
- WM_TBL_SETCTRLFLAG, // wParam = col, lParam = flag
-
- WM_TBL_GETROWFLAG, // wParam - Row_Index; Return Flag
- WM_TBL_SETROWFLAG, // wParam - Row_Index; lParam - Flag
-
- WM_TBL_GETCOLWIDTH, // wParam - col; Return Width
- WM_TBL_SETCOLWIDTH, // wParam - col, lParam - Width
-
- WM_TBL_CTRLMODIFY, // wParam - col
- WM_TBL_CTRLKEY, // wParam - VK_....
- WM_TBL_CTRLFOCUS, // wParam - BOOL
-
- WM_TBL_FIXCOLS, // wParam - number of cols
- WM_TBL_SAVEROW, // -
-
- WM_TBL_SAVE_DIM, // lParam = (int*)
- WM_TBL_RESTORE_DIM, // lParam = (int*)
-
- WM_TBL_GETCOLCOUNT, // Return Cols()
- WM_TBL_GETCOLINIT, // lParam = ADDTBLCOLUMN []
- WM_TBL_GETCOLTITLE, // wParam = col, lParam = char[256]
- WM_TBL_DRAWROW, // lParam = row
- WM_TBL_UNDOROW, // -
-
- WM_TBL_GETEXTROW, // Return ...
- WM_TBL_SETEXTROW, // wParam = ...
- WM_TBL_GETVISROWCOUNT, // return num_rows_visible
-
- WM_TBL_SETFTITLECLR, // wParam=col, lParam = COLORREF
- WM_TBL_SETBTITLECLR, // wParam=col, lParam = COLORREF
-
- WM_TBL_SETVTBL, // wParam = auto_delete, lParam = vtbl
- WM_TBL_TEXT4FIND, // lParam = (TBL_GETFIELD*)
-
- WM_TBL_SETCURCOL, // wParam = col
- WM_TBL_MOUSE2CELL, // lParam = (POINT*) Input:mouse_pos; Output:y=Row x=Column
- WM_TBL_SETCOLTITLE, // wParam = col, lParam = char*
- WM_TBL_SETROWHDRWIDTH, // wParam = left_btn_cx
-
- };
- //***********************************************************
- #define TcTbl_InsertColumn(table,idx,s) SendMessage(table,WM_TBL_INSERTCOLUMN,idx,(LPARAM)(s))
- #define TcTbl_Init(table,num,p) SendMessage(table,WM_TBL_INIT,num,(LPARAM)(p))
- #define TcTbl_Reset(table) SendMessage(table,WM_TBL_RESET,0,0)
- #define TcTbl_Clear(table) SendMessage(table,WM_TBL_CLEAR,0,0)
- #define TcTbl_SetGrpTitle(tbl,num,title) SendMessage(tbl,WM_TBL_GRPTITLE,num,(LPARAM)title)
- #define TcTbl_GetHWndControl(table,col) ((HWND)SendMessage(table,WM_TBL_HWNDCONTROL,col,0))
- #define TcTbl_GetRowCount(table) SendMessage(table,WM_TBL_GETROWCOUNT,0,0)
- #define TcTbl_GetColCount(table) SendMessage(table,WM_TBL_GETCOLCOUNT,0,0)
- #define TcTbl_GetCurRow(table) SendMessage(table,WM_TBL_GETCURROW,0,0)
- #define TcTbl_SetCurRow(table,row) SendMessage(table,WM_TBL_SETCURROW,row,0)
- #define TcTbl_GetCurCol(table) SendMessage(table,WM_TBL_GETCURCOL,0,0)
- #define TcTbl_InsertRow(table,row,f) SendMessage(table,WM_TBL_INSERTROW,row,f)
- #define TcTbl_DeleteRow(table,row) SendMessage(table,WM_TBL_DELETEROW,row,0)
- #define TcTbl_GetField(table,s) SendMessage(table,WM_TBL_GETFIELD,0,(LPARAM)(s))
- #define TcTbl_SetField(table,s,f) SendMessage(table,WM_TBL_SETFIELD,f,(LPARAM)(s))
- #define TcTbl_GetRowFlag(table,r) SendMessage(table,WM_TBL_GETROWFLAG,r,0)
- #define TcTbl_SetRowFlag(table,r,f) SendMessage(table,WM_TBL_SETROWFLAG,r,f)
- #define TcTbl_SaveRow(table) SendMessage(table,WM_TBL_SAVEROW,0,0)
- #define TcTbl_UndoRow(table) SendMessage(table,WM_TBL_UNDOROW,0,0)
- #define TcTbl_SetFTitleColor(tbl,col,clr) SendMessage(tbl,WM_TBL_SETFTITLECLR,col,clr)
- #define TcTbl_SetBTitleColor(tbl,col,clr) SendMessage(tbl,WM_TBL_SETBTITLECLR,col,clr)
- #define TcTbl_SetVTbl(tbl,vtbl,auto_del) SendMessage(tbl,WM_TBL_SETVTBL,auto_del,vtbl)
-
-
- #define ROWFLAG_CHANGE 1U
- #define ROWFLAG_NEW 2U
-
- #define CTRLFLAG_CHANGED 1
- //#define CTRLFLAG_FILLED 2
-
- //***********************************************************
-
- /* typedef struct tagNMHDR {
- HWND hwndFrom;
- UINT idFrom;
- UINT code;
- } NMHDR; */
-
- typedef struct _TBL_NOTIFY {
- NMHDR hdr;
- HWND hwndCtrl;
- long row;
- long col;
- long idx;
- char buf[256];
- }
- TBL_NOTIFY;
-
- typedef struct _TBL_DNOTIFY {
- NMHDR hdr;
- HWND hwndCtrl; // not used
- long row;
- long col;
- long idx;
- char buf[256];
-
- HDC hDC;
- RECT rect;
- BOOL flag; // 1-focused, 2-selected
- }
- TBL_DRAWCELL;
-
- typedef struct _TBL_CUSTMSG {
- NMHDR hdr;
-
- HWND hwndCtrl; // not used
- long row;
- long col;
- long idx;
- char buf[256];
-
- UINT msg;
- WPARAM wParam;
- LPARAM lParam;
- }
- TBL_CUSTMSG;
-
- /*typedef struct _TBL_DRAGDROP {
- NMHDR hdr;
- POINT ms;
- DWORD row;
- }
- TBL_DRAGDROP;*/
-
- enum
- {
- TBLN_RowChanging = -200, // (row); Return TBL_ROWING_...
- #define TBL_ROWING_OK 0
- #define TBL_ROWING_ERR 1
- #define TBL_ROWING_USER 2
- TBLN_RowChanged, // (new_row)
-
- TBLN_CreateControl, // (col); // hwndCtrl = CreateWindow(...
-
- TBLN_Edit, // (row,col); Return TRUE to prevent to set change flag
- TBLN_Validate, // (row,col); Return TRUE to prevent to leave control
- TBLN_Expand, // (row=wanted_max_rows)
- TBLN_ColHdrClick, // (row,col)
-
- TBLN_Ctrl2Buf, // (row,col,buf); Return OK
- TBLN_Data2Ctrl, // (row,col,buf); Return OK
- TBLN_Data2Draw, // (row,col,buf,idx); Return OK
-
- TBLN_GetField, // (row,col,buf)
- TBLN_SetField, // (row,col,buf)
- TBLN_GetRowFlag, // (row); Return flag
- TBLN_SetRowFlag, // (row,idx); Return BOOL(is_flag_changed)
- TBLN_IsRowSel, // (row); Return BOOL
- TBLN_SetRowSel, // (row,idx=is_sel)
- TBLN_ClearAllSelect, //
- TBLN_Rows, // Return Rows()
- TBLN_InsertRow, // (row); Return row; -1 = no_insert
- TBLN_DeleteRow, // (row); Return BOOL(ok)
- TBLN_DrawCell, // (row,col,buf=data); Return BOOL(ok)
- TBLN_CustMsg, // return LRESULT;
- TBLN_RowHdrClick, // (row)
- TBLN_2Link, // (col)
- TBLN_Edit2, // (row,col)
- TBLN_Text4Find, // (row,col)
- TBLN_ClearCustom, // (col)
- TBLN_DrawRowHdr, // (row); Return BOOL(ok)
-
- };
- //***********************************************************
-
- /*
- switch( uMsg )
- {
- case WM_GETDLGCODE : return (DLGC_WANTARROWS | DLGC_WANTTAB);
- case WM_KEYDOWN :
- if( wParam == VK_RETURN && GetKeyState(VK_SHIFT) >= 0 ) break;
- switch( wParam )
- {
- case VK_RETURN : case VK_TAB :
- case VK_UP : case VK_DOWN : case VK_NEXT : case VK_PRIOR :
- SendMessage(GetParent(hWnd),WM_TBL_CTRLKEY,wParam,0);
- return 0;
- }
- break;
-
- case WM_CHAR :
- // else may be beep ?
- if( wParam == '\t' || wParam == '\r' || wParam == '\n' ) return 0;
- break;
- }
-
- LRESULT ret = CallWindowProc( old_Proc, hWnd, uMsg, wParam, lParam );
- or
- LRESULT ret = DefWindowProc( hWnd, uMsg, wParam, lParam );
-
- if( uMsg == WM_SETFOCUS || uMsg == WM_KILLFOCUS )
- SendMessage(GetParent(hWnd),WM_TBL_CTRLFOCUS,(uMsg == WM_SETFOCUS),0);
-
- return ret;
- */
-