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

📄 asix_lb.c

📁 基于东南大学开发的SEP3203的ARM7中的所有驱动
💻 C
📖 第 1 页 / 共 5 页
字号:

					Lbox_cutstring( p_input->item_text, p_str->maxlength, dispbuf );//Lbox_cutstring( p_input->item_text, 6, dispbuf ); by zl 2002.3.13
					//Disp16String( dispbuf, p_str->x+MARGIN, p_str->y+ITEMTEXT_UP_FROM);//Disp16String( dispbuf, p_str->x+MARGIN, p_str->y+2); by zl 2002.3.13
					{
						U16	strX, strY;

						strX = AlignString( dispbuf, p_str->x + MARGIN, p_str->width -SCROLL_WIDTH-MARGIN*2, GPC_ALIGN_CENTER );
						strY = p_str->y + ITEMTEXT_UP_FROM;
						TextOut( pGC, dispbuf, strX, strY, NULL, ColorTheme.form_poptext, GPC_REPLACE_STYLE );
					}

					(p_str->lbox_down).icon_status = ICON_ENABLE;
//					switchonetotwo( down, p_str->x+p_str->width-SCROLL_WIDTH+5, p_str->y+5, 10, 10);
//					DrawMonoImage( pGC, down, p_str->x+p_str->width-SCROLL_WIDTH+5, p_str->y+5, 10, 10, GPC_BLACK, GPC_WHITE);//by zl 2002.3.13
//					DrawMonoImage( pGC, down7x7, p_str->x + p_str->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + ARROW_UP_FROM - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);//by zl 2002.4.2
//					DrawMonoImage( pGC, down7x7, p_str->x + p_str->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + arrow_upfrom - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);
					{
						U32	hbmp;
						//U32	trColor;
						U16 lx = p_str->x + p_str->width - 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_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 );
						}
					}

					memset( (void *)&lbox_msg, 0x0, sizeof(MSG) );
					lbox_msg.messageType = ASIX_MESSAGE;
					lbox_msg.message = WM_LISTBOX;
					lbox_msg.lparam = p_str->windowid;
					lbox_msg.data = NULL;
					lbox_msg.wparam = p_str->offset;
					AdvSendMessage( GetCurTask()->id, (P_MESSAGE)&lbox_msg, NO_SWAP_TASK );				
				}
			}
			else 
			{
//				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
				Lbox_cutstring( p_input->item_text, p_str->maxlength, dispbuf );//Lbox_cutstring( p_input->item_text, 6, dispbuf );by zl 2002.3.13
				//Disp16String( dispbuf, p_str->x+MARGIN, p_str->y+ITEMTEXT_UP_FROM);//Disp16String( dispbuf, p_str->x+MARGIN, p_str->y+2); by zl 2002.3.13
				{
					U16	strX, strY;

					strX = AlignString( dispbuf, p_str->x + MARGIN, p_str->width -SCROLL_WIDTH-MARGIN*2, GPC_ALIGN_CENTER );
					strY = p_str->y + ITEMTEXT_UP_FROM;
					TextOut( pGC, dispbuf, strX, strY, NULL, ColorTheme.form_poptext, GPC_REPLACE_STYLE );
				}
				(p_str->lbox_down).icon_status = ICON_ENABLE;
//				switchonetotwo( down, p_str->x+p_str->width-SCROLL_WIDTH+5, p_str->y+5, 10, 10);
//				DrawMonoImage( pGC, down, p_str->x+p_str->width-SCROLL_WIDTH+5, p_str->y+5, 10, 10, GPC_BLACK, GPC_WHITE);//by zl 2002.3.13
//				DrawMonoImage( pGC, down7x7, p_str->x + p_str->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + ARROW_UP_FROM - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);//by zl 2002.4.2
//				DrawMonoImage( pGC, down7x7, p_str->x + p_str->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + arrow_upfrom - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, ColorTheme.form_backcolor);
				{
					U32	hbmp;
					//U32	trColor;
					U16 lx = p_str->x + p_str->width - 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_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 );
					}
				}

				memset( (void *)&lbox_msg, 0x0, sizeof(MSG) );
				lbox_msg.messageType = ASIX_MESSAGE;
				lbox_msg.message = WM_LISTBOX;
				lbox_msg.lparam = p_str->windowid;
				lbox_msg.data = NULL;
				lbox_msg.wparam = p_str->offset;
				AdvSendMessage( GetCurTask()->id, (P_MESSAGE)&lbox_msg, NO_SWAP_TASK );					
			}
			break;
		case WM_PENDOWN:
		case WM_PENDRAG:
		case WM_PENDRAGUP:
