/********************************************************************* * * _cbFrameWinControl */ static void _cbFrameWinControl(WM_MESSAGE * pMsg) { WM_HWIN hItem; int xSize; int ySize; int NCode; int Id; switch (pMsg->MsgId) { case WM_KEY: WM_SendMessage(WM_HBKWIN, pMsg); break; case WM_INIT_DIALOG: hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_PROGBAR0); PROGBAR_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); PROGBAR_SetFont(hItem, &GUI_FontD6x8); hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_HALT); BUTTON_SetFocussable(hItem, 0); hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_NEXT); BUTTON_SetFocussable(hItem, 0); hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0); TEXT_SetText(hItem, "Intro"); TEXT_SetFont(hItem, &GUI_Font8_ASCII); break; case WM_PAINT: xSize = WM_GetWindowSizeX(pMsg->hWin); ySize = WM_GetWindowSizeY(pMsg->hWin); GUI_DrawGradientV(0, 0, xSize - 1, ySize - 1, 0xFFFFFF, 0xDCCEC0); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (NCode) { case WM_NOTIFICATION_RELEASED: switch (Id) { case GUI_ID_HALT: if (_Halt) { _Halt = 0; _HaltTime = GUI_GetTime() - _HaltTimeStart; WM_MakeModal(0); } else { _Halt = 1; _HaltTimeStart = GUI_GetTime() - _HaltTime; WM_MakeModal(pMsg->hWin); } break; case GUI_ID_NEXT: _Next = 1; // Will be set to 0 by GUIDEMO_GetNextState() _ClearHalt(); // Clear _Halt, so the next sample demonstrates immediately break; } break; } break; default: WM_DefaultProc(pMsg); } }
/********************************************************************* * * _Main */ static void _Main(void) { int xSize; int ySize; WM_SelectWindow(WM_HBKWIN); GUI_Clear(); #if (GUI_SUPPORT_CURSOR | GUI_SUPPORT_TOUCH) // GUI_CURSOR_Show(); #endif // // Create and configure Control and Information window // xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); _hDialogControl = GUI_CreateDialogBox(_aFrameWinControl, GUI_COUNTOF(_aFrameWinControl), &_cbFrameWinControl, WM_HBKWIN, xSize - CONTROL_SIZE_X, ySize - CONTROL_SIZE_Y); _hDialogInfo = GUI_CreateDialogBox(_aFrameWinInfo, GUI_COUNTOF(_aFrameWinInfo), &_cbFrameWinInfo, WM_HBKWIN, (xSize >> 1) - 1, 0); WM_HideWindow(_hDialogInfo); // // Show Intro // WM_InvalidateWindow(_hDialogControl); WM_DisableMemdev(WM_HBKWIN); GUI_Exec(); WM_EnableMemdev(WM_HBKWIN); GUI_SetBkColor(GUI_RED); GUI_Clear(); GUI_SetBkColor(GUI_GREEN); GUI_Clear(); GUI_SetBkColor(GUI_BLUE); GUI_Clear(); GUIDEMO_Intro(); // // Run the demos // for (_iDemo = 0; _GUIDemoConfig.apFunc[_iDemo]; _iDemo++) { _ClearHalt(); GUIDEMO_UpdateControlText(); (*_GUIDemoConfig.apFunc[_iDemo])(); _iDemoMinor = 0; _Pressed = 0; } _iDemo = 0; // // Cleanup // WM_DeleteWindow(_hDialogControl); WM_DeleteWindow(_hDialogInfo); #if (GUI_SUPPORT_CURSOR | GUI_SUPPORT_TOUCH) GUI_CURSOR_Hide(); #endif }
/********************************************************************* * * GUIDEMO_NotifyStartNext * * Use this function if the next step of the current sample will be * shown immediately */ void GUIDEMO_NotifyStartNext(void) { _iDemoMinor++; _ClearHalt(); GUIDEMO_UpdateControlText(); }