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

📄 win_locguidemanage.c

📁 这是一个linux下基于MiniGUI的手机界面设计源码
💻 C
字号:
/*win_locGuideManage.c*//***	COMPANY NAME:	国星**	FILE    NAME:	win_locGuideManage.c**	FILE	PATH:	Interface/win_locGuideManage.c**	WINDOWS NAME:	路标管理**	WINDOWS PATH:	定位 /  单次定位(连续定位)(紧急定位)/路标管理**	OTHER INFORMATION;	无**	CREATER	NAME:	LiWencheng,JiangYuanqing**	MENDER	NAME:	JiangYuanqing,LiWencheng**	CHANGE  TIME:	11/14/2007 */#include "sysSrcInfo.h"#define SIID_GUIDECHANGE  4601#define SIID_DELETEGUIDE  4611#define SIID_SAVECHANGE  4621#define SIID_CANCELCHANGE  4631static int flagGuideManage;//flagSetGuide=1 return单次定位,//flagSetGuide=2 return连续定位,// flagSetGuide=3 return紧急定位 // flagSetGuide=4 return设为路标 static BITMAP bmp_locGuideManage;		//缓存中间状态栏图片static HWND hWndCombox;static HWND guideName;static HWND guideNote;static HWND listBoxGM;static int locGuideCount;				//路标总行数static int chatch[100];//对应总表的行/* 位图数组 */static const char *bmp_name_locGuideManage[] = {"./Pictures/b_windowsbackground_1.PNG",			"./Pictures/c_changeGuide.PNG","./Pictures/c_deleteGuide.PNG",				"./Pictures/return.PNG",			"./Pictures/c_saveChange.PNG","./Pictures/c_cancelChange.PNG"			};/* 定义皮肤元素数组 *///三个button 为左中右,并不表示它就一定指OK或MENUstatic skin_item_t skin_items_locGuideManage [] ={{SIID_GUIDECHANGE,   SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,     BUTTONLEFT_X,   BUTTON_Y, {},   1 ,"" },{SIID_DELETEGUIDE,   SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,     BUTTONCENTER_X, BUTTON_Y, {},   2, "" },{SIID_RETURN,        SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,     BUTTONRIGHT_X,  BUTTON_Y, {},   3, "" },{SIID_SAVECHANGE ,   SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,     BUTTONLEFT_X,   BUTTON_Y, {},   4 ,"" },{SIID_CANCELCHANGE,  SI_TYPE_CHKBUTTON   | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE,     BUTTONRIGHT_X,  BUTTON_Y, {},   5, "" }};/* 定义皮肤 */static skin_head_t skin_locGuideManage ={    "main",  //const BITMAP* bmps;    SKIN_STYLE_TOOLTIP, NULL, NULL,     0, 5, skin_items_locGuideManage, FALSE /** The number of the items in this skin. */  /* 定义皮肤元素数组 */ //注意上面数组的大小变了,则8变成多少};static void showthecontrols(int WS_type ){               ShowWindow ( hWndCombox, WS_type );            ShowWindow ( guideName, WS_type );            ShowWindow ( guideNote, WS_type );}static void show_locGuideManage(){				int sel ;       		SetWindowText (guideName,locGuideGatas[sel].guidename );//显示       		SetWindowText (guideNote,locGuideGatas[sel].locnote );//显示}static int openTheFile(char name[20]){	FILE *fp;	int i;	if((fp=fopen("./DataBase/locGuideGata.data","r"))==NULL)	{		printf("can not open file.");		exit(0);	}	for(i=0;fread(&locGuideGatas[i],sizeof(struct locguide),1,fp)!=0;i++);	fclose(fp);	return i ;//	}static void changebuttons(int type)//show guidechange and return  type==TRUE;{	int type1;	if(type==TRUE)	{		type1=FALSE;	}	else	{		type1=TRUE;	}			skin_enable_item (&skin_locGuideManage,SIID_GUIDECHANGE,type);                        skin_show_item (&skin_locGuideManage,SIID_GUIDECHANGE,type);			skin_enable_item (&skin_locGuideManage,SIID_RETURN,type);                        skin_show_item (&skin_locGuideManage,SIID_RETURN,type);			skin_enable_item (&skin_locGuideManage,SIID_CANCELCHANGE,type1);                        skin_show_item (&skin_locGuideManage,SIID_CANCELCHANGE,type1);			skin_enable_item (&skin_locGuideManage,SIID_SAVECHANGE,type1);                        skin_show_item (&skin_locGuideManage,SIID_SAVECHANGE,type1);}static int main_event_cb_locGuideManage (HWND hwnd, skin_item_t* item, int event, void* data){    if (event == SIE_BUTTON_CLICKED) {     switch (item->id) {  //按的那个图片			case SIID_GUIDECHANGE:	//send			changebuttons(FALSE);printf("main_event_cb_locGuideManage\n");            	break;//case SIID_OK:		case SIID_DELETEGUIDE:	//send				showthecontrols(SW_HIDE);			win_locAlarm(hWndMainlocGuideManage);printf("case SIID_DELETEGUIDE:\n");            	break;//case SIID_OK:		case SIID_SAVECHANGE :	//send			changebuttons(TRUE);printf("case SIID_SAVECHANGE:\n");            	break;//case SIID_OK:		case SIID_CANCELCHANGE:	//send			changebuttons(TRUE);printf("case SIID_CANCELCHANGE:\n");            	break;//case SIID_OK:                    case SIID_RETURN://right                      				LoadSkinBmps( &skin_locGuideManage, FALSE ,bmp_name_locGuideManage ,(sizeof (bmp_name_locGuideManage))/sizeof(char *) );						ShowWindow ( hWndMainlocGuideManage, SW_HIDE);						UnloadBitmap(  &bmp_locGuideManage );					if (flagGuideManage == 4 )					{						win_locSetGuide (hWndMain , -1);					}					else					{						win_locSetGuide (hWndMain ,flagGuideManage);					}			            break;        }    }    return 1;}static void SetNameAndNote (){		int index = SendMessage (listBoxGM, LB_GETCURSEL , 0 , 0);		int i;		i = chatch[index];		SetWindowText (guideName,locGuideGatas[i].guidename );		SetWindowText (guideNote,locGuideGatas[i].locnote );		printf("i ==== %d  ----index ==%d\n",i,index);}/*static void init_window_locGuideManage(HWND hwnd){        IVITEMINFO ivii;	int i,j;	int locGuideCount;	char stringbuff[80];	locGuideCount = openTheFile("locGuideGata.data");printf("win_locGuideManage.cinit_window(HWND hwnd)11111111111111111111111111\n");	  hIV_child_locGuideManage =  CreateWindow (CTRL_ICONVIEW,"myiconview",WS_CHILD | WS_VISIBLE  		//	|WS_VSCROLL |WS_HSCROLL ,756,0,17,160,160,hwnd,1);			 |WS_VSCROLL|WS_HSCROLL ,759,0,90,160,50,hwnd,1);	                    SetWindowBkColor (hIV_child_locGuideManage,PIXEL_lightwhite);                    //SendMessage (hIV_child_locGuideManage, IVM_SETITEMDRAW, 0, (LPARAM)myDrawItem);///                    //SendMessage (hIV_child_locGuideManage, IVM_SETITEMSIZE, 138.5, 20);                    SendMessage (hIV_child_locGuideManage, IVM_SETITEMSIZE, 150, 18);                    //SendMessage (hIV_child_locGuideManage, IVM_SETITEMSIZE, 207, 20);                    for (i = 0; i < locGuideCount; i++) {                        memset (&ivii, 0, sizeof(IVITEMINFO));                        ivii.bmp = NULL;                        ivii.nItem =  i;printf("win_locGuideManage.cinit_window      i=%d\n",i);		    sprintf(stringbuff,"%s %s %s %s %s",locGuideGatas[i].guidename, 			locGuideGatas[i].loclatitude, locGuideGatas[i].loclongitude, 			locGuideGatas[i].loc_hight, locGuideGatas[i].time );//printf("locGuideGata[i].locaddname-----%s\n",locGuideGata[i].locaddname);			ivii.label=stringbuff;printf("win_locGuideManage init_window_locGuideManage==%s\n",locGuideGatas[i].guidename);printf("win_locGuideManage init_window_locGuideManage==%s\n",locGuideGatas[i].loclongitude);printf("win_locGuideManage init_window_locGuideManage==%s\n",locGuideGatas[i].time);                         ivii.addData = i;                        SendMessage (hIV_child_locGuideManage, IVM_ADDITEM, 0, (LPARAM)&ivii);                    }                    SendMessage(hIV_child_locGuideManage,IVM_SELECTITEM,0,0);                    SendMessage(hIV_child_locGuideManage,IVM_SETCURSEL,0,0);}*/static void FillListbox (){	int i ,j=0;	char buff[20];		char guideString[200];	int index = SendMessage (hWndCombox, CB_GETCURSEL , 0 , 0);	SendMessage (hWndCombox, CB_GETLBTEXT , index , (LPARAM)buff);	SendMessage (listBoxGM, LB_RESETCONTENT , 0,(LPARAM)0);//清空	for (i = 0;i<locGuideCount;i++)	{			if ( strcmp (buff,locGuideGatas[i] .sortNO) == 0)			{						ConnGuideInfo (locGuideGatas[i] , guideString);					//用附加数据i与listbox里j对应,才能准确显示当前选中的信息					//SendMessage (listBoxGM, LB_SETCURSEL ,k , 0);					//SendMessage (listBoxGM, LB_SETITEMADDDATA, (LPARAM)j, (DWORD)i);					SendMessage (listBoxGM , LB_ADDSTRING, 0, (LPARAM)guideString);					// k= (int)SendMessage (listBoxGM, LB_GETITEMADDDATA, n, 0);										chatch[j] = i;					j++; 			}			}}static void FillhWndCombox (){	int i,index;	for (i = 0;i<locGuideCount;i++)	{	//找出不重复的分类号		index = SendMessage (hWndCombox ,CB_FINDSTRINGEXACT,0,(LPARAM)locGuideGatas[i].sortNO);		if (index <=0)		SendMessage (hWndCombox, CB_ADDSTRING, 0, (LPARAM)locGuideGatas[i].sortNO);//(LPARAM)	}}static void listBoxGMinfo (HWND hwnd ,int id, int nc, DWORD add_data){	if (nc == CBN_SELCHANGE)	{			SetNameAndNote ();	}	}static void hWndComboxInfo (HWND hwnd ,int id, int nc, DWORD add_data){	if (nc == CBN_SELCHANGE)	{			FillListbox ();			SendMessage (listBoxGM, LB_SETCURSEL , 0 , 0);			SetNameAndNote ();	}	}static int msg_event_cb_locGuideManage (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result){	HDC hdc;	HDC hdc1;	IVITEMINFO ivii_child;        switch (message) {        	case MSG_CREATE:				LoadBitmap (HDC_SCREEN, &bmp_locGuideManage, "Pictures/system.PNG");				locGuideCount = openTheFile("locGuideGata.data");			changebuttons(TRUE);			                   hWndCombox = CreateWindow( CTRL_COMBOBOX,                           "", WS_CHILD | WS_VISIBLE | CBS_EDITNOBORDER|//WS_BORDER|//							CBS_READONLY|CBS_SPINARROW_LEFTRIGHT |CBS_SORT|CBS_SPINLIST| CBS_NOTIFY,                           2343,70, 22,90 , 18, hwnd, 0);              	gal_pixel pixel = RGB2Pixel (HDC_SCREEN, 0xFF, 0xFF, 0xFF);     	       	SetWindowBkColor (hWndCombox, pixel);				SetNotificationCallback (hWndCombox, hWndComboxInfo );				FillhWndCombox ();				SendMessage (hWndCombox, CB_SETCURSEL , 0 , 0); 		       guideName = CreateWindow( CTRL_SLEDIT,                             "",                           //WS_VISIBLE  | ES_TIP| WS_BORDER  ,// | ES_AUTOWRAP,			    WS_VISIBLE  | WS_CHILD | WS_BORDER ,//|ES_READONLY ,// | ES_AUTOWRAP,                           622,                           70, 42, 90 , 18, hwnd, 0); 		       guideNote = CreateWindow( CTRL_SLEDIT,                            "",                           //WS_VISIBLE  | ES_TIP| WS_BORDER  ,// | ES_AUTOWRAP,			    WS_VISIBLE  | WS_CHILD | WS_BORDER ,//|ES_READONLY ,// | ES_AUTOWRAP,                           623,                           70 , 62,90 , 18, hwnd, 0);				listBoxGM = CreateWindow( CTRL_LISTBOX ,						NULL,						WS_VISIBLE | WS_HSCROLL| WS_VSCROLL | WS_BORDER | LBS_NOTIFY,//| LBS_SORT                            			2355,  0,90, 160, 55, hwnd, 0);				SetNotificationCallback (listBoxGM, listBoxGMinfo );     			FillListbox ( );     			SetNameAndNote ();	        break;	  case MSG_PAINT :				  hdc=BeginPaint (hwnd);               				SetBkMode (hdc, BM_TRANSPARENT); 		  		FillBoxWithBitmap (hdc, ZTL_PIC_X,ZTL_PIC_Y, ZTL_PIC_W,ZTL_PIC_H, &bmp_locGuideManage);				TextOut (hdc, WZ_ZTL_X4, WZ_ZTL_Y, "路标管理" );                  TextOut (hdc,3, 20, "分组号");                  TextOut (hdc,3, 40, "路标名");                  TextOut (hdc,3, 60, "注释");          EndPaint (hwnd,hdc);	      break;    }        return 1;}void win_locGuideManage(HWND hwndmain ,int flag){    	MSG msg;    	flagGuideManage = flag;		LoadSkinBmps( &skin_locGuideManage, TRUE ,bmp_name_locGuideManage ,(sizeof (bmp_name_locGuideManage))/sizeof(char *) );        if (skin_locGuideManage.bmps == NULL) {      	  	printf ("Could not load skin bitmaps!\n");        }	if ( !skin_init (&skin_locGuideManage, main_event_cb_locGuideManage, msg_event_cb_locGuideManage) ){    /* 初始化皮肤 */        	printf ("skin init fail!\n\n");    	}    	else{	 	    hWndMainlocGuideManage=  create_skin_control (&skin_locGuideManage, hwndmain,143, DEF_X_, DEF_Y_,                               DEF_WIDTH, DEF_HEIGHT);		currShowWindowHwnd = hWndMainlocGuideManage;         }}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif

⌨️ 快捷键说明

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