/** * @brief Initializes the menu. * @param None. * @retval None. */ void k_InitMenu(void) { uint8_t i = 0; WM_HWIN hItem; ICONVIEW_Handle hIcon ; WM_SetCallback(WM_GetDesktopWindowEx(0), _cbBk); hIcon = ST_AnimatedIconView_CreateEx(0, 0, LCD_GetXSize() - 0, LCD_GetYSize() - 0, WM_GetDesktopWindowEx(0), WM_CF_SHOW | WM_CF_HASTRANS , 0, ID_ICONVIEW_MENU, 150, 180, 5, 5); ST_AnimatedIconView_SetDualFont(hIcon, &GUI_FontLubalGraphXLtBT20, &GUI_FontITCAvantGardeStdBk20); ST_AnimatedIconView_SetSpace(hIcon, GUI_COORD_Y, 5); ST_AnimatedIconView_SetSpace(hIcon, GUI_COORD_X, 5); ST_AnimatedIconView_SetFrame(hIcon, GUI_COORD_Y, 10); ST_AnimatedIconView_SetFrame(hIcon, GUI_COORD_X, 5); ST_AnimatedIconView_SetTextColor(hIcon, ICONVIEW_CI_UNSEL, 0x00DCA939); ST_AnimatedIconView_SetBkColor(hIcon, ICONVIEW_CI_UNSEL, GUI_WHITE); ST_AnimatedIconView_SetBkColor(hIcon, ICONVIEW_CI_SEL, GUI_WHITE); ST_AnimatedIconView_SetSel(hIcon, -1); ST_AnimatedIconView_SetDualTextColor(hIcon, ICONVIEW_CI_SEL, 0x00DCA939, 0x00522000); for (i = 0; i < k_ModuleGetNumber(); i++) { ST_AnimatedIconView_AddIcon(hIcon, module_prop[i].module->open_icon, module_prop[i].module->close_icon, (char *)module_prop[i].module->name); } hItem = TEXT_CreateEx(548, 360, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_FPU, "FPU : ON"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 380, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_IC, "I-Cache : ON"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 400, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_DC, "D-Cache : ON"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 420, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_CPU, "MCU Load < 1%"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 440, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_FREQ, "Clk : 200 MHz"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); }
/** * @brief Initializes the menu. * @param None. * @retval None. */ void k_InitMenu(void) { WM_HWIN hItem; uint8_t i = 0; GUI_SetLayerVisEx (0, 0); GUI_DrawBitmap(&bmbackground, 0,0); settings.d32 = k_BkupRestoreParameter(CALIBRATION_GENERAL_SETTINGS_BKP); GUI_SetLayerVisEx (0, 1); GUI_SelectLayer(1); GUI_Clear(); WM_SetCallback(WM_HBKWIN, _cbBk); WM_CreateWindowAsChild(0, 0, LCD_GetXSize(), 25, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS , _cbStatus, 0); hIcon = ICONVIEW_CreateEx(0, 26, LCD_GetXSize(), LCD_GetYSize()- 26, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_BGND , ICONVIEW_CF_AUTOSCROLLBAR_V, ID_ICONVIEW_MENU, 112, 105); ICONVIEW_SetFont(hIcon, &GUI_Font13B_ASCII); ICONVIEW_SetBkColor(hIcon, ICONVIEW_CI_SEL, GUI_LIGHTBLUE |GUI_TRANSPARENT); ICONVIEW_SetSpace(hIcon, GUI_COORD_Y, 10); ICONVIEW_SetFrame(hIcon, GUI_COORD_Y, 10); for (i = 0; i < k_ModuleGetNumber(); i++) { ICONVIEW_AddBitmapItem(hIcon,module_prop[i].module->icon, (char *)module_prop[i].module->name); } if(settings.b.enable_sprite) { _ShowSprites(); } hItem = BUTTON_CreateEx(0, 0, 40, 23, WM_HBKWIN, WM_CF_SHOW, 0, ID_BUTTON_BKGND); WM_SetCallback(hItem, _cbButton); }
/** * @brief Initializes the menu. * @param None. * @retval None */ void k_InitMenu(void) { WM_HWIN hItem; uint8_t i = 0; settings.d32 = k_BkupRestoreParameter(CALIBRATION_GENERAL_SETTINGS_BKP); WM_SetCallback(WM_HBKWIN, _cbBk); hStatusWin = WM_CreateWindowAsChild(0, 0, LCD_GetXSize(), 25, WM_HBKWIN, WM_CF_SHOW | WM_CF_LATE_CLIP , _cbStatus, 0); hIcon = ICONVIEW_CreateEx(0, 26, LCD_GetXSize(), LCD_GetYSize()- 26, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS, ICONVIEW_CF_AUTOSCROLLBAR_V, ID_ICONVIEW_MENU, 92, 90); ICONVIEW_SetFont(hIcon, &GUI_Font13B_ASCII); ICONVIEW_SetTextColor(hIcon, ICONVIEW_CI_UNSEL, GUI_BLUE); ICONVIEW_SetTextColor(hIcon, ICONVIEW_CI_SEL, GUI_BLUE); ICONVIEW_SetBkColor(hIcon, ICONVIEW_CI_SEL, GUI_LIGHTBLUE |GUI_TRANSPARENT); ICONVIEW_SetSpace(hIcon, GUI_COORD_Y, 10); ICONVIEW_SetFrame(hIcon, GUI_COORD_Y, 10); for (i = 0; i < k_ModuleGetNumber(); i++) { ICONVIEW_AddBitmapItem(hIcon,module_prop[i].module->icon, (char *)module_prop[i].module->name); } hItem = BUTTON_CreateEx(0, 0, 40, 23, WM_GetDesktopWindowEx(0), WM_CF_SHOW, 0, ID_BUTTON_BKGND); WM_SetCallback(hItem, _cbButton); }
/** * @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 desktop window. * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbBk(WM_MESSAGE * pMsg) { uint32_t NCode, Id; uint8_t sel; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetBkColor(GUI_WHITE); GUI_Clear(); /*H/W Information */ GUI_SetColor(0x007B10D3); GUI_AA_FillRoundedRect(520, 220, 780, 478, 30); GUI_DrawBitmap(&bmF7Logo, 530, 240); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (NCode) { case WM_NOTIFICATION_RELEASED: if (Id == ID_ICONVIEW_MENU) { sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc); if(sel < k_ModuleGetNumber()) { ST_AnimatedIconView_SetSel(pMsg->hWinSrc, -1); if(module_active == 0) { module_prop[sel].module->startup(pMsg->hWin, 0, 0); if(sel != 5) { module_active = 1; } sel = 0; } } else { WM_InvalidateWindow (pMsg->hWinSrc); } } break; case WM_NOTIFICATION_CHILD_DELETED: module_active = 0; break; default: break; } break; default: WM_DefaultProc(pMsg); } }