//			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);
			break;	
	}
	Lfree( (void *)dispbuf);

	return ASIX_OK;		 	
}



/**************************************************************************/
/***点击down****************************************************************/
static	STATUS	Lbox_touch_down( 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.2

	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;
	
	if ( p_str->lbox_style == LBS_ROLL )
	{
		switch ( message )
		{
			case WM_PENUP:
				p_str->offset++;//by zl 2002.3.13
				p_input = p_str->lbox_item+p_str->offset;
//				InvRec( pGC, p_str->x+p_str->width-SCROLL_WIDTH, p_str->y, SCROLL_WIDTH, p_str->height );//by zl 2002.3.13
				InvRec( pGC, p_str->x + p_str->width - SCROLL_WIDTH , p_str->y + 1, SCROLL_WIDTH - 1, p_str->height - 2 );//here subtracts "2" and adds "1" because we invert the area inside the board. By zl 2002.3.13
				while ( (p_str->offset < p_str->total_line -1) && (p_input->item_status == ICON_DISABLE) )
				{
					++p_str->offset;
					p_input++;
				}
				if ( p_str->offset == p_str->total_line -1 )
				{
					(p_str->lbox_down).icon_status = ICON_DISABLE;
//					Advswitchonetotwo( down, p_str->x+p_str->width-SCROLL_WIDTH+5, p_str->y+5, 10, 10, 
//						BLACK_TO_GREY, WHITE_TO_WHITE);				
//					DrawMonoImage( pGC, down, p_str->x+p_str->width-SCROLL_WIDTH+5, p_str->y+5, 10, 10, GPC_BLACK, GPC_WHITE);				//by zl 2002.3.13
//					DrawMonoImage( pGC, down7x7, p_str->x + p_str->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + ARROW_UP_FROM - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_disablecolor, ColorTheme.form_backcolor);				//by zl 2002.4.2
//					DrawMonoImage( pGC, down7x7, p_str->x + p_str->width - SCROLL_WIDTH + ARROW_LEFT_FROM - 1, p_str->y + arrow_upfrom - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_disablecolor, ColorTheme.form_backcolor);				
					{
						U32	hbmp;
						//U32	trColor;
						U16 lx = p_str->x + p_str->width - 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( 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 );
						}
					}
					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
						Lbox_cutstring( p_input->item_text, p_str->maxlength, dispbuf );//Lbox_cutstring( p_input->item_text, 6, dispbuf ); //by zl 2002.3.13
						//Disp16String( dispbuf, p_str->x + MARGIN, p_str->y + ITEMTEXT_UP_FROM);//Disp16String( dispbuf, p_str->x+MARGIN, p_str->y+2);//by zl 2002.3.13
						{
							U16	strX, strY;

							strX = AlignString( dispbuf, p_str->x + MARGIN, p_str->width -SCROLL_WIDTH-MARGIN*2, GPC_ALIGN_CENTER );
							strY = p_str->y + ITEMTEXT_UP_FROM;
							TextOut( pGC, dispbuf, strX, strY, NULL, ColorTheme.form_poptext, GPC_REPLACE_STYLE );
						}
						(p_str->lbox_up).icon_status = ICON_ENABLE;
//						switchonetotwo( up, p_str->x+p_str->width-2*SCROLL_WIDTH+5, p_str->y+5, 10, 10);
//						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 - 1,	ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, 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 - 1, ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, 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_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 );
							}
						}

						memset( (void *)&lbox_msg, 0x0, sizeof(MSG) );
						lbox_msg.messageType = ASIX_MESSAGE;
						lbox_msg.message = WM_LISTBOX;
						lbox_msg.lparam = p_str->windowid;
						lbox_msg.data = NULL;
						lbox_msg.wparam = p_str->offset;
						AdvSendMessage( GetCurTask()->id, (P_MESSAGE)&lbox_msg, NO_SWAP_TASK );					
					}
				} 
				else
				{
//					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
					Lbox_cutstring( p_input->item_text, p_str->maxlength, dispbuf );//Lbox_cutstring( p_input->item_text, 6, dispbuf );//by zl 2002.3.13
					//Disp16String( dispbuf, p_str->x + MARGIN, p_str->y + ITEMTEXT_UP_FROM);//Disp16String( dispbuf, p_str->x+MARGIN, p_str->y+2);//by zl 2002.3.13
					{
						U16	strX, strY;

						strX = AlignString( dispbuf, p_str->x + MARGIN, p_str->width -SCROLL_WIDTH-MARGIN*2, GPC_ALIGN_CENTER );
						strY = p_str->y + ITEMTEXT_UP_FROM;
						TextOut( pGC, dispbuf, strX, strY, NULL, ColorTheme.form_poptext, GPC_REPLACE_STYLE );
					}
					(p_str->lbox_up).icon_status = ICON_ENABLE;
//					switchonetotwo( up, p_str->x+p_str->width-2*SCROLL_WIDTH+5,	p_str->y+5, 10, 10);
//					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 - 1,	ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, 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 - 1,ARROW_WIDTH, ARROW_HEIGHT, ColorTheme.form_frontcolor, 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_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 );
						}
					}

					memset( (void *)&lbox_msg, 0x0, sizeof(MSG) );
					lbox_msg.messageType = ASIX_MESSAGE;
					lbox_msg.message = WM_LISTBOX;
					lbox_msg.lparam = p_str->windowid;
					lbox_msg.data = NULL;
					lbox_msg.wparam = p_str->offset;
					AdvSendMessage( GetCurTask()->id, (P_MESSAGE)&lbox_msg, NO_SWAP_TASK );				
				}
				break;
			case WM_PENDOWN:
			case WM_PENDRAG:
			case WM_PENDRAGUP:
