⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asix_lb.c

📁 基于东南大学开发的SEP3203的ARM7中的所有驱动
💻 C
📖 第 1 页 / 共 5 页
字号:
				{
					Lbox_hide( p_str );
					return ASIX_ERROR;	
				}
				
			if ( wparam == 3 )		
				if ( Lbox_touch_item( 3, p_str, message ) != ASIX_OK)
				{
					Lbox_hide( p_str );
					return ASIX_ERROR;	
				}
				
			if ( wparam == 4 )		
				if ( Lbox_touch_item( 4, p_str, message ) != ASIX_OK)
				{
					Lbox_hide( p_str );
					return ASIX_ERROR;	
				}
												
			break;
			
		case LBS_ROLL:
			if ( wparam == SELECTED_DISPLAY )		Lbox_touch_display( p_str, message );
			if ( wparam == SELECTED_DOWN )		Lbox_touch_down( p_str, message );
			if ( wparam == SELECTED_UP )		Lbox_touch_up( p_str, message );
			break;	
	}
	//PenIrptEnable(  );
	return ASIX_OK;
}	
	


STATUS lb_repaint(void *ctrl_str, U32 lparam)
{
	//ASIX_WINDOW				*wndptr;
	struct LBOX_STRUCTURE  	*ctrlptr;
	struct LBOX_ITEM *p_input;
//	char 	dispbuf[11];//by zl 2002.3.28
	char	*dispbuf;
	U32		pGC;
	U16		arrow_upfrom;//by zl 2002.4.2
	U16		strX, strY;
	
	
	if (ctrl_str == NULL || *((U32 *)ctrl_str) != WNDCLASS_LIST ) return ASIX_ERROR;

	pGC = GetGC( );

	ctrlptr = (struct LBOX_STRUCTURE *)ctrl_str;
	//wndptr = (ASIX_WINDOW *)(ctrlptr->windowid);
	arrow_upfrom = (ctrlptr->height - ARROW_WIDTH)/2;
	if ((dispbuf = (char *)Lmalloc( ctrlptr->maxlength )) == NULL)	return ASIX_ERROR;//by zl 2002.3.28
	
	switch ( ctrlptr->lbox_style )
	{
		case LBS_ROLL:
						
//			ClearRec( pGC, GPC_WHITE, ctrlptr->x+1, ctrlptr->y+1, ctrlptr->width-1, ctrlptr->height-1, GPC_REPLACE_STYLE ); //by zl 2002.3.13
			ClearRec( pGC, ColorTheme.form_backcolor, ctrlptr->x, ctrlptr->y, ctrlptr->width, ctrlptr->height, GPC_REPLACE_STYLE ); 
//			DrawRec( pGC,  GPC_BLACK, ctrlptr->x, ctrlptr->y, ctrlptr->x+ctrlptr->width, ctrlptr->y+ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE ); //BY ZL 2002.3.13
			DrawRec( pGC,  ColorTheme.form_board, ctrlptr->x, ctrlptr->y, ctrlptr->x+ctrlptr->width, ctrlptr->y+ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE );			
//			DrawLine( pGC, GPC_BLACK, ctrlptr->x+ctrlptr->width-2*SCROLL_WIDTH, ctrlptr->y, ctrlptr->x+ctrlptr->width-2*SCROLL_WIDTH, ctrlptr->y+ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE ); // by zl 2002.3.13
			DrawVert( pGC, ColorTheme.form_line, ctrlptr->x+ctrlptr->width-2*SCROLL_WIDTH - 1, ctrlptr->y, ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE );
//			DrawLine( pGC, GPC_BLACK, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH, ctrlptr->y, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH, ctrlptr->y+ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE ); // by zl 2002.3.13
			DrawVert( pGC, ColorTheme.form_line, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH -1, ctrlptr->y, ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE );			
			
//			Advswitchonetotwo( up, ctrlptr->x+ctrlptr->width-2*SCROLL_WIDTH+5, ctrlptr->y+5, 10, 10,
//			BLACK_TO_GREY, WHITE_TO_WHITE);				
//			switchonetotwo( down, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH+5, ctrlptr->y+5, 10, 10);
//			DrawMonoImage( pGC, up, ctrlptr->x+ctrlptr->width-2*SCROLL_WIDTH+5, ctrlptr->y+5, 10, 10, GPC_BLACK, GPC_WHITE); //by zl 2002.3.13
//			DrawMonoImage( pGC, down, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH+5, ctrlptr->y+5, 10, 10,	GPC_BLACK, GPC_WHITE);	//by zl 2002.3.13
//			DrawMonoImage( pGC, up7x7, ctrlptr->x + ctrlptr->width - 2 * SCROLL_WIDTH + ARROW_LEFT_FROM - 1, ctrlptr->y + ARROW_UP_FROM - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);	//by zl 2002.4.1
//			DrawMonoImage( pGC, down7x7, ctrlptr->x + ctrlptr->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, ctrlptr->y + ARROW_UP_FROM - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);	//by zl 2002.4.1	
//			DrawMonoImage( pGC, up7x7, ctrlptr->x + ctrlptr->width - 2 * SCROLL_WIDTH + ARROW_LEFT_FROM - 1, ctrlptr->y + arrow_upfrom - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);	
			{
				U32	hbmp;
				//U32	trColor;
				U16 lx = ctrlptr->x + ctrlptr->width - 2 * SCROLL_WIDTH + ARROW_LEFT_FROM - 1;
				U16 ly = ctrlptr->y + arrow_upfrom - 1;
				U32 palette[2];
				
				palette[0] =  ColorTheme.form_client;
				palette[1] = ColorTheme.form_frontcolor;

				hbmp = LoadBitmap( up7x7, palette );
				if( hbmp != 0 )
				{
					//SetBMPPalette( hbmp, palette, NULL );
					//SetBkFillMode( pGC, MAKELONG( GPC_REPLACE_STYLE, GPC_TRANSPARENT_STYLE ) );
					//GetBMPPixel( pGC, 0, 0, hbmp, &trColor );
					//DisplayBMPEx( pGC, x, y, hbmp, GPC_TRANSPARENT_STYLE, trColor );
					DisplayBMP( pGC, lx, ly, hbmp );
					FreeBitmap( hbmp );
				}
			}
//			DrawMonoImage( pGC, down7x7, ctrlptr->x + ctrlptr->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, ctrlptr->y + arrow_upfrom - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);		
			{
				U32	hbmp;
				//U32	trColor;
				U16 lx = ctrlptr->x + ctrlptr->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1;
				U16 ly = ctrlptr->y + arrow_upfrom - 1;
				U32 palette[2];
				
				palette[0] = ColorTheme.form_client;
				palette[1] = ColorTheme.form_frontcolor;

				hbmp = LoadBitmap( down7x7, palette );
				if( hbmp != 0 )
				{
					//SetBMPPalette( hbmp, palette, NULL );
					//SetBkFillMode( pGC, MAKELONG( GPC_REPLACE_STYLE, GPC_TRANSPARENT_STYLE ) );
					//GetBMPPixel( pGC, 0, 0, hbmp, &trColor );
					//DisplayBMPEx( pGC, x, y, hbmp, GPC_TRANSPARENT_STYLE, trColor );
					DisplayBMP( pGC, lx, ly, hbmp );
					FreeBitmap( hbmp );
				}
			}
			
			break;
			
		case LBS_POPUP:
			
//			ClearRec( pGC, GPC_WHITE, ctrlptr->x+1, ctrlptr->y+1, ctrlptr->width-1, ctrlptr->height-1, GPC_REPLACE_STYLE );	//by zl 2002.3.13
			ClearRec( pGC, ColorTheme.form_backcolor, ctrlptr->x, ctrlptr->y, ctrlptr->width, ctrlptr->height, GPC_REPLACE_STYLE );	
//			DrawRec( pGC,  GPC_BLACK, ctrlptr->x, ctrlptr->y, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH, ctrlptr->y+ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE ); // by zl 2002..3.13
			DrawRec( pGC,  ColorTheme.form_board, ctrlptr->x, ctrlptr->y, ctrlptr->x + ctrlptr->width - 1, ctrlptr->y + ctrlptr->height - 1, GPC_SOLID_LINE, GPC_REPLACE_STYLE );
//			DrawRec( pGC,  GPC_BLACK, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH, ctrlptr->y, ctrlptr->x+ctrlptr->width, ctrlptr->y+ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE );		 //by zl 2002.3.13
			DrawVert( pGC,  ColorTheme.form_line, ctrlptr->x + ctrlptr->width -SCROLL_WIDTH - 1, ctrlptr->y, ctrlptr->height, GPC_SOLID_LINE, GPC_REPLACE_STYLE );		
			
//			switchonetotwo( down, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH+5, ctrlptr->y+5, 10, 10);
//			DrawMonoImage( pGC, down, ctrlptr->x+ctrlptr->width-SCROLL_WIDTH+5, ctrlptr->y+5, 10, 10, GPC_BLACK, GPC_WHITE); //by zl 2002.3.13
//			DrawMonoImage( pGC, down7x7, ctrlptr->x + ctrlptr->width-SCROLL_WIDTH + ARROW_LEFT_FROM - 1, ctrlptr->y + ARROW_UP_FROM - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);			//by zl 2002.4.1
//			DrawMonoImage( pGC, down7x7, ctrlptr->x + ctrlptr->width-SCROLL_WIDTH + ARROW_LEFT_FROM - 1, ctrlptr->y + arrow_upfrom - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);			
			{
				U32	hbmp;
				//U32	trColor;
				U16 lx = ctrlptr->x + ctrlptr->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1;
				U16 ly = ctrlptr->y + arrow_upfrom - 1;
				U32 palette[2];
				
				palette[0] = ColorTheme.form_client;
				palette[1] = ColorTheme.form_frontcolor;

				hbmp = LoadBitmap( down7x7, palette );
				if( hbmp != 0 )
				{
					//SetBMPPalette( hbmp, palette, NULL );
					//SetBkFillMode( pGC, MAKELONG( GPC_REPLACE_STYLE, GPC_TRANSPARENT_STYLE ) );
					//GetBMPPixel( pGC, 0, 0, hbmp, &trColor );
					//DisplayBMPEx( pGC, x, y, hbmp, GPC_TRANSPARENT_STYLE, trColor );
					DisplayBMP( pGC, lx, ly, hbmp );
					FreeBitmap( hbmp );
				}
			}
			break;
						
		default:
			return ASIX_ERROR;
			break;
	}
	
	p_input = ctrlptr->lbox_item + ctrlptr->offset;

	Lbox_cutstring( p_input->item_text, ctrlptr->maxlength, dispbuf ); //Lbox_cutstring( p_input->item_text, 6, dispbuf );//by zl 2002.3.13
//	Disp16String( dispbuf, ctrlptr->x+MARGIN, ctrlptr->y + ITEMTEXT_UP_FROM); //Disp16String( dispbuf, ctrlptr->x+MARGIN, ctrlptr->y+2);//by zl 2002.3.13
	strX = AlignString( dispbuf, ctrlptr->x + MARGIN, ctrlptr->width -SCROLL_WIDTH-MARGIN*2, GPC_ALIGN_CENTER );
	strY = ctrlptr->y + ( ctrlptr->height - CHINESE_CHAR_HEIGHT )/2;
	TextOut( pGC, dispbuf, strX, strY, NULL, ColorTheme.form_poptext, GPC_REPLACE_STYLE );

	Lfree( (void *)dispbuf);
	
	return ASIX_OK;
	
}	

	
/*******************************************************************************/
/****点击显示框*******************************************************************/
static STATUS Lbox_touch_display( struct LBOX_STRUCTURE * p_str, U16 message )	
{
	U32		pGC;
	
	if ( p_str->lbox_style != LBS_POPUP )	return ASIX_OK;
	
	pGC = GetGC( );
	//PenIrptDisable(  );
	switch ( message )
	{
		case WM_PENUP:
			ActiveListPush(  );
			if ( Lbox_show( p_str ) != ASIX_OK )	
			{
				ActiveListPop(  );
				//PenIrptEnable(  );
				p_str->pop_status = POP_HIDE;
				return ASIX_ERROR;
			}
//			p_str->pop_status = POP_SHOW; //has been done in function Lbox_show.By zl 2002.3.13
			break;
		case WM_PENDRAG:
		case WM_PENDOWN:
		case WM_PENDRAGUP:
//			InvRec( pGC, p_str->x, p_str->y, p_str->width - SCROLL_WIDTH, p_str->height ); by zl 2002.3.13
			InvRec( pGC, p_str->x + 1, p_str->y + 1, p_str->width - SCROLL_WIDTH - 2, p_str->height - 2 );//here subtracts "2" and adds "1" because we invert the area inside the board. By zl 2002.3.13
			break;	
	}
	return ASIX_OK;
}
	

/******************************************************/	
/****点击mask******************************************/
static	STATUS Lbox_touch_mask( struct LBOX_STRUCTURE * p_str, U16 message )	
{
	U32		pGC;

	pGC = GetGC( );

	if ( p_str->lbox_style != LBS_POPUP )	return ASIX_ERROR;
	
	switch ( message )
	{
		case WM_PENUP:
//			InvRec( pGC, p_str->x, p_str->y, p_str->width-SCROLL_WIDTH, p_str->height);//by zl 2002.3.13
			InvRec( pGC, p_str->x + 1, p_str->y + 1, p_str->width - SCROLL_WIDTH - 2, p_str->height - 2);//here subtracts "2" and adds "1" because we invert the area inside the board. By zl 2002.3.13
			Lbox_hide( p_str );
			p_str->pop_status = POP_HIDE;
			ActiveListPop(  );
			break;
		case WM_PENDOWN:
		case WM_PENDRAG:
		case WM_PENDRAGUP:
			break;
	}
	return ASIX_OK;
}	 
	
	
/*********************************************************/
/*****点击up************************************************/
static STATUS	Lbox_touch_up( struct LBOX_STRUCTURE * p_str, U16 message )
{
	struct LBOX_ITEM * 		 	p_input;
	MSG							lbox_msg;
//	char 						dispbuf[ITEMTEXT_MAX];//dispbuf[11]; //by zl 2002.3.13
	char	*						dispbuf;
	U32							pGC;
	U16							arrow_upfrom;//by zl 2002.4.1
	
	
	if ( p_str->lbox_style != LBS_ROLL )	return ASIX_ERROR;
	if ((S16)p_str->offset == 0) return ASIX_ERROR;
	if ((dispbuf = (char *)Lmalloc( p_str->maxlength )) == NULL)	return ASIX_ERROR;//by zl 2002.3.28
	
	pGC = GetGC( );
	arrow_upfrom = (p_str->height - ARROW_WIDTH)/2;

	switch ( message )
	{
		case WM_PENUP:
			p_str->offset--; 
			p_input = p_str->lbox_item + p_str->offset;
//			InvRec( pGC, p_str->x+p_str->width-2*SCROLL_WIDTH, p_str->y, SCROLL_WIDTH, p_str->height );//by zl 2002.3.13
			InvRec( pGC, p_str->x + p_str->width - 2 * SCROLL_WIDTH , p_str->y + 1, SCROLL_WIDTH - 1, p_str->height  - 2);//here subtracts "2" and adds "1" or "2" because we invert the area inside the board. By zl 2002.3.13
			while ( ((S16)p_str->offset > 0) && (p_input->item_status == ICON_DISABLE) )//while ( (p_str->offset > 0) && (p_input->item_status == ICON_DISABLE) )//by zl 20002.3.13
			{
				--p_str->offset;
				p_input--;
			}
			if ( p_str->offset == 0 )
			{
				(p_str->lbox_up).icon_status = ICON_DISABLE;
//				Advswitchonetotwo( up, p_str->x+p_str->width-2*SCROLL_WIDTH+5, p_str->y+5, 
//					10, 10, BLACK_TO_GREY, WHITE_TO_WHITE);				
//				DrawMonoImage( pGC, up, p_str->x+p_str->width-2*SCROLL_WIDTH+5, p_str->y+5, 10, 10, GPC_BLACK, GPC_WHITE);	//by zl 2002.3.13
//				DrawMonoImage( pGC, up7x7, p_str->x + p_str->width - 2 * SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + ARROW_UP_FROM, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_disablecolor, ColorTheme.form_backcolor);				//by zl 2002.4.2
//				DrawMonoImage( pGC, up7x7, p_str->x + p_str->width - 2 * SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + arrow_upfrom, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_disablecolor, ColorTheme.form_backcolor);				
				{
					U32	hbmp;
					//U32	trColor;
					U16 lx = p_str->x + p_str->width - 2 * SCROLL_WIDTH + ARROW_LEFT_FROM - 1;
					U16 ly = p_str->y + arrow_upfrom - 1;
					U32 palette[2];
					
					palette[0] = ColorTheme.form_client;
					palette[1] = ColorTheme.form_disablecolor;

					hbmp = LoadBitmap( up7x7, palette );
					if( hbmp != 0 )
					{
						//SetBMPPalette( hbmp, palette, NULL );
						//SetBkFillMode( pGC, MAKELONG( GPC_REPLACE_STYLE, GPC_TRANSPARENT_STYLE ) );
						//GetBMPPixel( pGC, 0, 0, hbmp, &trColor );
						//DisplayBMPEx( pGC, x, y, hbmp, GPC_TRANSPARENT_STYLE, trColor );
						DisplayBMP( pGC, lx, ly, hbmp );
						FreeBitmap( hbmp );
					}
				}
				if ( p_input->item_status == ICON_ENABLE )
				{
//					ClearRec( pGC, GPC_WHITE, p_str->x+1, p_str->y+1, p_str->width-2*SCROLL_WIDTH-1, p_str->height-1, GPC_REPLACE_STYLE );//by zl 2002.3.13
					ClearRec( pGC, ColorTheme.form_backcolor, p_str->x+1, p_str->y+1, p_str->width-2*SCROLL_WIDTH -2, p_str->height -2, GPC_REPLACE_STYLE );//here subtracts "2" and adds "1" because we invert the area inside the board. By zl 2002.3.13

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -