void MainTask(void) { static GUI_PID_STATE OldState; GUI_PID_STATE CurrentState; int tEnd; GUI_Init(); BUTTON_SetReactOnLevel(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } do { WM_HWIN hButton0, hButton1; WM_SetCallback(WM_HBKWIN, _cbBkWin); hButton0 = _CreateButton(100, 220, 170, 150, 5, 25, "Dashboard" , &bmDashboard , GUI_ID_BUTTON0); hButton1 = _CreateButton(370, 220, 170, 150, 5, 25, "Cash Terminal", &bmCashTerminal, GUI_ID_BUTTON1); WM_SetFocus(hButton0); tEnd = GUI_GetTime() + 4000; do { GUI_PID_GetState(&CurrentState); if ((OldState.x != CurrentState.x) || (OldState.y != CurrentState.y)) { tEnd = GUI_GetTime() + 10000; } OldState = CurrentState; GUI_Delay(100); if (GUI_GetTime() >= tEnd) { if (_AppSelectionOld) { _AppSelection = ((_AppSelectionOld - 1) ^ 1) + 1; } else { _AppSelection = APP_DASHBOARD; } } } while (!_AppSelection && !_Break); WM_DeleteWindow(hButton0); WM_DeleteWindow(hButton1); if (!_Break) { switch (_AppSelection) { case APP_DASHBOARD: AppDashBoard(); break; case APP_CASHTERMINAL: AppCashTerminal(); break; } GUI_CURSOR_Hide(); _AppSelectionOld = _AppSelection; _AppSelection = 0; } } while (!_Break); }
/********************************************************************* * * GUIDEMO_Main */ void GUIDEMO_Main(void) { FRAMEWIN_SKINFLEX_PROPS Framewin_Props; #if GUIDEMO_USE_AUTO_BK int NumFreeBytes; int BitsPerPixel; #endif GUI_MEMDEV_SetAnimationCallback(_cbEffect, (void *)&_Pressed); WM_SetCallback(WM_HBKWIN, _cbBk); BUTTON_SetReactOnLevel(); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); FRAMEWIN_SetDefaultSkin (_FRAMEWIN_DrawSkinFlex); PROGBAR_SetDefaultSkin (PROGBAR_SKIN_FLEX); BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); SCROLLBAR_SetDefaultSkin (SCROLLBAR_SKIN_FLEX); SLIDER_SetDefaultSkin (SLIDER_SKIN_FLEX); HEADER_SetDefaultSkin (HEADER_SKIN_FLEX); GUI_SetTextMode (GUI_TM_TRANS); GUIDEMO_Config(&_GUIDemoConfig); #if GUIDEMO_USE_VNC if (GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_VNC)) { _GUIDemoConfig.pGUI_VNC_X_StartServer(0, 0); } #endif #if GUIDEMO_USE_AUTO_BK // // Determine if HW has enough memory to draw the gradient circle as background // BitsPerPixel = LCD_GetBitsPerPixel(); if ((BitsPerPixel >= 16) && GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_AUTO_BK)) { NumFreeBytes = GUI_ALLOC_GetNumFreeBytes(); if (NumFreeBytes > NUMBYTES_NEEDED) { _pfDrawBk = _DrawBkCircle; } else { _pfDrawBk = _DrawBk; } } else #endif { _pfDrawBk = _DrawBkSimple; } GUIDEMO_SetDrawLogo(1); while (1) { _Main(); } }
/********************************************************************* * * GUIDEMO_Main */ void GUIDEMO_Main(void) { FRAMEWIN_SKINFLEX_PROPS Framewin_Props; #if AUTO_BK int NumFreeBytes; int BitsPerPixel; #endif GUI_MEMDEV_SetAnimationCallback(_cbEffect, (void *)&_Pressed); WM_SetCallback(WM_HBKWIN, _cbBk); BUTTON_SetReactOnLevel(); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); FRAMEWIN_SetDefaultSkin (_FRAMEWIN_DrawSkinFlex); PROGBAR_SetDefaultSkin (PROGBAR_SKIN_FLEX); BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); SCROLLBAR_SetDefaultSkin (SCROLLBAR_SKIN_FLEX); SLIDER_SetDefaultSkin (SLIDER_SKIN_FLEX); HEADER_SetDefaultSkin (HEADER_SKIN_FLEX); GUI_SetTextMode (GUI_TM_TRANS); #if GUIDEMO_USE_VNC GUI_VNC_X_StartServer(0, 0); #endif #if AUTO_BK // Commented out as hardware is not fast enough to draw gradient background. Can be used on faster targets like ARM9 // // Determine if HW has enough memory to draw the gradient circle as background // BitsPerPixel = LCD_GetBitsPerPixel(); if (BitsPerPixel >= 16) { NumFreeBytes = GUI_ALLOC_GetNumFreeBytes(); if (NumFreeBytes > NUMBYTES_NEEDED) { _pfDrawBk = _DrawBkCircle; } else { _pfDrawBk = _DrawBk; } } else { _pfDrawBk = _DrawBkSimple; } #else _pfDrawBk = _DrawBkSimple; #endif _Main(); }
/********************************************************************* * * GUIDEMO_Main */ void GUIDEMO_Main(void) { FRAMEWIN_SKINFLEX_PROPS Framewin_Props; #if GUIDEMO_USE_AUTO_BK int NumFreeBytes; int BitsPerPixel; #endif /*设置在处理动画时要调用的的处理函数,决定终止或继续动画,——cbEffect,用户定义的回调函数*/ GUI_MEMDEV_SetAnimationCallback(_cbEffect, (void *)&_Pressed); /*设置窗口的回调例程*/ WM_SetCallback(WM_HBKWIN, _cbBk); /*将所有按钮设置对水平做出反应*/ BUTTON_SetReactOnLevel(); /*返回framewin皮肤属性*/ FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE);/*FRAMEWIN_SKINFLEX_PI_ACTIVE活动状态的属性*/ Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE);/*FRAMEWIN_SKINFLEX_PI_INACTIVE非活动状态的属性*/ Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); /*设置新创建窗口小工具的皮肤*/ FRAMEWIN_SetDefaultSkin (_FRAMEWIN_DrawSkinFlex/*FRAMEWIN_SKIN_FLEX的换肤回调函数*/); /*设置新创建的PROGBAR小工具的皮肤****/ PROGBAR_SetDefaultSkin (PROGBAR_SKIN_FLEX); /*设置新创建的 BUTTON 小工具的皮肤****/ BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); /*设置新创建的 SCROLLBAR滑块 小工具的皮肤****/ SCROLLBAR_SetDefaultSkin (SCROLLBAR_SKIN_FLEX); /*设置新创建的 滑块 小工具的皮肤****/ SLIDER_SetDefaultSkin (SLIDER_SKIN_FLEX); /*设置新创建的 heder 小工具的皮肤****/ HEADER_SetDefaultSkin (HEADER_SKIN_FLEX); /* 设置文本绘制模式 */ GUI_SetTextMode (GUI_TM_TRANS); #if GUIDEMO_USE_VNC if (GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_VNC)) { _GUIDemoConfig.pGUI_VNC_X_StartServer(0, 0); } #endif #if GUIDEMO_USE_AUTO_BK // // Determine if HW has enough memory to draw the gradient circle as background // BitsPerPixel = LCD_GetBitsPerPixel(); if ((BitsPerPixel >= 16) && GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_AUTO_BK)) { NumFreeBytes = GUI_ALLOC_GetNumFreeBytes(); if (NumFreeBytes > NUMBYTES_NEEDED) { _pfDrawBk = _DrawBkCircle; } else { _pfDrawBk = _DrawBk; } } else #endif { _pfDrawBk = _DrawBkSimple; } GUIDEMO_SetDrawLogo(1); while (1) { _Main(); } }