//				InvRec( pGC, p_str->x+p_str->width-SCROLL_WIDTH, p_str->y, SCROLL_WIDTH, p_str->height );	//by zl 2002.3.13
				InvRec( pGC, p_str->x + p_str->width - SCROLL_WIDTH , p_str->y + 1, SCROLL_WIDTH - 1, p_str->height - 2 );	//here subtracts "2" and adds "1" because we invert the area inside the board. By zl 2002.3.13
				break;
		}
	}
	
	if ( p_str->lbox_style == LBS_POPUP )
	{
		switch ( message )
		{
			case WM_PENUP:
//				InvRec( pGC, p_str->x + p_str->width - SCROLL_WIDTH, p_str->y, SCROLL_WIDTH, p_str->height );//by zl 2002.3.13
				InvRec( pGC, p_str->x + p_str->width - SCROLL_WIDTH, p_str->y + 1, SCROLL_WIDTH - 1, p_str->height - 2 );//here subtracts "2" and adds "1" because we invert the area inside the board. By zl 2002.3.13
//				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
				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;
				break;				
			case WM_PENDOWN:
			case WM_PENDRAG:
			case WM_PENDRAGUP:
//				InvRec( pGC, p_str->x+p_str->width-SCROLL_WIDTH, p_str->y, SCROLL_WIDTH, p_str->height );//by zl 2002.3.13
				InvRec( pGC, p_str->x + p_str->width - SCROLL_WIDTH, p_str->y , SCROLL_WIDTH - 1, p_str->height );//here subtracts "2" and adds "1" because we invert the area inside th

⌨️ 快捷键说明

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