📄 select.c
字号:
return ASIX_ERROR; //return ASIX_OK; //modified by xuanhui 2002/3/20
switch( sl_msg_type )
{
case WM_PENDOWN:
{
if( style&SLS_CHECKBOX )
{
//modified by xuanhui 2002/3/20
//if( ActiveAreaRead( ctrl_ptr->id_index[ctrl_ptr->sl_nextradio->index], &x, &y, &xdest, &ydest ) == PPSM_ERROR )
//modified by xuanhui 2002/4/3 恢复了复选框的作用
if( ActiveAreaRead( ctrl_ptr->id_index[ctrl_ptr->sl_nextradio->index], &x, &y, &xdest, &ydest ) == PPSM_ERROR )
{
return ASIX_ERROR;
}
//modified by xuanhui 2002/3/20
if( exdata_ptr[ctrl_ptr->sl_nextradio->index].state == 0 )
{
exdata_ptr[ctrl_ptr->sl_nextradio->index].state = 1;
//modified by xuanhui 2002/4/4
draw3dcheckbox((U16)x,(U16)((U16)y+starty_interval),SL_DIAMETER,SL_DIAMETER,1,1 );
}else if( exdata_ptr[ctrl_ptr->sl_nextradio->index].state == 1)
{
exdata_ptr[ctrl_ptr->sl_nextradio->index].state = 0;
draw3dcheckbox((U16)x,(U16)((U16)y+starty_interval),SL_DIAMETER,SL_DIAMETER,1,0 );
}
/* exdata_ptr[ctrl_ptr->sl_curradio->index].state = 0;
draw3dcheckbox( x,y,SL_DIAMETER,SL_DIAMETER,1,0 );
if( ActiveAreaRead( ctrl_ptr->id_index[ctrl_ptr->sl_nextradio->index], &x, &y, &xdest, &ydest ) == PPSM_ERROR )
{
return ASIX_ERROR;
}
exdata_ptr[ctrl_ptr->sl_nextradio->index].state = 1;
draw3dcheckbox( x,y,SL_DIAMETER,SL_DIAMETER,1,1 );
*/
}else if( style&SLS_RADIOBOX ){
//modified by xuanhui 2002/3/20
//ActiveAreaRead( ctrl_ptr->id_index[ctrl_ptr->sl_curradio->index], &x, &y, &xdest, &ydest );
if( ActiveAreaRead( ctrl_ptr->id_index[ctrl_ptr->sl_curradio->index], &x, &y, &xdest, &ydest ) == PPSM_ERROR )
{
return ASIX_ERROR;
}
exdata_ptr[ctrl_ptr->sl_curradio->index].state = 0;
draw3dradiobox( (U16)x,(U16)((U16)y+starty_interval),SL_DIAMETER,SL_DIAMETER,1,0 );
//modified by xuanhui 2002/3/20
//ActiveAreaRead( ctrl_ptr->id_index[ctrl_ptr->sl_nextradio->index], &x, &y, &xdest, &ydest );
if( ActiveAreaRead( ctrl_ptr->id_index[ctrl_ptr->sl_nextradio->index], &x, &y, &xdest, &ydest ) == PPSM_ERROR )
{
return ASIX_ERROR;
}
exdata_ptr[ctrl_ptr->sl_nextradio->index].state = 1;
draw3dradiobox( (U16)x,(U16)((U16)y+starty_interval),SL_DIAMETER,SL_DIAMETER,1,1 );
}
ctrl_ptr->sl_curradio->index = ctrl_ptr->sl_nextradio->index;
ctrl_ptr->sl_curradio->state = ctrl_ptr->sl_nextradio->state;
ctrl_ptr->sl_curradio->caption = ctrl_ptr->sl_nextradio->caption;
// } //此 "{"应在以上三句的前面 //modified by xuanhui 2002/3/20
return ASIX_OK;
}
case WM_PENDRAG:
return ASIX_OK;
case WM_PENDRAGUP:
return ASIX_OK;
case WM_PENUP:
{
memset( (void *)&msg, 0x0, sizeof(MSG) );
msg.messageType = ASIX_MESSAGE;
msg.message = WM_SELECTBOX;
msg.lparam = ctrl_ptr->wndid;
// msg.wparam = 0; //don't use wparam in button
msg.wparam = ctrl_ptr->sl_curradio->index; //modified by xh 02/11/5
msg.data = NULL; //don't use data in button
if( AdvSendMessage(GetCurTask()->id, (P_MESSAGE)&msg, NO_SWAP_TASK) == PPSM_ERROR )
return ASIX_ERROR;
return ASIX_OK;
}
}
return ASIX_OK;
}
STATUS sl_caption(void *ctrl_str, char *caption, void *exdata)
{
return ASIX_OK;
}
STATUS sl_repaint(void *ctrl_str, U32 lparam)
{
struct sl_ctrl_str *ctrl_ptr;
U8 i;
//U8 j;
//U8 rownum;
U16 startx;
U16 starty;
//modified by xuanhui 2002/4/4
U16 text_starty;
char *scaption = NULL;
// int k;
int string_len;
U16 y_frame; //modified by xuanhui 2002/4/9
U16 interval;
U8 enable;
ctrl_ptr = (struct sl_ctrl_str *)ctrl_str;
// interval = (ctrl_ptr->sl_hight)/(ctrl_ptr->sl_rownum); //modified by xuanhui 2002/4/9
// startx = ctrl_ptr->sl_x + 2; //startx is the start x coordinate of the checkbox or radiobox
startx = ctrl_ptr->sl_x + 3; //modified by xuanhui 2002/4/9
//LM change the offset from 18 to 2 2001/07/06
//modified by xuanhui 2002/4/4
//starty = ctrl_ptr->sl_y + interval/2-SL_DISPLAY_TEXT_HEIGHT/2; //starty is the start y coordiante of the checkbox or radiobox
/* starty = ctrl_ptr->sl_y + interval/2-SL_DIAMETER/2;
text_starty = ctrl_ptr->sl_y + interval/2-CHINESE_CHAR_HEIGHT/2; //starty is the start y coordiante of caption of the checkbox or radiobox
*/ if ( ctrl_ptr->sl_width < (U16)(SL_DISTANCE+3*2+ENGLISH_CHAR_WIDTH) )
return ASIX_ERROR;
//draw the frame and its caption
if (ctrl_ptr->sl_style & SLS_FRAME)
{ //modified by xuanhui 2002/3/28
if ( ctrl_ptr->sl_caption != NULL ) //modified by xuanhui 2002/4/4
{
if ( ctrl_ptr->sl_width < (U16)(SL_FRAME_TEXT_X_INTERVAL*2+ENGLISH_CHAR_WIDTH+2)
|| ctrl_ptr->sl_hight < (U16)(SL_FRAME_TEXT_HEIGHT+ CHINESE_CHAR_HEIGHT+2) )
return ASIX_ERROR;
//modified by xuanhui 2002/4/9
interval = (ctrl_ptr->sl_hight-SL_FRAME_TEXT_HEIGHT-3)/(ctrl_ptr->sl_rownum);
y_frame = (U16)(ctrl_ptr->sl_y + SL_FRAME_TEXT_HEIGHT);
starty = y_frame + interval/2-SL_DIAMETER/2;
text_starty = y_frame + interval/2-CHINESE_CHAR_HEIGHT/2;
if ( interval < CHINESE_CHAR_HEIGHT || interval < SL_DIAMETER )
return ASIX_ERROR;
//modified by xuanhui 2002/4/4
//draw3dframe( ctrl_ptr->sl_x,ctrl_ptr->sl_y,ctrl_ptr->sl_width,ctrl_ptr->sl_hight,ctrl_ptr->sl_style,ctrl_ptr->sl_caption );
string_len = (U16)( ctrl_ptr->sl_width-SL_FRAME_TEXT_X_INTERVAL*2-2 )/ENGLISH_CHAR_WIDTH;
scaption = Lcalloc( ( string_len+1)*sizeof(char) ); //allocate a buffer to store the string that can be displayed on the button surface
if ( scaption == NULL )
return ASIX_ERROR;
if( (U16)strlen(ctrl_ptr->sl_caption) > string_len )
{
memcpy( scaption, ctrl_ptr->sl_caption, string_len - 1 ); //modified by xh 02/11/5
// for( k=0;k<string_len;k++ )
// scaption[k] = ctrl_ptr->sl_caption[k];
scaption[string_len - 1] = '\0';
}
else
// scaption = ctrl_ptr->sl_caption;
memcpy( scaption, ctrl_ptr->sl_caption, string_len ); //modified by xh 02/11/5
}else{
//modified by xuanhui 2002/4/9
interval = (ctrl_ptr->sl_hight-3*2)/(ctrl_ptr->sl_rownum);
y_frame = (U16)(ctrl_ptr->sl_y+3);
starty = y_frame + interval/2-SL_DIAMETER/2;
text_starty = y_frame + interval/2-CHINESE_CHAR_HEIGHT/2;
if ( interval < CHINESE_CHAR_HEIGHT || interval < SL_DIAMETER )
return ASIX_ERROR;
}
draw3dframe( ctrl_ptr->sl_x,ctrl_ptr->sl_y,ctrl_ptr->sl_width, ctrl_ptr->sl_hight,ctrl_ptr->sl_style,scaption );
}
else //modified by xuanhui 2002/3/28
{
//modified by xuanhui 2002/4/9
interval = (ctrl_ptr->sl_hight)/(ctrl_ptr->sl_rownum);
y_frame = ctrl_ptr->sl_y;
starty = y_frame + interval/2-SL_DIAMETER/2;
text_starty = y_frame + interval/2-CHINESE_CHAR_HEIGHT/2;
if ( ctrl_ptr->sl_width < (U16)(SL_DISTANCE+2*2+ENGLISH_CHAR_WIDTH)
//modified by xuanhui 2002/4/4
// || interval < SL_DISPLAY_TEXT_HEIGHT
// || SL_DIAMETER < CHINESE_CHAR_HEIGHT )
|| interval < CHINESE_CHAR_HEIGHT
|| interval < SL_DIAMETER )
return ASIX_ERROR;
}
//modified by xuanhui 2002/4/4
string_len = (U16)( ctrl_ptr->sl_width-3*2-SL_DISTANCE )/ENGLISH_CHAR_WIDTH;
//draw the radio box or checkbox
for( i=0;i<ctrl_ptr->sl_rownum;i++ )
{
//modified by xuanhui 2002/4/4
scaption = Lcalloc( ( string_len+1)*sizeof(char) ); //allocate a buffer to store the string that can be displayed on the button surface
if ( scaption == NULL )
return ASIX_ERROR;
if( (U16)strlen(ctrl_ptr->sl_exdata[i].caption) > string_len )
{
memcpy( scaption, ctrl_ptr->sl_exdata[i].caption, string_len - 1 ); //modified by xh 02/11/5
// for( k=0;k<string_len;k++ )
// scaption[k] = ctrl_ptr->sl_exdata[i].caption[k];
scaption[string_len - 1] = '\0';
}
else
// scaption = ctrl_ptr->sl_exdata[i].caption;
memcpy( scaption, ctrl_ptr->sl_exdata[i].caption, string_len ); //modified by xh 02/11/5
//draw checkbox with its style
if( ctrl_ptr->sl_style&SLS_CHECKBOX )
{
if( !(ctrl_ptr->sl_style&SLS_ENABLE) ) //modified by xuanhui 2002/4/4
{
enable = FALSE; //modified by xuanhui 2002/3/20
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_DARKGREY,ctrl_ptr->sl_exdata[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_disablecolor,ctrl_ptr->sl_exdata[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_disablecolor,scaption,startx+SL_DISTANCE,text_starty );
}else{
enable = TRUE;
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_BLACK,ctrl_ptr->sl_exdata[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_text,ctrl_ptr->sl_exdata[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_text,scaption,startx+SL_DISTANCE,text_starty );
}
draw3dcheckbox(startx,starty,SL_DIAMETER,SL_DIAMETER,enable,ctrl_ptr->sl_exdata[i].state );
} else if( ctrl_ptr->sl_style&SLS_RADIOBOX ) { //draw radiobox with its style
if( !(ctrl_ptr->sl_style&SLS_ENABLE) ) //modified by xuanhui 2002/4/4
{
enable = FALSE; //modified by xuanhui 2002/3/20
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_DARKGREY,ctrl_ptr->sl_exdata[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_disablecolor,ctrl_ptr->sl_exdata[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_disablecolor,scaption,startx+SL_DISTANCE,text_starty );
}else{
enable = TRUE;
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_BLACK,ctrl_ptr->sl_exdata[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_text,ctrl_ptr->sl_exdata[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_text,scaption,startx+SL_DISTANCE,text_starty );
}
draw3dradiobox(startx,starty,SL_DIAMETER,SL_DIAMETER,enable,ctrl_ptr->sl_exdata[i].state );
//SetDotWidth(1,0);
//Disp16StringGrey( GPC_BLACK,exdata_ptr[i].caption,startx+32,starty );
}
//change the y coordinate which will draw a radiobox or checkbox next time
starty = starty + interval;
text_starty = text_starty + interval; //modified by xuanhui 2002/4/4
Lfree( scaption ); //modified by xh 02/11/5
}
return ASIX_OK;
}
STATUS sl_enable(void *ctrl_str, U8 enable)
{
return ASIX_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -