/** * @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; } }