📄 win_information.c~
字号:
/*win_information.c*//*** COMPANY NAME: 国星** FILE NAME: win_information.c** FILE PATH: Interface/win_information.c** WINDOWS NAME: 通信** WINDOWS PATH: 通信** OTHER INFORMATION; 无** CREATER NAME: LiWencheng,JiangYuanqing** MENDER NAME: LiWencheng,JiangYuanqing** CHANGE TIME: 11/14/2007 */#include "sysSrcInfo.h"static char buff [10];static int n=6;static int flagInfo=0; //static HWND hIV_menu_information; //menu句柄static BITMAP icon_bitmap_information[9]; //缓存中间 ICONVIEW 控件图片static BITMAP bmp_information; //缓存中间状态栏图片/* 位图数组 */static const char *icon_files_information[] ={ "Pictures/a_information_1.PNG", "Pictures/a_information_2.PNG", "Pictures/a_information_3.PNG", "Pictures/a_information_4.PNG", "Pictures/a_information_5.PNG", "Pictures/a_information_6.PNG", "Pictures/a_information_7.PNG", "Pictures/a_information_8.PNG", "Pictures/a_information_9.PNG"};static const char *iconlabels[] ={ "0/0", "0", "0", "0", "", "", "", "", ""};static const char *bmp_name_information[] = { "./Pictures/b_windowsbackground_1.PNG", //第一张来做主界面 "./Pictures/OK.PNG", "./Pictures/menu.PNG", "./Pictures/b_cancel_0.PNG", "./Pictures/return.PNG" };static const char *labInfo[] = { "收件箱", "发件箱", "草稿箱", "地址簿", "新建电文", "通信查询", "收发状态", "电文查阅", "略图绘制",};static const char *icon_labels_information[] = { "1 收件箱", "2 发件箱", "3 草稿箱", "4 地址簿", "5 新建电文", "6 通信查询", "7 收发状态", "8 电文查阅", "9 略图绘制", "0 回主界面" };/* 定义皮肤元素数组 *///三个button 为左中右,并不表示它就一定指OK或MENUstatic skin_item_t skin_items_information [] ={{SIID_OK, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE, BUTTONLEFT_X, BUTTON_Y, {}, 1 ,"" },{SIID_MENU, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE, BUTTONCENTER_X, BUTTON_Y, {}, 2, "" },{SIID_CANCEL, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE, BUTTONRIGHT_X, BUTTON_Y, {}, 3, "" },{SIID_RETURN, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE, BUTTONRIGHT_X, BUTTON_Y, {}, 4, "" }};/* 定义皮肤 */skin_head_t skin_information ={ "main", //const BITMAP* bmps; SKIN_STYLE_TOOLTIP, NULL, NULL, 0, 4, skin_items_information, FALSE /** The number of the items in this skin. */ /* 定义皮肤元素数组 */ //注意上面数组的大小变了,则8变成多少}; static int CloseTheWindow_info(){ int i; ShowWindow ( hWndMaininfo, SW_HIDE); ShowWindow ( hIV_menu_information, SW_HIDE); LoadSkinBmps( &skin_information, FALSE ,bmp_name_information , (sizeof (bmp_name_information))/sizeof(char *) ); for(i=0;i<9;i++) { UnloadBitmap( &(icon_bitmap_information[i]) ); } UnloadBitmap( &bmp_information ); return 1;//关闭成功返回true }static void ShowMenu_info( int true){ if(true==TRUE) { SendMessage( hIV_child_information, WS_DISABLED,0,0); EnableWindow( hIV_child_information,FALSE); SendMessage( hIV_child_information, WS_DISABLED,0,0); ///// ShowWindow(hIV_menu_information,SW_SHOW); EnableWindow( hIV_menu_information,TRUE); SetFocusChild( hIV_menu_information ); SendMessage(hIV_menu_information,IVM_SELECTITEM,0,0); SendMessage(hIV_menu_information,IVM_SETCURSEL,0,0); } else { SendMessage ( hIV_menu_information, WS_DISABLED,0,0); EnableWindow ( hIV_menu_information, FALSE); SendMessage ( hIV_menu_information, WS_DISABLED,0,0); ShowWindow ( hIV_menu_information, SW_HIDE); ///// EnableWindow ( hIV_child_information,TRUE); SetFocusChild( hIV_child_information ); SendMessage ( hIV_child_information, IVM_SELECTITEM, 0, 0); SendMessage ( hIV_child_information ,IVM_SETCURSEL, 0, 0); } } static void ShowReturnPic_info( int true){ int false; if(true==TRUE){false=FALSE;}else{false=TRUE;} skin_enable_item (&skin_information,SIID_CANCEL,false); skin_show_item (&skin_information,SIID_CANCEL,false); skin_enable_item (&skin_information,SIID_RETURN,true); skin_show_item (&skin_information,SIID_RETURN,true);}static void myDrawItem (HWND hWnd, GHANDLE hsvi, HDC hdc, RECT *rcDraw){ const PBITMAP pbmp = (PBITMAP)iconview_get_item_bitmap (hsvi); const char *label = (const char*)iconview_get_item_label (hsvi); SetBkMode (hdc, BM_TRANSPARENT); SetTextColor (hdc, PIXEL_black); if (iconview_is_item_hilight(hWnd, hsvi)) { SetBrushColor (hdc, PIXEL_blue); } else { SetBrushColor (hdc, PIXEL_lightwhite); } FillBox (hdc, rcDraw->left, rcDraw->top, RECTWP(rcDraw), RECTHP(rcDraw));//select state SetBkColor (hdc, PIXEL_red); if (label) { RECT rcTxt = *rcDraw;// rcTxt.top = rcTxt.bottom - GetWindowFont (hWnd)->size * 2; rcTxt.top = rcTxt.bottom - (GetWindowFont (hWnd)->size) *1.1; rcTxt.left = rcTxt.left - (GetWindowFont (hWnd)->size) + 115; DrawText (hdc, label, -1, &rcTxt, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } FillBoxWithBitmap (hdc, rcDraw->left, rcDraw->top, 0, 0, pbmp);//fill pic}static void GoOtherWindows (int flag){ switch (flag){ case 0 ://"1 收件箱",//get box win_InfoInbox(hWndMain ); CloseTheWindow_info(); break; case 1 ://"2 发件箱",//send box if (win_InfoOutbox( hWndMain )) { CloseTheWindow_info(); } // win_InfoOutbox(hWndMaininfo ,0 ); break; case 2 : //"3 草稿箱",//draft box win_InfoDraftbox(hWndMain ); CloseTheWindow_info(); break; case 3 : //"4 地址簿", // if (win_InfoAddrbook(hWndMain ,0)) { CloseTheWindow_info(); } //ShowWindow(hIconView,SW_SHOW); break; case 4 : //"5 新建电文",// CloseTheWindow_info(); if (win_InfoCreat( hWndMain , 0, 0)) { //CloseTheWindow_info(); } break; case 5 : //"6 通信查询", // win_InfoQuery( hWndMain ); CloseTheWindow_info(); break; /* case 6 : //"7 收发状态",// ShowWindow ( hIV_menu_information, SW_HIDE); ShowWindow(hIV_child_information,SW_HIDE); win_tools ( hWndMain ); //ShowWindow(hIconView,SW_SHOW); break; case 7 : //"8 电文查阅", // ShowWindow ( hIV_menu_information, SW_HIDE); ShowWindow(hIV_child_information,SW_HIDE); win_system( hWndMain ); //ShowWindow(hIconView,SW_SHOW); break; case 8 : //"9 略图绘制",// ShowWindow ( hIV_menu_information, SW_HIDE); ShowWindow(hIV_child_information,SW_HIDE); win_help( hWndMain ); //ShowWindow(hIconView,SW_SHOW); break;*/ }}static int main_event_cb_information (HWND hwnd, skin_item_t* item, int event, void* data){ int sel; int sel_menu; if (event == SIE_BUTTON_CLICKED) { switch (item->id) { //按的那个图片 case SIID_OK: sel = SendMessage ( hIV_child_information, IVM_GETCURSEL, 0, 0 ); sel_menu = SendMessage ( hIV_menu_information, IVM_GETCURSEL, 0, 0 ); if (flagInfo==1){ if (sel_menu == 9) { win_index(hWndMain); } else { GoOtherWindows (sel_menu); } }//if(flagInfo==1){ else if(flagInfo==0) { printf ("else if(flagInfo==0) \n"); GoOtherWindows (sel); } else {printf ("else else else else \n");} break;//case SIID_OK: case SIID_MENU: flagInfo=1; ShowReturnPic_info( FALSE ); ShowMenu_info( TRUE ); break; case SIID_RETURN://return win_index(hWndMain); CloseTheWindow_info(); break; case SIID_CANCEL: flagInfo = 0; ShowMenu_info( FALSE ); ShowReturnPic_info( TRUE ); break; } } return 1;}void InitWindowInfomation(HWND hwnd){ char a[20]; IVITEMINFO ivii; int i,j,uRead,totalIn,totalOut; FILE *fp; totalIn = GetCount(INBOX, TYPE_OF_TXXX); uRead = GetCountUnRead( ); totalOut = GetCount(OUTBOX, TYPE_OF_TXXX); if( totalIn <= 0) { totalIn = 0; uRead = 0; } /*else if( totalIn > AUTOROLLVAL_TX ) { uRead = totalIn-uRead totalIn = AUTOROLLVAL_TX; }*/ for (i = 0; i < TABLESIZE(icon_bitmap_information); i++) { memset (&ivii, 0, sizeof(IVITEMINFO)); ivii.bmp = &icon_bitmap_information[i]; ivii.nItem = i; if ( i==0) //inbox { sprintf(buff,"%s %i/%i", labInfo[i], uRead, totalIn ); ivii.label=buff; } else if ( i==1) //outbox { sprintf(buff,"%s %i\0",labInfo[i], totalOut );// ivii.label = buff; } else if(i == 2)//draft box { int som = OpenDraftbox (); sprintf(buff,"%s %i\0",labInfo[i],som );// ivii.label = buff; } else if(i == 3)//address box { int som = OpenAddrBook ( ); sprintf(buff,"%s %i\0",labInfo[i] ,som );// ivii.label = buff; } else { ivii.label = labInfo[i]; } ivii.addData = i; SendMessage (hIV_child_information, IVM_ADDITEM, 0, (LPARAM)&ivii); } SendMessage(hIV_child_information,IVM_SELECTITEM,0,0); SendMessage(hIV_child_information,IVM_SETCURSEL,0,0);}static int msg_event_cb_information (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result){ HDC hdc; IVITEMINFO ivii_child; int j,i,k; switch (message) { case MSG_CREATE: ShowReturnPic_info( TRUE ); LoadBitmap (HDC_SCREEN, &bmp_information, "Pictures/imformation.PNG"); for (j=0; j<TABLESIZE(icon_bitmap_information);j++) { LoadBitmap (HDC_SCREEN,&icon_bitmap_information[j],icon_files_information[j]); } hIV_child_information = CreateChildWindow(hwnd , 0,17, 160, 160,1062); SendMessage (hIV_child_information, IVM_SETITEMSIZE, 138.5, 20); InitWindowInfomation( hwnd); hIV_menu_information = CreateMenuWindow(hwnd , 90, 10, 1101); for (i = 0; i < TABLESIZE(icon_labels_information); i++) { memset (&ivii_child, 0, sizeof(IVITEMINFO)); ivii_child.bmp = NULL; ivii_child.nItem = i; ivii_child.label = icon_labels_information[i] ; ivii_child.addData = i; SendMessage (hIV_menu_information, IVM_ADDITEM, 0, (LPARAM)&ivii_child); } printf("=======information Count of Newly mesg is %d============\n",GetCountNMesg( ) ); 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_information); TextOut (hdc, WZ_ZTL_X2, WZ_ZTL_Y, "通信" ); EndPaint (hwnd,hdc); break; } return 1;}int win_information(HWND hwnd){ MSG msg; LoadSkinBmps( &skin_information, TRUE ,bmp_name_information , (sizeof (bmp_name_information))/sizeof(char *) ); if (skin_information.bmps == NULL) { printf ("Could not load skin bitmaps!\n"); return 0; } if ( !skin_init (&skin_information, main_event_cb_information, msg_event_cb_information) ){ /* 初始化皮肤 */ printf ("skin init fail!\n"); return 0; } else{ hWndMaininfo= create_skin_control (&skin_information, hwnd,143, DEF_X_, DEF_Y_, DEF_WIDTH, DEF_HEIGHT); currShowWindowHwnd = hWndMaininfo; currWindow=hWndMaininfo;printf("information------currShowWindowHwnd----%d , hWndMaininfo --%d\n",currShowWindowHwnd,hWndMaininfo); SetFocusChild(hIV_child_information); return 1; }}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -