www.pudn.com > cwin.rar > GETCODE.C
/*-----------------------------------------------------------
函数 getcode : 代码表
-----------------------------------------------------------*/
#include
#include
static char **_CodeList = NULL;
static int _MultiSelect = NO;
/*-- 内部函数 _NthRecord : 构造代码表的第i个代码条目 ------*/
static void _Cdecl _NthRecord(i,code,key)
int i; /* 代码条目的序号 */
char *code; /* 带回构造好的代码条目的参数 */
unsigned key; /* 检查是否多选的键码 */
{
char *p = _CodeList[i];
if(_MultiSelect && key==KEY_SPACE)
*p = *p=='*'?' ':'*';
strcpy(code,_CodeList[i]);
}
/*------------ 函数 getcode : 窗口式代码表函数 ------------*/
unsigned _Cdecl getcode(col,line,width,high,title,n,codelist,no,mark)
int col; /* 代码表左上角列坐标(以字节为单位) */
int line; /* 代码表左上角行坐标(以象素为单位) */
int width; /* 代码表宽度(以字节为单位) */
int high; /* 代码表高度(以象素为单位) */
char *title; /* 代码表标题 */
int n; /* 代码表长度(代码条数) */
char *codelist[]; /* 代码表 */
int *no; /* 选中的代码序号 */
int mark; /* 是否允许多项重复选择 */
{
_CodeList = codelist;
_MultiSelect = mark;
return _GetCode(col,line,width,high,title,n,_NthRecord,no);
}