/******************************************************************* * * _DemoBringToBottom Demonstrates the use of WM_BringToBottom */ static void _DemoBringToBottom(void) { _ChangeInfoText("WM_BringToBottom()"); // GUIDEMO_Delay(SPEED); WM_BringToBottom(_hWindow1); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/******************************************************************* * * _DemoBringToBottom Demonstrates the use of WM_BringToBottom */ static void _DemoBringToBottom(void) { _ChangeInfoText("WM_BringToBottom()"); GUI_Delay(SPEED); WM_BringToBottom(_hWindow1); GUI_Delay(SPEED); }
/** * @brief Callback routine of desktop window. * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbBk(WM_MESSAGE * pMsg) { MENU_MSG_DATA* pData; uint32_t NCode, Id; static uint8_t sel = 0; switch (pMsg->MsgId) { case WM_MENU: /* Process the menu message */ pData = (MENU_MSG_DATA*)pMsg->Data.p; switch (pData->MsgType) { case MENU_ON_ITEMSELECT: /* A menu item has been selected */ switch (pData->ItemId) { case ID_MENU_LOG: if (hLog == 0) { hLog = GUI_CreateDialogBox(_aKernelLogDialogCreate, GUI_COUNTOF(_aProcessManagerDialogCreate), _cbKernelLogDialog, pMsg->hWin, FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP, 50); } else { WM_ShowWindow(hLog); WM_BringToTop(hLog); } break; case ID_MENU_PMGR: if(hProcess == 0) { hProcess = GUI_CreateDialogBox(_aProcessManagerDialogCreate, GUI_COUNTOF(_aProcessManagerDialogCreate), _cbProcessManagerDialog, pMsg->hWin, FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP, 50); } else { WM_ShowWindow(hProcess); WM_BringToTop(hProcess); } break; case ID_MENU_PERF: if(hPerformance == 0) { hPerformance = GUI_CreateDialogBox(_aPerformanceDialogCreate, GUI_COUNTOF(_aPerformanceDialogCreate), _cbPerformanceDialog, pMsg->hWin, FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP, 50); } else { WM_ShowWindow(hPerformance); WM_BringToTop(hPerformance); } break; case ID_MENU_EXIT: break; } } break; case WM_PAINT: GUI_SetBkColor(GUI_TRANSPARENT); GUI_Clear(); if(hIcon) { WM_BringToBottom(hIcon); } break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (NCode) { case WM_NOTIFICATION_CHILD_DELETED: SpriteDisabled = 0; GUI_SPRITE_Show(_aSprite[0].hSprite); break; case WM_NOTIFICATION_CLICKED: if (Id == ID_ICONVIEW_MENU) { sel = ICONVIEW_GetSel(pMsg->hWinSrc); if(hPerformance != 0) { WM_HideWindow(hPerformance); } if(sel < k_ModuleGetNumber()) { if(sel < 8) { ICONVIEW_SetSel(pMsg->hWinSrc, -1); } else { ICONVIEW_SetSel(pMsg->hWinSrc, k_ModuleGetNumber() + 1); } } } break; case WM_NOTIFICATION_RELEASED: if (Id == ID_ICONVIEW_MENU) { if(sel < k_ModuleGetNumber()) { SpriteDisabled = 1; GUI_SPRITE_Hide(_aSprite[0].hSprite); module_prop[sel].module->startup(pMsg->hWin, 0, 26); sel = 0; } } else if (Id == ID_BUTTON_BKGND) { /* Create popup menu after touching the display */ _OpenPopup(WM_HBKWIN, _aMenuItems, GUI_COUNTOF(_aMenuItems),0 , 25); } break; default: break; } break; default: WM_DefaultProc(pMsg); } }
/** * @brief Callback routine of dialog * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; TREEVIEW_ITEM_Handle hTreeView; TREEVIEW_ITEM_INFO Info; GUI_PID_STATE State; switch (pMsg->MsgId) { case WM_INIT_DIALOG: pFileList = (FILELIST_FileTypeDef *)k_malloc(sizeof(FILELIST_FileTypeDef)); pFileList->ptr = 0; hPopUp = WM_CreateWindowAsChild(0, 26, LCD_GetXSize(), LCD_GetYSize()-26, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS , _cbPopup, 0); WM_BringToBottom(hPopUp); hItem = pMsg->hWin; FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0); WM_CreateWindowAsChild(240, 320, 1, 1, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbMediaConnection , 0); _RefreshBrowser(pMsg->hWin); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch (NCode) { case WM_NOTIFICATION_CHILD_DELETED: k_free(pFileList); if(hFileInfo != 0) { hFileInfo = 0; } break; case WM_NOTIFICATION_CLICKED: /* React only if released */ switch (Id) { case ID_TREEVIEW: hTreeView = TREEVIEW_GetSel(pMsg->hWinSrc); TREEVIEW_ITEM_GetInfo(hTreeView, &Info); if(Info.IsNode == 0) { GUI_TOUCH_GetState(&State); State.x += 20; if(State.x > 175) { State.x = 175; } State.y-= 50; if(State.y > 150) { State.y -= 70; } _FindFullPath(pMsg->hWinSrc, hTreeView, SelectedFileName); /* Create popup menu after touching the display */ _OpenPopup(hPopUp, _aMenuItems, GUI_COUNTOF(_aMenuItems), State.x, State.y); } break; case ID_BUTTON_REFRESH: _RefreshBrowser (pMsg->hWin); break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
static void _Graph_Sensor_Demo() { const WIDGET_EFFECT * pEffectOld; GRAPH_Handle hGraph; GRAPH_DATA_Handle hData[3]; // GRAPH_DATA_Handle hData; int xSize, ySize, i; int Graph_xSize, Graph_ySize, Data_ySize; int Graph_xPos, Graph_yPos; // set back screen black // GUI_SetColor(GUI_BLACK); // GUIDEMO_DrawBk(1); xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); // 256 pEffectOld = WIDGET_SetDefaultEffect(&WIDGET_Effect_Simple); // Return a poninter to the previous callback routine // Set Callback function for background window // The given window will be invalidated. This makes sure the window will be redrawn WM_SetCallback(WM_HBKWIN, _cbBk_test); // // Determine size of GRAPH // Graph_xSize = xSize - (DIST_TO_BORDER << 1); // xsize = Screen size subtracting twice the distance to the border of the screen Graph_ySize = ySize - INFO_SIZE_Y - (DIST_TO_WIN << 1); // ysize = Screen size subtracting the window sizes and twice the distance to the windows if (Graph_ySize > MAX_GRAPH_SIZE_Y) { // 181 Graph_ySize = MAX_GRAPH_SIZE_Y; // 140 if (Graph_xSize > (Graph_ySize * 20) / 11) { Graph_xSize = (Graph_ySize * 20) / 11; } } // // Create and configure GRAPH_WIDGET // Graph_xPos = (xSize - Graph_xSize) >> 1; Graph_yPos = (ySize - Graph_ySize) >> 1; if (Graph_yPos < INFO_SIZE_Y + DIST_TO_WIN) { Graph_yPos = INFO_SIZE_Y + DIST_TO_WIN; } // create a graph widget hGraph = GRAPH_CreateEx(Graph_xPos, Graph_yPos, Graph_xSize, Graph_ySize, WM_HBKWIN, WM_CF_SHOW | WM_CF_CONST_OUTLINE, 0, 0); GRAPH_SetBorder(hGraph, BORDER_LEFT, BORDER_TOP, BORDER_RIGHT, BORDER_BOTTOM); // set width of border WM_SetHasTrans (hGraph); // enbale tansparency for the given window GRAPH_SetColor (hGraph, COLOR_BK, GRAPH_CI_BK); // Sets the desired color of the given GRAPH widget GRAPH_SetColor (hGraph, COLOR_BORDER, GRAPH_CI_BORDER); GRAPH_SetColor (hGraph, COLOR_FRAME, GRAPH_CI_FRAME); GRAPH_SetColor (hGraph, COLOR_GRID, GRAPH_CI_GRID); // // Adjust grid // GRAPH_SetGridVis (hGraph, 1); // set grid visible GRAPH_SetGridDistX(hGraph, GRID_DIST_X); // set horizontal grid spacing GRAPH_SetGridDistY(hGraph, GRID_DIST_Y); // set vertical grid spacing WM_BringToBottom (hGraph); // Places hGraph underneath its siblings // // Create and configure GRAPH_DATA_YT object // for (i = 0; i < 3; i++) { // Create a point valude which include a X-axis value on the Y-axis hData[i] = GRAPH_DATA_YT_Create(_aColorData_sensor[i], xSize - (DIST_TO_BORDER << 1) - BORDER_LEFT, 0, 0); } // hData = GRAPH_DATA_YT_Create(_aColorData_sensor[0], xSize - (DIST_TO_BORDER << 1) - BORDER_LEFT, 0, 0); Data_ySize = Graph_ySize - BORDER_BOTTOM; // 131 // // Create and configure GRAPH_SCALE objects // _hScaleH_sensor = GRAPH_SCALE_Create(BORDER_BOTTOM >> 1, GUI_TA_VCENTER, GRAPH_SCALE_CF_HORIZONTAL, TICK_DIST_H); _hScaleV_sensor = GRAPH_SCALE_Create(BORDER_LEFT >> 1, GUI_TA_HCENTER, GRAPH_SCALE_CF_VERTICAL, TICK_DIST_V); GRAPH_SCALE_SetPos(_hScaleH_sensor, Graph_ySize - 4); // Sets the vertical position for showing the scale object with in the GRAPH widget GRAPH_SCALE_SetOff(_hScaleH_sensor, -5); // Sets an horizontal offset used to 'shift' the scale object in positive or negative direction // show sensor graph GUIDEMO_ShowInfo("sensor demo"); GRAPH_AttachScale(hGraph, _hScaleH_sensor); GRAPH_AttachScale(hGraph, _hScaleV_sensor); // _Data_Sensor_Adjust = (Data_ySize * 100) >> GRAPH_DIV; // (Data_ySize * 21) >> GRAPH_DIV GRAPH_SetGridOffY (hGraph, 6); // Add an offset used to show the horizontal grid lines // (((Data_ySize - BORDER_BOTTOM) * 260) >> GRAPH_DIV) GRAPH_SCALE_SetOff(_hScaleV_sensor, 75); _Show_Sensor_Graph(hGraph, hData); // // Clean up // GRAPH_DetachScale(hGraph, _hScaleH_sensor); GRAPH_DetachScale(hGraph, _hScaleV_sensor); GRAPH_SCALE_Delete(_hScaleH_sensor); GRAPH_SCALE_Delete(_hScaleV_sensor); for (i = 0; i < 3; i++) { GRAPH_DATA_YT_Delete(hData[i]); } // GRAPH_DATA_YT_Delete(hData); WM_DeleteWindow(hGraph); WIDGET_SetDefaultEffect(pEffectOld); }
/********************************************************************* * * _GraphDemo */ static void _GraphDemo(void) { const WIDGET_EFFECT * pEffectOld; GRAPH_DATA_Handle hData[MAX_NUM_DATA_OBJ]; GRAPH_Handle hGraph; unsigned i; int Graph_xSize; int Graph_ySize; int Graph_xPos; int Graph_yPos; int Data_ySize; int xSize; int ySize; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); pEffectOld = WIDGET_SetDefaultEffect(&WIDGET_Effect_Simple); // // Set Callback function for background window // WM_SetCallback(WM_HBKWIN, _cbBk); // // Determine size of GRAPH // Graph_xSize = xSize - (DIST_TO_BORDER << 1); // xsize = Screen size subtracting twice the distance to the border of the screen Graph_ySize = ySize - INFO_SIZE_Y - (DIST_TO_WIN << 1); // ysize = Screen size subtracting the window sizes and twice the distance to the windows if (Graph_ySize > MAX_GRAPH_SIZE_Y) { Graph_ySize = MAX_GRAPH_SIZE_Y; if (Graph_xSize > (Graph_ySize * 20) / 11) { Graph_xSize = (Graph_ySize * 20) / 11; } } // // Create and configure GRAPH_WIDGET // Graph_xPos = (xSize - Graph_xSize) / 2; Graph_yPos = (ySize - Graph_ySize) / 2; if (Graph_yPos < INFO_SIZE_Y + DIST_TO_WIN) { Graph_yPos = INFO_SIZE_Y + DIST_TO_WIN; } hGraph = GRAPH_CreateEx(Graph_xPos, Graph_yPos, Graph_xSize, Graph_ySize, WM_HBKWIN, WM_CF_SHOW | WM_CF_CONST_OUTLINE, 0, 0); GRAPH_SetBorder(hGraph, BORDER_LEFT, BORDER_TOP, BORDER_RIGHT, BORDER_BOTTOM); WM_SetHasTrans (hGraph); GRAPH_SetColor (hGraph, COLOR_BK, GRAPH_CI_BK); GRAPH_SetColor (hGraph, COLOR_BORDER, GRAPH_CI_BORDER); GRAPH_SetColor (hGraph, COLOR_FRAME, GRAPH_CI_FRAME); GRAPH_SetColor (hGraph, COLOR_GRID, GRAPH_CI_GRID); // // Adjust grid // GRAPH_SetGridVis (hGraph, 1); GRAPH_SetGridDistX(hGraph, GRID_DIST_X); GRAPH_SetGridDistY(hGraph, GRID_DIST_Y); WM_BringToBottom (hGraph); // // Create and configure GRAPH_DATA_YT object // for (i = 0; i < MAX_NUM_DATA_OBJ; i++) { hData[i] = GRAPH_DATA_YT_Create(_aColorData[i], xSize - (DIST_TO_BORDER << 1) - BORDER_LEFT, 0, 0); } Data_ySize = Graph_ySize - BORDER_BOTTOM; // // Create and configure GRAPH_SCALE objects // _hScaleH = GRAPH_SCALE_Create(BORDER_BOTTOM >> 1, GUI_TA_VCENTER, GRAPH_SCALE_CF_HORIZONTAL, TICK_DIST_H); _hScaleV = GRAPH_SCALE_Create(BORDER_LEFT >> 1, GUI_TA_HCENTER, GRAPH_SCALE_CF_VERTICAL, TICK_DIST_V); GRAPH_AttachScale(hGraph, _hScaleH); GRAPH_AttachScale(hGraph, _hScaleV); GRAPH_SCALE_SetPos(_hScaleH, Graph_ySize - SCALE_H_HEIGHT); GRAPH_SCALE_SetOff(_hScaleH, -5); // // Show some graphs // for (i = 0; i < GUI_COUNTOF(_aWave); i++) { GUIDEMO_ShowInfo(_aWave[i].pName); _DataAdjust = GUIDEMO_ShiftRight(Data_ySize * _aWave[i].DataVOff, GRAPH_DIV); GRAPH_SetGridOffY (hGraph, GUIDEMO_ShiftRight(Data_ySize * _aWave[i].GridVOff, GRAPH_DIV)); GRAPH_SCALE_SetOff(_hScaleV, GUIDEMO_ShiftRight((Data_ySize - BORDER_BOTTOM) * _aWave[i].ScaleVOff, GRAPH_DIV)); _ShowGraph(hGraph, hData, _aWave[i].NumWaves, _aWave[i].pfAddData); } // // Clean up // GRAPH_DetachScale(hGraph, _hScaleH); GRAPH_DetachScale(hGraph, _hScaleV); GRAPH_SCALE_Delete(_hScaleH); GRAPH_SCALE_Delete(_hScaleV); for (i = 0; i < MAX_NUM_DATA_OBJ; i++) { GRAPH_DATA_YT_Delete(hData[i]); } WM_DeleteWindow(hGraph); WIDGET_SetDefaultEffect(pEffectOld); }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; int key_num; // USER START (Optionally insert additional variables) // USER END int i; switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'Edit' // GUI_UC_SetEncodeUTF8(); #if 1 hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_2); BUTTON_SetBkColor(hItem,0,GUI_GREEN); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); #endif hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_3); BUTTON_SetBkColor(hItem,0,GUI_YELLOW); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_4); BUTTON_SetBkColor(hItem,0,GUI_CYAN); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_1); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); BUTTON_SetBkColor(hItem,0,GUI_CYAN); hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_0); BUTTON_SetBkColor(hItem,0,GUI_CYAN); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); WM_DisableWindow(hItem); EDIT_SetText(hItem, (const char *)GUI_hex2MeterAddrStr(g_sys_ctrl.recentMeterAddr, 6)); for(i = 0;i < 5; i++) { hItem=WM_GetDialogItem(pMsg->hWin,(ID_EDIT_3+i)); EDIT_SetText(hItem, "0"); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); WM_DisableWindow(hItem); } PUB_InitFreq(pMsg,ID_EDIT_2); hItem = WM_GetDialogItem(pMsg->hWin,ID_EDIT_2); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1); if(DL645_2007 == g_rom_para.protocol) { //EDIT_SetText(hItem, pReadSel_07[g_sys_ctrl.data_item_index]); EDIT_SetText(hItem, pReadSel_07[0]); memcpy(g_gui_para.dataItem, &c_645dataItemDef[g_rom_para.protocol][0], 4); g_gui_para.ctrlCode=0x11; } else if(DL645_1997 == g_rom_para.protocol) { //EDIT_SetText(hItem, pReadSel_97[g_sys_ctrl.data_item_index]); EDIT_SetText(hItem, pReadSel_97[0]); memcpy(g_gui_para.dataItem, &c_645dataItemDef[g_rom_para.protocol][0], 2); g_gui_para.ctrlCode=0x01; } WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGBAR_0); PROGBAR_SetBarColor(hItem,0,GUI_GREEN); break; case WM_KEY: Id = WM_GetId(pMsg->hWinSrc); if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt) == 1) { switch(((WM_KEY_INFO*)(pMsg->Data.p))->Key) { case GUI_KEY_YELLOW: WM_DeleteWindow(g_hWin_ReadMeter); g_hWin_ReadMeter=HBWIN_NULL; WM_BringToBottom(g_hWin_msg); WM_HideWindow(g_hWin_msg); WM_ShowWindow(g_hWin_TimeBar); WM_ShowWindow(g_hWin_Date); WM_SetFocus(g_hWin_menu); RMD_key_cnt = 0; g_gui_para.state = GUI_STATE_IDLE; break; case GUI_KEY_GREEN: g_hWin_MeterTime = CreateExtFnct(); hItem = MTD_GetMeterAddr(); WM_SetFocus(hItem); MTD_SetAddrBkColor(hItem); break; case GUI_KEY_F1: /*获取表号*/ if(CHANNEL_RF != g_rom_para.channel) { g_gui_para.ctrlCode = 0x13; g_gui_para.cmd = GUI_CMD_BROAD_READ_ADDR; g_gui_para.state = GUI_STATE_AMR; OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para); } else { ERR_NOTE(g_hWin_ReadMeter,GUI_MSBOX_FUN_DISALE_ERROR); } break; case '#': WM_BringToTop(g_hWin_msg); WM_ShowWindow(g_hWin_msg); WM_SetFocus(g_hWin_msg); break; case GUI_KEY_F2: /*抄表*/ if(DEV_OK == RMD_Get_Para(pMsg))//获取参数数据 { g_gui_para.state = GUI_STATE_AMR; OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para); } break; case GUI_KEY_UP: RMD_SelEdt_Up(pMsg); //RMD_Color_Change(); GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3); break; case GUI_KEY_DOWN: RMD_SelEdt_Down(pMsg); //RMD_Color_Change(); GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3); break; case GUI_KEY_ENTER: switch(Id) { case ID_EDIT_0: g_sys_ctrl.selectWidget=EDIT_METER_NUM; g_hWin_Input=Create_Edit_Set(g_hWin_ReadMeter); WM_SetFocus(g_hWin_Input); break; case ID_EDIT_1: g_sys_ctrl.selectWidget=LISTBOX_READ_SEL; g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter); WM_SetFocus(g_hWin_Input); break; case ID_EDIT_2: //g_sys_ctrl.selectWidget=LISTBOX_SPEED; //g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter); //WM_SetFocus(g_hWin_Input); g_hWin_freq = CreateSpeed(g_hWin_ReadMeter); //WM_SetFocus(g_hWin_freq); break; } } } break; #if 0 if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==1)//按键点击。 { switch(Id) { case ID_EDIT_0: if(key_num==GUI_KEY_ENTER) { g_sys_ctrl.selectWidget=EDIT_METER_NUM; g_hWin_Input=Create_Edit_Set(g_hWin_ReadMeter); WM_SetFocus(g_hWin_Input); } break; case ID_EDIT_1: if(key_num==GUI_KEY_ENTER) { g_sys_ctrl.selectWidget=LISTBOX_READ_SEL; g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter); WM_SetFocus(g_hWin_Input); } break; case ID_EDIT_2: if(key_num==GUI_KEY_ENTER) { //g_sys_ctrl.selectWidget=LISTBOX_SPEED; //g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter); //WM_SetFocus(g_hWin_Input); g_hWin_freq = CreateSpeed(g_hWin_ReadMeter); //WM_SetFocus(g_hWin_freq); } break; } } switch(((WM_KEY_INFO *)(pMsg->Data.p))->Key) { case GUI_KEY_YELLOW: if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==1) { WM_DeleteWindow(g_hWin_ReadMeter); g_hWin_ReadMeter=HBWIN_NULL; WM_BringToBottom(g_hWin_msg); WM_HideWindow(g_hWin_msg); WM_ShowWindow(g_hWin_TimeBar); WM_ShowWindow(g_hWin_Date); WM_SetFocus(g_hWin_menu); RMD_key_cnt = 0; g_gui_para.state = GUI_STATE_IDLE; } break; case GUI_KEY_F1: /*获取表号*/ if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0) { if(CHANNEL_RF != g_rom_para.channel) { g_gui_para.cmd = GUI_CMD_BROAD_READ_ADDR; g_gui_para.state = GUI_STATE_AMR; OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para); } } break; case '#': if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0) { WM_BringToTop(g_hWin_msg); WM_ShowWindow(g_hWin_msg); WM_SetFocus(g_hWin_msg); } break; case GUI_KEY_F2: /*抄表*/ if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0) { if(DEV_OK == RMD_Get_Para(pMsg))//获取参数数据 { g_gui_para.state = GUI_STATE_AMR; OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para); } } break; case GUI_KEY_UP: if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0) { RMD_SelEdt_Up(pMsg); //RMD_Color_Change(); } break; case GUI_KEY_DOWN: if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0) { RMD_SelEdt_Down(pMsg); //RMD_Color_Change(); GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3); } break; case GUI_KEY_TAB: if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0) { //RMD_Sel_Down(pMsg); RMD_Color_Change(); } break; #endif case WM_MSG_CLOSE: WM_DeleteWindow(g_hWin_ReadMeter); break; default: WM_DefaultProc(pMsg); break; } } /********************************************************************* * * CreateReadMeter */ WM_HWIN CreateReadMeter(void); WM_HWIN CreateReadMeter(void) { WM_HWIN hWin; hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, g_hWin_menu, 0, 0); return hWin; }
/** * * @param win_id - идентификатор окна которое нужно скрыть функцией WM_HideWindow(). * Если id == GUI_NULL (-1) функция WM_HideWindow() не будет вызываться. */ void hide_window(int win_id) { switch (win_id) { case ID_LANG_DLG: { WM_HideWindow(langWin); WM_DeleteWindow(langWin); langWin = WM_UNATTACHED; break; } case ID_MEAS_PG: { WM_HideWindow(measMultiPageWin); WM_DeleteWindow(measMultiPageWin); measMultiPageWin = WM_UNATTACHED; break; } case ID_CONFIG_PG: { WM_HideWindow(configPageWin); WM_DeleteWindow(configPageWin); configPageWin = WM_UNATTACHED; break; } case ID_RANK_PG: { WM_HideWindow(rankMultiPageWin); break; } case ID_RANK_DI_DLG: { WM_HideWindow(rankDlgDIPg); WM_BringToBottom(rankDlgDIPg); rankDlgDIPg = WM_UNATTACHED; break; } case ID_RANK_DO_DLG: { WM_HideWindow(rankDlgDOPg); WM_BringToBottom(rankDlgDOPg); rankDlgDOPg = WM_UNATTACHED; break; } case ID_RANK_LED_DLG: { WM_HideWindow(rankDlgLEDPg); WM_BringToBottom(rankDlgLEDPg); rankDlgLEDPg = WM_UNATTACHED; break; } case ID_RANK_DF_DLG: { WM_HideWindow(rankDlgDFPg); WM_BringToBottom(rankDlgDFPg); rankDlgDFPg = WM_UNATTACHED; break; } case ID_RANK_AN_REC_DLG: { WM_HideWindow(rankDlgAnRecPg); WM_BringToBottom(rankDlgAnRecPg); rankDlgAnRecPg = WM_UNATTACHED; break; } default: //do nothing break; } }
static void _cbWindow(WM_MESSAGE * pMsg) { const WM_KEY_INFO* pInfo; WM_HWIN thisFrame = pMsg->hWin; int NCode; int Id; int xSize; int ySize; switch (pMsg->MsgId) { case WM_SET_FOCUS: if(pMsg->Data.v) { // WM_GetUserData(pMsg->hWin,&UserData,4); if(UserData==MONITMMSI_FULL || UserData == MONITMMSI_FIRST) { WM_SetFocus(buttons[2]); } else { UserData = 0; WM_SetFocus(buttons[0]); } } break; case WM_PAINT: xSize = WM_GetWindowSizeX(pMsg->hWin); ySize = WM_GetWindowSizeY(pMsg->hWin); // hMem0 = GUI_MEMDEV_Create(0, 0, xSize, ySize); // GUI_MEMDEV_Select(hMem0); GUI_DrawGradientRoundedV(0, 0, xSize - 1, ySize - 1, 20, pColors->bkTopColor,pColors->bkBottomColor); // GUI_MEMDEV_Select(0); // GUI_MEMDEV_CopyToLCD(hMem0); // GUI_MEMDEV_Delete(hMem0); break; case USER_MSG_SKIN: pColors = &(confirmWinColors[pMsg->Data.v]); BUTTON_SetBkColor(buttons[0], BUTTON_BI_UNPRESSED, pColors->btBkColor); BUTTON_SetBkColor(buttons[1], BUTTON_BI_UNPRESSED, pColors->btBkColor); BUTTON_SetBkColor(buttons[2], BUTTON_BI_UNPRESSED, pColors->btBkColor); BUTTON_SetFocusColor(buttons[0], pColors->btFocusBkColor); BUTTON_SetFocusColor(buttons[1], pColors->btFocusBkColor); BUTTON_SetFocusColor(buttons[2], pColors->btFocusBkColor); TEXT_SetTextColor(dlgTextContent, pColors->textColor); break; case WM_CREATE: pColors = &confirmWinColors[t90_set.sys.nightmode]; BUTTON_CreateEx (60,110,80,40,thisFrame, WM_CF_HASTRANS ,0,GUI_ID_BUTTON0); buttons[0] = WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON0); BUTTON_SetFocusColor(buttons[0],pColors->btFocusBkColor); WM_ShowWindow (buttons[0]); BUTTON_SetText(buttons[0], "确定"); BUTTON_SetFont(buttons[0], &GUI_Font_T90_30); WM_SetCallback(buttons[0], &myButton); BUTTON_SetBkColor(buttons[0],BUTTON_BI_UNPRESSED,pColors->btBkColor); BUTTON_SetTextColor(buttons[0],BUTTON_BI_UNPRESSED,pColors->btTextColor); BUTTON_CreateEx(260, 110, 80, 40,thisFrame,WM_CF_HASTRANS,0,GUI_ID_BUTTON1); buttons[1] = WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON1); BUTTON_SetFocusColor(buttons[1],pColors->btFocusBkColor); WM_ShowWindow (buttons[1]); BUTTON_SetText(buttons[1], "取消"); BUTTON_SetFont(buttons[1], &GUI_Font_T90_30); WM_SetCallback(buttons[1], &myButton); BUTTON_SetBkColor(buttons[1],BUTTON_BI_UNPRESSED,pColors->btBkColor); BUTTON_SetTextColor(buttons[1],BUTTON_BI_UNPRESSED,pColors->btTextColor); buttons[2] = BUTTON_CreateEx (160,110,80,40,thisFrame, WM_CF_HASTRANS ,0,GUI_ID_BUTTON2); WM_HideWin(buttons[2]); BUTTON_SetText(buttons[2], "确定"); BUTTON_SetFont(buttons[2], &GUI_Font_T90_30); WM_SetCallback(buttons[2], &myButton); BUTTON_SetFocusColor(buttons[2],pColors->btFocusBkColor); BUTTON_SetBkColor(buttons[2],BUTTON_BI_UNPRESSED,pColors->btBkColor); BUTTON_SetTextColor(buttons[2],BUTTON_BI_UNPRESSED,pColors->btTextColor); TEXT_CreateEx (0, 35, 400, 80, thisFrame,WM_CF_SHOW,0,ID_TEXT_CONTENT,NULL); dlgTextContent = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTENT); TEXT_SetTextAlign(dlgTextContent,TEXT_CF_HCENTER); TEXT_SetFont(dlgTextContent, &GUI_Font_T90_30); TEXT_SetTextColor (dlgTextContent,pColors->textColor); break; case WM_KEY: pInfo = (WM_KEY_INFO*)pMsg->Data.p; switch(pInfo->Key) { case GUI_KEY_LEFT: case GUI_KEY_RIGHT: // WM_GetUserData(pMsg->hWin,&UserData,4); if(UserData==MONITMMSI_FULL || UserData == MONITMMSI_FIRST) { WM_SetFocus(buttons[2]); } else { if(WM_HasFocus(buttons[0])) { WM_SetFocus(buttons[1]); } else { WM_SetFocus(buttons[0]); } } break; default: break; } break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); // Id of widget NCode = pMsg->Data.v; // Notification code switch (NCode) { case WM_NOTIFICATION_RELEASED: // React only if released switch (Id) { case GUI_ID_BUTTON0: // if(myMsg.Data.v == UPDATA) // { // updata[2] = 0x01; // if(UART_Send(UART_1, updata, 18, BLOCKING) == 18) // { // GUI_Delay(100); // NVIC_SystemReset(); // } // break; // } myMsg.hWin = myMsg.hWinSrc; myMsg.hWinSrc = pMsg->hWin; myMsg.MsgId = USER_MSG_REPLY; myMsg.Data.v = REPLY_OK; WM_SendMessage(myMsg.hWin, &myMsg); break; case GUI_ID_BUTTON1: // if(myMsg.Data.v == UPDATA) // { // UART_Send(UART_1, updata, 18, BLOCKING); // WM_SetFocus(myMsg.hWinSrc); // break; // } WM_SetFocusOnPrevChild(confirmWin); myMsg.hWin = myMsg.hWinSrc; myMsg.hWinSrc = pMsg->hWin; myMsg.MsgId = USER_MSG_REPLY; myMsg.Data.v = REPLY_CANCEL; WM_SendMessage(myMsg.hWin, &myMsg); break; case GUI_ID_BUTTON2: myMsg.hWin = myMsg.hWinSrc; myMsg.hWinSrc = pMsg->hWin; myMsg.MsgId = USER_MSG_REPLY; myMsg.Data.v = REPLY_OK; WM_SendMessage(myMsg.hWin, &myMsg); { WM_ShowWin(buttons[0]); WM_ShowWin(buttons[1]); WM_HideWin(buttons[2]); } break; } WM_BringToBottom(confirmWin); break; } break; case USER_MSG_CHOOSE: Option = pMsg->Data.v; myMsg.hWinSrc = pMsg->hWinSrc; myMsg.Data.v = Option; switch(Option) { case CANCEL_MONITED: TEXT_SetText(dlgTextContent, "??????????"); break; case STORE_SETTING: TEXT_SetText(dlgTextContent, "??????????"); break; case ADD_MONITED: TEXT_SetText(dlgTextContent, "????????????"); break; case SYS_SETTING: TEXT_SetText(dlgTextContent, "是否更改设置内容?"); UserData = SYS_SETTING; // WM_SetUserData(pMsg->hWin,&UserData,4); break; case SYS_RESET: TEXT_SetText(dlgTextContent, "是否恢复出厂设置?"); UserData = SYS_RESET; // WM_SetUserData(pMsg->hWin,&UserData,4); break; case MONITMMSI_SET: MMSI = getMMSItmp(); sprintf(pstring,"您输入的辅船九位码为: \n%09ld,是否确定?",MMSI); TEXT_SetText(dlgTextContent, pstring); UserData = MONITMMSI_SET; // WM_SetUserData(pMsg->hWin,&UserData,4); break; case MONITMMSI_ADD: MMSI = getMMSItmp(); sprintf(pstring, "确定将船只 %09ld \n加入船队?",MMSI); TEXT_SetText(dlgTextContent, pstring); UserData = MONITMMSI_ADD; // WM_SetUserData(pMsg->hWin,&UserData,4); break; case MONITMMSI_DEL: TEXT_SetText(dlgTextContent, "删除后,对该船只报警功能\n恢复正常,是否确认删除?"); UserData = MONITMMSI_DEL; WM_SetUserData(pMsg->hWin,&UserData,4); break; case MONITMMSI_FULL: TEXT_SetText(dlgTextContent, "已经达到设置上限,请删\n除后再进行添加!"); WM_HideWin(buttons[0]); WM_HideWin(buttons[1]); WM_ShowWin(buttons[2]); UserData = MONITMMSI_FULL; // WM_SetUserData(pMsg->hWin,&UserData,4); break; case MONITMMSI_NINE: TEXT_SetText(dlgTextContent, "你输入的九位码不足九位, \n确定继续修改?"); break; case MONITMMSI_FIRST: TEXT_SetText(dlgTextContent, "你输入的九位码不足九位, \n请继续输入!"); WM_HideWin(buttons[0]); WM_HideWin(buttons[1]); WM_ShowWin(buttons[2]); UserData = MONITMMSI_FIRST; // WM_SetUserData(pMsg->hWin,&UserData,4); break; // case UPDATA: // TEXT_SetText(dlgTextContent,"是否进行更新?"); default: break; } break; default: WM_DefaultProc(pMsg); break; } }