/********************************************************************* * * GUI_CreateDialogbox */ WM_HWIN GUI_CreateDialogBox(const GUI_WIDGET_CREATE_INFO* paWidget, int NumWidgets, WM_CALLBACK* cb, WM_HWIN hParent, int x0, int y0) { WM_HWIN hDialog, hDialogClient; hDialog = paWidget->pfCreateIndirect(paWidget, hParent, x0, y0, cb); /* Create parent window */ if (!hDialog) { return 0; } hDialogClient = WM_GetClientWindow(hDialog); WIDGET_OrState(hDialog, paWidget->Flags); WM_ShowWindow(hDialog); WM_ShowWindow(hDialogClient); while (--NumWidgets > 0) { WM_HWIN hChild; paWidget++; hChild = paWidget->pfCreateIndirect(paWidget, hDialogClient, 0, 0, 0); /* Create child window */ if (!hChild) { WM_DeleteWindow(hDialog); return 0; } WM_ShowWindow(hChild); } WM_SetFocusOnNextChild(hDialog); /* Set the focus to the first child */ WM_SendMessageNoPara(hDialogClient, WM_INIT_DIALOG); return hDialog; }
static void _UpdateInfoWin(void) { #if GUI_WINSUPPORT && GUIDEMO_LARGE GUI_RECT rClient; WM_HWIN hWin; GUI_CONTEXT ContextOld; GUI_SaveContext(&ContextOld); /* Update info window */ WM_ShowWindow(_ahInfoWin[0]); WM_ShowWindow(_ahFrameWin[0]); hWin = WM_SelectWindow(_ahInfoWin[0]); GUI_GetClientRect(&rClient); GUI_SetBkColor(GUI_WHITE); GUI_Clear(); GUI_SetColor(GUI_BLACK); //GUI_SetFont(&GUI_Font13_1); GUI_SetFont(&GUI_FontHZ12); GUI_SetTextAlign(GUI_TA_HCENTER); GUI_DispStringHCenterAt(_sInfo, (rClient.x1 - rClient.x0) / 2, 0); GUI_SetTextAlign(GUI_TA_LEFT); GUI_SetFont(&GUI_Font8_ASCII); GUI_DispStringAt(_sExplain, 0, 20); WM_SelectWindow(hWin); GUI_RestoreContext(&ContextOld); #endif }
/********************************************************************* * * xCreateDialogBoxArray */ WM_HWIN xCreateDialogBoxArray(const xDIALOGBOX_Obj* paDialogBox, int NumDialogBox, WM_CALLBACK* cb, WM_HWIN hParent, int x0, int y0) { WM_HWIN hDialog; WM_HWIN hDialogClient; if((NumDialogBox <= 0) || (paDialogBox==NULL) || (paDialogBox->paWidget->pfCreateIndirect==NULL) )return 0; //Creat Parent Window DEBUGOUT("xCreateDialogBoxArray: Create Parent Win\r\n"); hDialog = paDialogBox->paWidget->pfCreateIndirect(paDialogBox->paWidget, hParent, x0, y0, cb); /* Create parent window */ hDialogClient = WM_GetClientWindow(hDialog); WIDGET_OrState(hDialog, paDialogBox->paWidget->Flags); WM_ShowWindow(hDialog); WM_ShowWindow(hDialogClient); while (--NumDialogBox > 0) { WM_HWIN hChildDialog; paDialogBox++; DEBUGOUT("xCreateDialogBoxArray: Create Child DownCounter:%d\r\n", NumDialogBox); hChildDialog = GUI_CreateDialogBox(paDialogBox->paWidget, paDialogBox->NumWidgets, paDialogBox->cb, hDialogClient, 0, 0); /* Create child Dialog */ WM_ShowWindow(hChildDialog); } DEBUGOUT("xCreateDialogBoxArray: Create Child DownCounter:%d\r\n", NumDialogBox); DEBUGOUT("xCreateDialogBoxArray: Create Child OK\r\n", NumDialogBox); WM_SetFocusOnNextChild(hDialog); /* Set the focus to the first child */ WM_SendMessageNoPara(hDialogClient, WM_INIT_DIALOG); return hDialog; }
/********************************************************************* * * _RestoreMinimized */ static void _RestoreMinimized(FRAMEWIN_Handle hObj, FRAMEWIN_Obj* pObj) { /* When window was minimized, restore it */ if (pObj->Flags & FRAMEWIN_SF_MINIMIZED) { int OldHeight = 1 + pObj->Widget.Win.Rect.y1 - pObj->Widget.Win.Rect.y0; int NewHeight = 1 + pObj->rRestore.y1 - pObj->rRestore.y0; WM_ResizeWindow(hObj, 0, NewHeight - OldHeight); WM_ShowWindow(pObj->hClient); WM_ShowWindow(pObj->hMenu); FRAMEWIN__UpdatePositions(pObj); pObj->Flags &= ~FRAMEWIN_SF_MINIMIZED; _InvalidateButton(pObj, GUI_ID_MINIMIZE); } }
/******************************************************************* * * _DemoHideShowParent Demonstrates the use of WM_HideWindow and WM_ShowWindow */ static void _DemoHideShowParent(void) { _ChangeInfoText("WM_HideWindow(Parent)"); GUI_Delay(SPEED); WM_HideWindow(_hWindow2); GUI_Delay(SPEED/3); WM_HideWindow(_hWindow1); GUI_Delay(SPEED); _ChangeInfoText("WM_ShowWindow(Parent)"); GUI_Delay(SPEED); WM_ShowWindow(_hWindow1); GUI_Delay(SPEED/3); WM_ShowWindow(_hWindow2); GUI_Delay(SPEED); }
/******************************************************************* * * _DemoHideShowParent Demonstrates the use of WM_HideWindow and WM_ShowWindow */ static void _DemoHideShowParent(void) { _ChangeInfoText("WM_HideWindow(Parent)"); // GUIDEMO_Delay(SPEED); WM_HideWindow(_hWindow2); GUIDEMO_Delay(SPEED/3); WM_HideWindow(_hWindow1); GUIDEMO_Delay(SPEED); _ChangeInfoText("WM_ShowWindow(Parent)"); GUIDEMO_Delay(SPEED); WM_ShowWindow(_hWindow1); GUIDEMO_Delay(SPEED/3); WM_ShowWindow(_hWindow2); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
U8 TopDistortionScreen(WM_HWIN hPreWin) { WM_HideWindow(hPreWin); WM_ShowWindow(hDistortion); //WM_BringToTop(hDistortion); SetWindowToUpdateIfPresetModified(hDistortion); return 0; }
/********************************************************************* * * _cbBk */ static void _cbBk(WM_MESSAGE * pMsg) { static unsigned int GirdFlag = 0; int NCode, Id; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetBkColor(GUI_LIGHTBLUE); GUI_Clear(); GUI_DispStringAt("Temperature Curve ", 80, 0); // GUIDEMO_DrawBk(1); break; case WM_TOUCH: GirdFlag++; GRAPH_SetGridVis(hGraph,GirdFlag%3); //!< Display the if touch the screen 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 */ if (Id == ID_CURVE_BTN_SWTITCH_2_PARA) /* ID =210 btn Button */ { ClosePWM = ! ClosePWM; if(1 == ClosePWM) { BUTTON_SetText(btn,"Closed"); } else { BUTTON_SetText(btn,"Running"); } } if (Id == 202) /* ID =210 btn Button */ { BUTTON_SetText(btnClear,"PID_Set"); GPIO_SetBits(GPIOF,GPIO_Pin_8); PID_CFG_Flag = 1; WM_HideWindow(hWM_HBKWIN_CURVE); WM_ShowWindow(hWM_HBKWIN_CFG_PID); } break; default: { } } break; default: WM_DefaultProc(pMsg); } }
U8 TopSynthScreen(WM_HWIN hPreWin) { UpdateSynthSettingEx(MISAMODULE_SYNTH); //MZ WM_HideWindow(hPreWin); WM_ShowWindow(hSynth); //WM_BringToTop(hSynth); SetWindowToUpdateIfPresetModified(hSynth); return 0; }
/******************************************************************* * * _DemoHideShowChild Demonstrates the use of WM_HideWindow and WM_ShowWindow */ static void _DemoHideShowChild(void) { _ChangeInfoText("WM_HideWindow(Child)"); GUI_Delay(SPEED); WM_HideWindow(_hChild); GUI_Delay(SPEED); _ChangeInfoText("WM_ShowWindow(Child)"); GUI_Delay(SPEED); WM_ShowWindow(_hChild); GUI_Delay(SPEED); }
/********************************************************************* * * _ShowWindow */ static void _ShowWindow(void) { unsigned i; for (i = 0; i < MAX_WINDOWS; i++) { if (_ahWin[i] != 0) { if (WM_IsVisible(_ahWin[i]) == 0) { WM_ShowWindow(_ahWin[i]); break; } } } }
/** * @brief VNC window Startup * @param hWin: pointer to the parent handle. * @param xpos: X position * @param ypos: Y position * @retval None */ static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos) { if (hWinVNC == 0) { hWinVNC = GUI_CreateDialogBox(_aDialog_VNC, GUI_COUNTOF(_aDialog_VNC), _cbDialog_VNC, hWin, xpos, ypos); } else { WM_ShowWindow(hWinVNC); } }
/******************************************************************* * * _DemoHideShowChild Demonstrates the use of WM_HideWindow and WM_ShowWindow */ static void _DemoHideShowChild(void) { _ChangeInfoText("WM_HideWindow(Child)"); // GUIDEMO_Delay(SPEED); WM_HideWindow(_hChild); GUIDEMO_Delay(SPEED); _ChangeInfoText("WM_ShowWindow(Child)"); GUIDEMO_Delay(SPEED); WM_ShowWindow(_hChild); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/********************************************************************* * * _ForEach * * Purpose: * This routine hides/shows all windows except the button, graph and scroll bar widgets */ static void _ForEach(WM_HWIN hWin, void * pData) { int Id, FullScreenMode; FullScreenMode = *(int *)pData; Id = WM_GetId(hWin); if ((Id == GUI_ID_GRAPH0) || (Id == GUI_ID_BUTTON0) || (Id == GUI_ID_VSCROLL) || (Id == GUI_ID_HSCROLL)) { return; } if (FullScreenMode) { WM_HideWindow(hWin); } else { WM_ShowWindow(hWin); } }
/********************************************************************* * * 对话框回调函数 */ static void _cbOpenfile(WM_MESSAGE * pMsg) { // WM_HWIN hItem; // hItem = pMsg->hWin; switch (pMsg->MsgId) { case WM_DELETE: ltk_printf("Openfile delete\n"); //WM_BringToBottom(hItem); //WM_BringToTop(hDialog); WM_ShowWindow(hDialog); break; default: WM_DefaultProc(pMsg); } }
/** * @brief Game window Startup * @param hWin: pointer to the parent handle. * @param xpos: X position * @param ypos: Y position * @retval None */ static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos) { if(module_prop[k_ModuleGetIndex(&vnc_server)].win_state == 0) { hVncWin = GUI_CreateDialogBox(_aDialog, GUI_COUNTOF(_aDialog), _cbDialog, hWin, xpos, ypos); } else { WM_ShowWindow(hVncWin); ST_AnimatedIconView_SetItemText(hIcon,k_ModuleGetIndex(&vnc_server),"vnc server "); ST_AnimatedIconView_SetDualTextColor(hIcon, ICONVIEW_CI_SEL, GUI_STCOLOR_LIGHTBLUE, GUI_STCOLOR_DARKBLUE ); } }
int IPC_Msg_ShowWindow(tIPC_Client *Client, tAxWin_IPCMessage *Msg) { tIPCMsg_Boolean *info = (void*)Msg->Data; tWindow *win; ASSERT(Msg->ID == IPCMSG_SHOWWINDOW); if( Msg->Size < sizeof(*info) ) return -1; win = IPC_int_GetWindow(Client, Msg->Window); if(!win) return 1; WM_ShowWindow(win, !!info->Value); return 0; }
/***************************** Initializacija paneli nalashtuvan resursu *****************************/ void resurs_panel_show(void) { if (Resurs_FrameWin == WM_UNATTACHED) { //Stvorjujemo FrameWin Resurs_FrameWin = FRAMEWIN_CreateEx(X0, Y0, X_SIZE, Y_SIZE, 0, WM_CF_HIDE, 0, ID_RESURS_FRAMEWIN, Resurs_panel_title.ptitle[sel_language], _cbEmpty); FRAMEWIN_SetFont(Resurs_FrameWin, &GUI_FontArialBold14_8_Unicode); FRAMEWIN_SetTextAlign(Resurs_FrameWin, GUI_TA_HCENTER); FRAMEWIN_SetBarColor(Resurs_FrameWin, 1, GUI_GREEN); FRAMEWIN_SetBarColor(Resurs_FrameWin, 0, GUI_LIGHTGRAY); FRAMEWIN_SetTextColor(Resurs_FrameWin, GUI_BLUE); #define COL_1_X 5 #define ROW_1_Y 10 #define HIGHT_Y 10 #define SHIFT_Y (ROW_1_Y + HIGHT_Y) #define WIDTH_X_T 165 #define WIDTH_X_V 80 #define SHIFT_X1 (WIDTH_X_T + 10) #define SHIFT_X2 (SHIFT_X1 + WIDTH_X_V + 10) for (unsigned int i = 0; i < MAX_NUMBER_ITEMS_RESURS; i++) { Resurs_t[i] = TEXT_CreateEx(COL_1_X, ROW_1_Y + i*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Resurs_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_RESURS_1_TITLE + i, Resurs_title[i].ptitle[sel_language]); TEXT_SetFont(Resurs_t[i], &GUI_FontArialStandard14_8_Unicode); Resurs_v[i] = TEXT_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + i*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Resurs_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_RESURS_1_VALUE + i, ""); TEXT_SetFont(Resurs_v[i], &GUI_FontArialStandard14_8_Unicode); } #undef COL_1_X #undef ROW_1_Y #undef HIGHT_Y #undef SHIFT_Y #undef WIDTH_X_T #undef WIDTH_X_V #undef SHIFT_X1 #undef SHIFT_X2 } WM_BringToTop(Resurs_FrameWin); WM_ShowWindow(Resurs_FrameWin); }
/********************************************************************* * * xIconSelBtn_PopupWin */ void xIconSelBtn_PopupWin(xIconSelBtn_Handle hWin) { static xIconSelBtn_OBJ tWidget; static xIconSelBtn_OBJ *pWidget; GUI_RECT r; if(!hWin) return; DEBUGOUT("xIconSelBtn_PopupWin(hWin) = 0x%08x\r\n", hWin); BUTTON_GetUserData(hWin, &tWidget, sizeof(xIconSelBtn_OBJ)); pWidget = &tWidget; if(tWidget.hPopupWin == NULL) { r = tWidget.PopupWinRECT; DEBUGOUT("xIconSelBtn_PopupWin() new Window(%d,%d,%d,%d): %d items\r\n",r.x0,r.y0,r.x1,r.y1, tWidget.NumItems); tWidget.hPopupWin = WM_CreateWindowAsChild(r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0, NULL, //hParent WM_CF_SHOW, //WinFlags xIconSelBtn_PopupWin_Callback, //WM_CALLBACK * cb sizeof(xIconSelBtn_OBJ*) ); if(tWidget.hPopupWin == NULL) { DEBUGOUT("\t new Window creating failed!!!\r\n"); return; } tWidget.MovingIndex = tWidget.SelectedIndex; WM_SetUserData(tWidget.hPopupWin, &pWidget, sizeof(xIconSelBtn_OBJ*)); WM_SetFocus(tWidget.hPopupWin); } else { tWidget.MovingIndex = tWidget.SelectedIndex; WM_SetUserData(tWidget.hPopupWin, &pWidget, sizeof(xIconSelBtn_OBJ*)); WM_ShowWindow(tWidget.hPopupWin); WM_SetFocus(tWidget.hPopupWin); } }
/********************************************************************* * * _ShowPage */ static void _ShowPage(MULTIPAGE_Obj* pObj, unsigned Index) { WM_HWIN hWin = 0; WM_HWIN hChild; WM_Obj* pChild; WM_Obj* pClient = WM_H2P(pObj->hClient); if ((int)Index < pObj->Handles.NumItems) { MULTIPAGE_PAGE* pPage; pPage = (MULTIPAGE_PAGE*) GUI_ARRAY_GetpItem(&pObj->Handles, Index); hWin = pPage->hWin; } for (hChild = pClient->hFirstChild; hChild; hChild = pChild->hNext) { pChild = WM_H2P(hChild); if (hChild == hWin) { WM_ShowWindow(hChild); WM_SetFocus(hChild); } else { WM_HideWindow(hChild); } } }
/********************************************************************* * * _cbBk */ static void _cbBk(WM_MESSAGE * pMsg) { static WM_HWIN hEdit = 0; static U8 ShowText = 0; char aBuffer[TEXT_MAXLEN]; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetBkColor(GUI_DARKGRAY); GUI_Clear(); GUI_SetFont(&GUI_Font24_ASCII); GUI_DispStringHCenterAt("WIDGET_Edit - Sample", 160, 5); GUI_SetFont(&GUI_Font8x16); if (ShowText) { GUI_DispStringHCenterAt("The string you have modified is:", 160, 90); EDIT_GetText(hEdit, aBuffer, TEXT_MAXLEN); GUI_DispStringHCenterAt(aBuffer, 160, 110); } else { GUI_DispStringHCenterAt("Use keyboard to modify string...", 160, 90); } break; case WM_APP_SHOW_TEXT: if (hEdit == 0) { hEdit = pMsg->hWinSrc; } WM_HideWindow(hEdit); ShowText = 1; WM_InvalidateWindow(WM_HBKWIN); WM_CreateTimer(WM_HBKWIN, 0, 3000, 0); break; case WM_TIMER: ShowText = 0; WM_InvalidateWindow(WM_HBKWIN); WM_ShowWindow(hEdit); break; default: WM_DefaultProc(pMsg); } }
/*---------------------------------------------------------------------------* * Routine: _PFMainDialog *---------------------------------------------------------------------------* * Description: * Callback function used by emWin to process events. * Inputs: * WM_MESSAGE *pMsg -- message structure for current dialog. *---------------------------------------------------------------------------*/ static void _PFMainDialog(WM_MESSAGE *pMsg) { int Id, NCode; WM_HWIN hItem; GUI_PID_STATE *p_touchState; T_ImageMessage message; switch (pMsg->MsgId){ case WM_INIT_DIALOG: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; LAFSetup(pMsg->hWin, ID_WINDOW, PFMainLayout); hItem = WM_GetDialogItem(pMsg->hWin, ID_REVERSE_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_UNPRESSED, &REVERSE_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_PRESSED, &REVERSE_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_DISABLED, &REVERSE_BUTTON); hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_PAUSE_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_UNPRESSED, &PLAY_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_PRESSED, &PLAY_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_DISABLED, &PLAY_BUTTON); hItem = WM_GetDialogItem(pMsg->hWin, ID_FORWARD_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_UNPRESSED, &FORWARD_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_PRESSED, &FORWARD_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_DISABLED, &FORWARD_BUTTON); hItem = WM_GetDialogItem(pMsg->hWin, ID_SETTINGS_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_UNPRESSED, &SETTINGS_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_PRESSED, &SETTINGS_BUTTON); BUTTON_SetBitmap(hItem, BUTTON_BI_DISABLED, &SETTINGS_BUTTON); G_OverlayTimer = WM_CreateTimer(pMsg->hWin, ID_OVERLAY_TIMER, OVERLAY_TIMEOUT_MS, 0); G_UpdateTimer = WM_CreateTimer(pMsg->hWin, ID_UPDATE_TIMER, UPDATE_TIME_MS, 0); G_PictureChangeTimer = WM_CreateTimer(pMsg->hWin, ID_PICTURECHANGE_TIMER, 0, 0); if (!G_Current) { G_Current = GUI_MEMDEV_Create(0, 0, UEZ_LCD_DISPLAY_WIDTH, UEZ_LCD_DISPLAY_HEIGHT); GUI_MEMDEV_Select(G_Current); GUI_BMP_Draw(G_CurrentImage, 0, 0); GUI_MEMDEV_Select(0); } WM_SetHasTrans(pMsg->hWin); message = IMAGE_INITILIZE; UEZQueueSend(G_ImageLoadQueue, (void*)&message, 50); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; if( !LAFHandleEvent(PFMainLayout, pMsg, NCode, Id)){ //Handle special cases here } break; case WM_TIMER: NCode = pMsg->Data.v; if (G_Active) { if (NCode == G_OverlayTimer) { IHideButtonsAndText(pMsg); //Grab all the touches WM_SetCapture(pMsg->hWin, 0); } else if (NCode == G_PictureChangeTimer) { //put up new picture if(G_AutoPlayOn) { IHandleForward(pMsg, WM_NOTIFICATION_RELEASED, ID_FORWARD_BUTTON); WM_RestartTimer(G_PictureChangeTimer, 5000); } } else if (NCode == G_UpdateTimer) { IUpdateFields(pMsg); WM_RestartTimer(G_UpdateTimer, UPDATE_TIME_MS); } } break; case WM_TOUCH: p_touchState = (GUI_PID_STATE *)(pMsg->Data.p); if (!p_touchState->Pressed) { WM_RestartTimer(G_OverlayTimer, OVERLAY_TIMEOUT_MS); //Show all the hidden text on buttons hItem = WM_GetDialogItem(pMsg->hWin, ID_TITLE_TEXT); WM_ShowWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_SETTINGS_BUTTON); WM_ShowWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_REVERSE_BUTTON); WM_ShowWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_PAUSE_BUTTON); WM_ShowWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_FORWARD_BUTTON); WM_ShowWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMEDATE_TEXT); WM_ShowWindow(hItem); WM_ReleaseCapture(); IUpdateFields(pMsg); } break; case WM_POST_PAINT: GUI_BMP_Draw(G_CurrentImage, 0, 0); break; case WM_APP_GAINED_FOCUS: G_Active = ETrue; WM_SetCapture(pMsg->hWin, 0); IHideButtonsAndText(pMsg); IUpdateFields(pMsg); break; case WM_APP_LOST_FOCUS: G_Active = EFalse; IHideButtonsAndText(pMsg); WM_ReleaseCapture(); G_AutoPlayOn = EFalse; break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief Callback routine of the Benchmark 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; WM_HWIN hGraph; int cpu_speed = 0; char temp[50]; WM_CALLBACK *_cb; switch (pMsg->MsgId) { case WM_INIT_DIALOG: /* Initialization of 'CPU' */ hItem = pMsg->hWin; FRAMEWIN_SetFont(hItem, GUI_FONT_13HB_ASCII); FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0); hItem = TEXT_CreateEx(10, 20, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x123,""); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, 0x00804000); TEXT_SetText(hItem, "CPU Usage %:"); hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU); TEXT_SetFont(hItem, GUI_FONT_16B_ASCII); TEXT_SetTextColor(hItem, GUI_DARKRED); hItem = WM_GetDialogItem(pMsg->hWin, ID_CPU_GRAPH); FRAMEWIN_SetBarColor(hItem, 0, GUI_DARKGRAY); FRAMEWIN_SetBarColor(hItem, 1, GUI_DARKGRAY); hGraph = GRAPH_CreateEx(10, 35, 300, 95, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_GRAPH0); hData = GRAPH_DATA_YT_Create(GUI_LIGHTGREEN, 500, 0, 20); GRAPH_SetGridVis(hGraph, 1); GRAPH_SetBorder(hGraph, 20, 4, 5, 4); GRAPH_AttachData(hGraph, hData); hScale = GRAPH_SCALE_Create(20, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 25); GRAPH_AttachScale(hGraph, hScale); GRAPH_SCALE_SetTextColor(hScale, GUI_YELLOW); GRAPH_SetGridDistX(hGraph, 25); GRAPH_SetGridDistY(hGraph, 25); WM_CreateWindowAsChild(80, 45, 354, 23, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbCpuWindow , 0); 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 ID_BENCH_CPU: Stop_Test = 0; WM_HideWindow(pMsg->hWin); _cb = WM_GetCallback(WM_HBKWIN); WM_SetCallback(WM_HBKWIN, _ClearDesktop); cpu_speed = Run_SpeedTest(); WM_ShowWindow(pMsg->hWin); hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU); sprintf (temp, "%d Pixels/s ", cpu_speed); TEXT_SetText(hItem, temp); WM_SetCallback(WM_HBKWIN, _cb); hItem = WM_GetDialogItem(WM_HBKWIN, ID_BUTTON_BKGND); WM_InvalidateWindow(hItem); WM_InvalidateWindow(WM_HBKWIN); WM_Paint(WM_HBKWIN); break; } break; case WM_NOTIFICATION_CHILD_DELETED: Stop_Test = 1; break; } break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; WM_MESSAGE Msg; WM_HWIN hIteminfo; int i; int sel; uint8_t items; FRESULT res; // FILINFO fno; //DIR dir; // USER START (Optionally insert additional variables) // USER END hItem = pMsg->hWin; WINDOW_SetBkColor(hItem, GUI_LIGHTGRAY); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); //WM_SetFocus(hItem); switch (pMsg->MsgId) { case WM_INIT_DIALOG: hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetFont(hItem,&GUI_FontHZ_Song_12); TEXT_SetText(hItem, "自学习文件选择"); hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetFont(hIteminfo,&GUI_FontHZ_Song_12); TEXT_SetTextColor(hIteminfo,GUI_RED); TEXT_SetText(hIteminfo, (char *)"打开文件……"); WM_HideWindow(hIteminfo); // // Initialization of 'Dropdown' // hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); DROPDOWN_SetFont(hItem,&GUI_FontHZ_Song_12); DROPDOWN_AddString(hItem, "U盘"); DROPDOWN_AddString(hItem, "SD卡"); if(k_StorageGetStatus(MSD_DISK_UNIT) != 0) DROPDOWN_SetSel(hItem,1); else DROPDOWN_SetSel(hItem,0); // // Initialization of 'Treeview' // store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } LISTBOX_SetFont(hItem,GUI_FONT_20_1); LISTBOX_SetSel(hItem,TestFolder.number_CurrentFile); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK); BUTTON_SetFont(hItem,&GUI_FontHZ_Song_12); BUTTON_SetSkinClassic(hItem); BUTTON_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED, GUI_GREEN); BUTTON_SetFocussable(hItem,0);//不接收焦点 hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL); BUTTON_SetFont(hItem,&GUI_FontHZ_Song_12); BUTTON_SetSkinClassic(hItem); BUTTON_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED, GUI_RED); BUTTON_SetFocussable(hItem,0);//不接收焦点 // USER START (Optionally insert additional code for further widget initialization) // USER END break; case MY_MESSAGE_CLICK: GUI_SendKeyMsg(GUI_KEY_TAB, 1);//改变输入焦点 break; case MY_MESSAGE_DOWN: hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); if(WM_HasFocus(hItem)) { LISTBOX_IncSel(hItem); } hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); if(WM_HasFocus(hItem)) { sel=DROPDOWN_GetSel(hItem); if(sel<1) { DROPDOWN_IncSel(hItem); } else //sel>=1 { DROPDOWN_SetSel(hItem,0); } store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); items = LISTBOX_GetNumItems(hItem); for(i=0;i<items;i++) { LISTBOX_DeleteItem(hItem,0); } for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } } break; case MY_MESSAGE_UP: hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); if(WM_HasFocus(hItem)) { LISTBOX_DecSel(hItem); } hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); if(WM_HasFocus(hItem)) { sel=DROPDOWN_GetSel(hItem); if(sel>0) { DROPDOWN_DecSel(hItem); } else //sel>=1 { DROPDOWN_SetSel(hItem,1); } store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); items = LISTBOX_GetNumItems(hItem); for(i=0;i<items;i++) { LISTBOX_DeleteItem(hItem,0); } for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } } break; case MY_MESSAGE_CANCEL://取消 GUI_EndDialog(pMsg->hWin,0); break; case MY_MESSAGE_OK: hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetText(hIteminfo, (char *)"打开文件中……"); WM_ShowWindow(hIteminfo); GUI_Exec(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); TestFolder.number_CurrentFile=LISTBOX_GetSel(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); store_dev=DROPDOWN_GetSel(hItem); WT_TestItem_Init((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]); //WT_TestFile_Write2Flash((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]);//将文件内容复制到Flash //WT_TestFiles_Write2card((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]);//将文件内容复制到SD card if(TestFile.file_status == 1)//文件读取OK { Msg.MsgId = MY_MESSAGE_BUTTONOK; WM_SendMessage(pMsg->hWinSrc,&Msg); GUI_EndDialog(pMsg->hWin,0); } else { TEXT_SetText(hIteminfo, (char *)"读取文件错误!"); WM_ShowWindow(hIteminfo); } Msg.MsgId = MY_MESSAGE_BUTTONOK; WM_SendMessage(pMsg->hWinSrc,&Msg); GUI_EndDialog(pMsg->hWin,0); break; case MY_MESSAGE_BUTTONDELETE: hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); store_dev=DROPDOWN_GetSel(hItem); if(store_dev==0) //usb strcpy(filename,path_testfile); //f_opendir(&dir, path_testfile); if(store_dev==1) //sd strcpy(filename,path_testfile_sd); //f_opendir(&dir, path_testfile_sd); //res = f_opendir(&dir, "1:/LZY_WireTester/Test Files"); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); strcat(filename,"/"); sel = LISTBOX_GetSel(hItem); if(sel < 0) break; strcat(filename,(char *)TestFolder.FilesName[LISTBOX_GetSel(hItem)]); res=f_unlink((const TCHAR*)filename); if(res == FR_OK) { hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); items = LISTBOX_GetNumItems(hItem); for(i=0;i<items;i++) { LISTBOX_DeleteItem(hItem,0); } for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } WM_SetFocus(hItem); if(sel > 0) LISTBOX_SetSel(hItem,sel - 1); else LISTBOX_SetSel(hItem,0); } break; case WM_PAINT://绘制标题栏 GUI_SetColor(GUI_DARKBLUE); GUI_FillRect(0,0,380,22); GUI_SetColor(GUI_DARKGRAY); GUI_SetPenSize(8); GUI_DrawRect(0,0,378,220); break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * GUIDEMO_ShowInfoWin */ void GUIDEMO_ShowInfoWin(void) { WM_ShowWindow(_hDialogInfo); }
/********************************************************************* * * GUIDEMO_ShowControlWin */ void GUIDEMO_ShowControlWin(void) { WM_ShowWindow(_hDialogControl); GUI_Exec(); }
/********************************************************************* * * _ShowProgress */ static void _ShowProgress(void) { PROGBAR_Handle hProg; hProg = WM_GetDialogItem(_hDialogControl, GUI_ID_PROGBAR0); WM_ShowWindow(hProg); }
/** * @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 the video main dialog * @param pMsg: pointer to a data structure of type WM_MESSAGE * @retval None */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; static uint8_t sel = 0; switch (pMsg->MsgId) { case WM_INIT_DIALOG: memset(Video_Path, 0, 256); hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT); WM_SetCallback(hItem, _cbButton_exit); hItem = ST_AnimatedIconView_CreateEx(120, 50, LCD_GetXSize() - 220, LCD_GetYSize() - 150, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS , 0, ID_ICONVIEW_SUBMENU, 240, 300, 100, 5); ST_AnimatedIconView_SetDualFont(hItem, &GUI_FontLubalGraph24, &GUI_FontLubalGraph24); ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_Y, 5); ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_X, 25); ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_Y, 10); ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_X, 5); ST_AnimatedIconView_SetSel(hItem, -1); ST_AnimatedIconView_SetTextColor(hItem, ICONVIEW_CI_UNSEL, GUI_STCOLOR_LIGHTBLUE); ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_UNSEL, GUI_WHITE); ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_SEL, GUI_WHITE); ST_AnimatedIconView_SetDualTextColor(hItem, ICONVIEW_CI_SEL, GUI_STCOLOR_LIGHTBLUE, GUI_STCOLOR_DARKBLUE); ST_AnimatedIconView_AddIcon(hItem, open_file, 0, "Play video"); ST_AnimatedIconView_AddIcon(hItem, add_video, 0, "Open playlist"); break; case WM_PAINT: GUI_SetColor(GUI_BLACK); GUI_DrawLine(799, 0, 799, 480); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch(Id) { case ID_BUTTON_EXIT: switch(NCode) { case WM_NOTIFICATION_CLICKED: /* avoid icon view animation */ hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU); WM_HideWindow(hItem); break; case WM_NOTIFICATION_MOVED_OUT: hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU); WM_ShowWindow(hItem); break; case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_ICONVIEW_SUBMENU: switch(NCode) { case WM_NOTIFICATION_RELEASED: sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc); if(sel == 0) { if(VNC_IsRunning() == 0) { /* Playlist not empty, so start play first item */ if(VideoList.ptr > 0) { GUI_SetLayerVisEx (1, 1); GUI_SelectLayer(1); playbackwin = WM_CreateWindowAsChild(0, 0, 800, 480, WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbplaybackwin , 0); WM_CreateWindowAsChild(100, 100, 600, 280, WM_GetDesktopWindowEx(1), WM_CF_SHOW | WM_CF_HASTRANS, _cbTouch , 0); GUI_SelectLayer(0); _StartPlay(&hvideo, (char *)VideoList.file[0].name, &Video_File, 0, 0); VideoPlayer_State = VIDEO_PLAY; hFrame = WM_CreateWindowAsChild(0, 0, 800, 480,pMsg->hWin, WM_CF_SHOW, _cbVideoWindow , 0); GUI_SelectLayer(1); } else {/* There is no item yet in the playlist: Show hint message */ hItem = GUI_CreateDialogBox(_aFileInfoDialogCreate, GUI_COUNTOF(_aFileInfoDialogCreate), _cbFileInfoDialog, pMsg->hWin, 100, 50); WM_MakeModal(hItem); } } else { hItem = GUI_CreateDialogBox(_aFileErrorDialogCreate, GUI_COUNTOF(_aFileErrorDialogCreate), _cbFileInfoDialog, pMsg->hWin, 100, 50); WM_MakeModal(hItem); } } else if(sel == 1) { hPlaylistWin = GUI_CreateDialogBox(_aPlaylistDialogCreate, GUI_COUNTOF(_aPlaylistDialogCreate), _cbPlaylistDialog, pMsg->hWin, 100, 50); WM_MakeModal(hPlaylistWin); } break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; int i; switch (pMsg->MsgId) { case WM_INIT_DIALOG: GUI_UC_SetEncodeUTF8(); // // Initialization of 'Multiedit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0); MULTIEDIT_SetFont(hItem,&GUI_Font_Song_16); MULTIEDIT_SetWrapWord(hItem);//启用自动换行 MULTIEDIT_SetReadOnly(hItem,1);//只读模式 //MULTIEDIT_SetText(hItem, FHD_PDA); for(i = 0;i < 14;i++) { MULTIEDIT_AddText(hItem, helpText[i]); } hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_0); BUTTON_SetBkColor(hItem,0,GUI_YELLOW); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); #if 0 hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_1); BUTTON_SetBkColor(hItem,0,GUI_GREEN); WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE); #endif break; case WM_KEY: { 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_Help); g_hWin_Help=WM_HWIN_NULL; WM_ShowWindow(g_hWin_TimeBar); WM_ShowWindow(g_hWin_Date); WM_SetFocus(g_hWin_Menu); break; case GUI_KEY_GREEN: //GUI_WARN(g_hWin_Help, GUI_MSBOX_UPDATE_CFM); //GUI_WARN(g_hWin_Help,8); //DEV_Power_Off(); //while(1); break; } } } break; default: WM_DefaultProc(pMsg); break; } }