📄 win_infolook.c~
字号:
/*win_infolook.c*//*** COMPANY NAME: 国星** FILE NAME: win_infolook.c** FILE PATH: Interface/win_infolook.c** WINDOWS NAME: 通信 ** WINDOWS PATH: 通信 / 发件箱(收件箱) / 查看** OTHER INFORMATION; 无** CREATER NAME: LiWencheng,JiangYuanqing** MENDER NAME: LiWencheng,JiangYuanqing** CHANGE TIME: 11/14/2007 */#include "sysSrcInfo.h"#define ID_EDIT_SEND 310#define ID_EDIT_TIME 320#define ID_EDIT_MLEDIT 330#define HWND_INFOLOOK 340static int newflag=0;static int flagInfoLook;static int currMess = 0; //当前要看的消息static int countOfMessage = 0;static HWND hIconView_InfoLook;static HWND hwndEditSend,hwndEditTime;static HWND hwndmledit_content;static BITMAP bmp_InfoLook; static HWND editCodeType;static const char *bmp_name_infolook[] = {"./Pictures/b_windowsbackground_1.PNG", //第一张来做主界面"./Pictures/c_lastone.PNG", //1"./Pictures/c_nextone.PNG", //2"./Pictures/return.PNG" //3};static const char *feedBackFlag_infolook[] = {"OK","Failure","Signal Unlocked","Low Battery Power","Too Early to send","Error during encryption","CRC Error"};static skin_item_t skin_main_items [] ={{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_RETURN, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE, BUTTONRIGHT_X, BUTTON_Y, {}, 3, "" }};/* 定义皮肤 */static skin_head_t skin_infolook ={ "main", //const BITMAP* bmps; SKIN_STYLE_TOOLTIP, NULL, NULL, 0, 3, skin_main_items, FALSE /** The number of the items in this skin. */ /* 定义皮肤元素数组 */};static void showmess (int flag){ char buff[20]; switch (flag){ case 0: SetCodeType (editCodeType , (int)((*(loadedMesg.pCommInfoOut+currMess))->txIndex.chType)); sprintf (buff,"%ld",(*(loadedMesg.pCommInfoOut+currMess))->txIndex.srcID); SetWindowText (hwndEditSend,buff); sprintf (buff,"%d-%d-%d %d:%d",currTime.year,currTime.mon,currTime.mday,(*(loadedMesg.pCommInfoOut+currMess))->txIndex.hour,(*(loadedMesg.pCommInfoOut+currMess))->txIndex.minute); SetWindowText (hwndEditTime, buff); if( (*(loadedMesg.pCommInfoOut+currMess))->txIndex.contentLen <= 20 ) { SetWindowText (hwndmledit_content, (*(loadedMesg.pCommInfoOut+currMess))->txIndex.message ); } else { ReadFromTXMAIN( OUTBOX, currMess );//currMess SetWindowText (hwndmledit_content, loadedMesg.Message ); } if( (*(loadedMesg.pCommInfoOut+currMess))->txIndex.lockSymbol == 0 ) { (*(loadedMesg.pCommInfoOut+currMess))->txIndex.lockSymbol=2; SaveLockSymbol( OUTBOX, currMess ); } break; case 1: case 5: case 10: SetCodeType (editCodeType , (int)((*(loadedMesg.pCommInfo+currMess))->txIndex.chType) - 31 ); sprintf (buff,"%ld",(*(loadedMesg.pCommInfo+currMess))->txIndex.srcID); SetWindowText (hwndEditSend,buff); sprintf (buff,"%d-%d-%d %d:%d",currTime.year,currTime.mon,currTime.mday, (*(loadedMesg.pCommInfo+currMess))->txIndex.hour, (*(loadedMesg.pCommInfo+currMess))->txIndex.minute); SetWindowText (hwndEditTime, buff); if( (*(loadedMesg.pCommInfo+currMess))->txIndex.contentLen <= 20 ) { SetWindowText (hwndmledit_content, (loadedMesg.commInfo[currMess]).txIndex.message ); } else { ReadFromTXMAIN( INBOX, currMess );//currMess SetWindowText (hwndmledit_content, loadedMesg.Message ); } if( (*(loadedMesg.pCommInfo+currMess))->txIndex.lockSymbol==0) { (*(loadedMesg.pCommInfo+currMess))->txIndex.lockSymbol=2; SaveLockSymbol( INBOX, currMess ); ReduceCountUnRead( 1 ); printf("&&&&&&&&&&&&-=-=-=Saved SaveLockSymbol\n"); } break; case 2: break; case 3: SetCodeType (editCodeType , (int)((*(loadedMesg.pCommInfo+currMess))->txIndex.chType) - 31 ); sprintf (buff,"%ld",(*(loadedMesg.pCommInfo+currMess))->txIndex.srcID); SetWindowText (hwndEditSend,buff); sprintf (buff,"%d-%d-%d %d:%d",currTime.year,currTime.mon,currTime.mday, (*(loadedMesg.pCommInfo+currMess))->txIndex.hour, (*(loadedMesg.pCommInfo+currMess))->txIndex.minute); SetWindowText (hwndEditTime, buff); if( (*(loadedMesg.pCommInfo+currMess))->txIndex.contentLen <= 20 ) { SetWindowText (hwndmledit_content, (*(loadedMesg.pCommInfo+currMess))->txIndex.message ); } else { ReadFromTXMAIN( INBOX, currMess );//currMess SetWindowText (hwndmledit_content, loadedMesg.Message ); } if( (*(loadedMesg.pCommInfo+currMess))->txIndex.lockSymbol==0 ) { (*(loadedMesg.pCommInfo+currMess))->txIndex.lockSymbol=2; SaveLockSymbol( INBOX, currMess ); ReduceCountUnRead( 1 ); } break; case 4: sprintf (buff,"%ld",(loadedMesg.fkInfo+currMess)->fkxx.srcID); SetWindowText (hwndEditSend,buff); SetWindowText (hwndmledit_content, (loadedMesg.fkInfo+currMess)->fkxx.AdditionalINfor ); switch( (loadedMesg.fkInfo+currMess)->fkxx.FeedBackSign ) { case 0x00: SetWindowText (hwndEditTime, feedBackFlag_infolook[0]); break; case 0x01: SetWindowText (hwndEditTime, feedBackFlag_infolook[1]); break; case 0x02: SetWindowText (hwndEditTime, feedBackFlag_infolook[2]); break; case 0x03: SetWindowText (hwndEditTime, feedBackFlag_infolook[3]); break; case 0x04: SetWindowText (hwndEditTime, feedBackFlag_infolook[4]); break; case 0x05: SetWindowText (hwndEditTime, feedBackFlag_infolook[5]); break; case 0x06: SetWindowText (hwndEditTime, feedBackFlag_infolook[6]); break; } break; }}static void CloseWindow_infolook(){ win_newMesgOpen = WIN_NEWMESGCLOSE; destroy_skin_window (hWndMain_infolook); LoadSkinBmps( &skin_infolook, FALSE ,bmp_name_infolook , (sizeof (bmp_name_infolook))/sizeof(char *) ); UnloadBitmap( &bmp_InfoLook); }static int main_event_cb_infolook (HWND hwnd, skin_item_t* item, int event, void* data){printf("main_event_cb_infolook \n"); if (event == SIE_BUTTON_CLICKED) { switch (item->id) { //按的那个图片 case SIID_OK: //上条电文 if ( currMess > 0 ){ currMess--; showmess (flagInfoLook); //InvalidateRect (hWndMain_infolook, NULL,TRUE); } printf("case SIID_OK: \n"); break; case SIID_MENU: //下条电文 if ( currMess < countOfMessage - 1){ currMess++; showmess (flagInfoLook); //InvalidateRect (hWndMain_infolook , NULL,TRUE); } printf("case SIID_MENU: \n"); break; case SIID_RETURN://return if(flagInfoLook==1) { win_InfoInbox (hWndMain); } else if(flagInfoLook==0) { win_InfoOutbox (hWndMain); } else if(flagInfoLook==3||flagInfoLook==4||flagInfoLook==5) { win_queryResult(hWndMain ); } else if(flagInfoLook == 10)//Return to main index from checking newly message { win_index (hWndMain); } else printf("err %d\n",flagInfoLook); CloseWindow_infolook(); break; } } return 1;}static void creat_windows(HWND hwnd ){ hwndEditSend = CreateWindow( CTRL_SLEDIT, //sendNO " ", //WS_VISIBLE | ES_TIP| WS_BORDER ,// | ES_AUTOWRAP, WS_VISIBLE | WS_CHILD | WS_BORDER |ES_READONLY ,// | ES_AUTOWRAP, ID_EDIT_SEND, 35, 21,124 , 17, hwnd, 0); hwndEditTime = CreateWindow( CTRL_SLEDIT, //time " ", //WS_VISIBLE | ES_TIP| WS_BORDER ,// | ES_AUTOWRAP, WS_VISIBLE | WS_CHILD | WS_BORDER |ES_READONLY |ES_READONLY,// | ES_AUTOWRAP, ID_EDIT_TIME, 35, 37,124 , 17, hwnd, 0); hwndmledit_content=CreateWindow( CTRL_MLEDIT, //content "", WS_VISIBLE | WS_BORDER | WS_VSCROLL | ES_AUTOWRAP |ES_READONLY , ID_EDIT_MLEDIT, 0, 53,157 , 114, hwnd, 0);}static int msg_event_cb_infolook (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result){ HDC hdc; int i=0; switch (message) { case MSG_CREATE: printf("-----------asdfafasdfasdf\n"); win_newMesgOpen = WIN_NEWMESGOPEN; printf("-----------1 msg_event_cb_infolook\n"); LoadBitmap (HDC_SCREEN, &bmp_InfoLook, "./Pictures/a_information_3.PNG"); /// if(flagInfoLook!=4) { editCodeType = CreateCodeTypeEdit (hwnd); } countOfMessage = loadedMesg.countOfMesg; creat_windows( hwnd ); showmess (flagInfoLook); printf("-----------2 msg_event_cb_infolook\n"); if( flagInfoLook == 10) { skin_enable_item (&skin_infolook,SIID_OK,FALSE); //skin_show_item (&skin_infolook,SIID_OK,FALSE); skin_enable_item (&skin_infolook,SIID_MENU,FALSE); //skin_show_item (&skin_infolook,SIID_MENU,FALSE); } else { printf("-else----------infolook \n"); skin_enable_item (&skin_infolook,SIID_OK,TRUE); skin_enable_item (&skin_infolook,SIID_MENU,TRUE); } 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_InfoLook); TextOut (hdc, WZ_ZTL_X4, WZ_ZTL_Y, "电文查看" ); if (flagInfoLook==0) { TextOut (hdc, RJ_X, WZ_ZTL_Y+35, "时间" ); TextOut (hdc, RJ_X, WZ_ZTL_Y+15, "收方" ); } else if(flagInfoLook==1 || flagInfoLook == 3|| flagInfoLook == 10 ||flagInfoLook == 5) { TextOut (hdc, RJ_X, WZ_ZTL_Y+35, "时间" ); TextOut (hdc, RJ_X, WZ_ZTL_Y+18, "发方" ); } else if( flagInfoLook == 4) { TextOut (hdc, RJ_X, WZ_ZTL_Y+35, "反馈" ); TextOut (hdc, RJ_X, WZ_ZTL_Y+18, "发方" ); } EndPaint (hwnd,hdc); break; case MSG_CLOSENEWLOOK: CloseWindow_infolook(); break; } return 1;}int win_InfoLook (HWND hwnd , int curr_Mess , int flag)//当前要看的消息{ MSG msg; currMess = curr_Mess; flagInfoLook = flag;//flag==0为发件箱,flag==1为收件箱,flag==2为草稿箱,flag==3为queryResult, if( flag == 10) //flag==4 FKXX //flag == 5 NEWINPUT printf("-------------Enter window to watch the newMesg!----------------\n"); LoadSkinBmps( &skin_infolook, TRUE ,bmp_name_infolook , (sizeof (bmp_name_infolook))/sizeof(char *) ); if (skin_infolook.bmps == NULL) { printf ("Could not load skin bitmaps!\n"); return 3; } //定义的皮肤,皮肤事件回调函数,皮肤窗口消息回调函数 if ( !skin_init (&skin_infolook, main_event_cb_infolook, msg_event_cb_infolook) ){ /* 初始化皮肤 */ printf ("skin init fail!\n"); return 4; } else{ hWndMain_infolook = create_skin_control (&skin_infolook, hwnd,HWND_INFOLOOK,DEF_X_, DEF_Y_, DEF_WIDTH, DEF_HEIGHT); SetFocusChild(hIconView_InfoLook); // currShowWindowHwnd = hWndMain_infolook; return 1; } }#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -