/** * @brief set the GUI profile * @param None. * @retval None */ void k_SetGuiProfile(void) { settings.d32 = k_BkupRestoreParameter(CALIBRATION_GENERAL_SETTINGS_BKP); if(settings.b.disable_flex_skin == 0) { FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX); PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX); RADIO_SetDefaultSkin(RADIO_SKIN_FLEX); SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); SLIDER_SetDefaultSkin(SLIDER_SKIN_FLEX); SPINBOX_SetDefaultSkin(SPINBOX_SKIN_FLEX); BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX); DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX); FRAMEWIN_SetDefaultTextColor(0, GUI_DARKGRAY); FRAMEWIN_SetDefaultTextColor(1, GUI_DARKGRAY); } else { FRAMEWIN_SetDefaultTextColor(0, GUI_WHITE); FRAMEWIN_SetDefaultTextColor(1, GUI_WHITE); } FRAMEWIN_SetDefaultFont(GUI_FONT_24_ASCII); FRAMEWIN_SetDefaultClientColor(GUI_LIGHTGRAY | 0x20F50000); FRAMEWIN_SetDefaultTitleHeight(25); TREEVIEW_SetDefaultBkColor(TREEVIEW_CI_SEL, GUI_LIGHTGRAY | 0x20E50000); TREEVIEW_SetDefaultBkColor(TREEVIEW_CI_UNSEL, GUI_LIGHTGRAY | 0x20E50000); TREEVIEW_SetDefaultTextColor(TREEVIEW_CI_SEL, GUI_BLUE); TREEVIEW_SetDefaultFont(GUI_FONT_20_ASCII); WINDOW_SetDefaultBkColor(GUI_LIGHTGRAY | 0x20E50000); MULTIPAGE_SetDefaultBkColor(GUI_LIGHTGRAY | 0x20E50000, 0); MULTIPAGE_SetDefaultBkColor(GUI_LIGHTGRAY | 0x20E50000, 1); MULTIPAGE_SetDefaultFont(GUI_FONT_20_ASCII); CHECKBOX_SetDefaultBkColor(GUI_LIGHTGRAY | 0x20E50000); CALENDAR_SetDefaultSize(CALENDAR_SI_HEADER, 40 ); CALENDAR_SetDefaultSize(CALENDAR_SI_CELL_X, 33 ); CALENDAR_SetDefaultSize(CALENDAR_SI_CELL_Y, 33 ); MULTIPAGE_SetDefaultBkColor (GUI_WHITE, 1); SPINBOX_SetDefaultButtonSize(25); LISTVIEW_SetDefaultGridColor(GUI_WHITE); SCROLLBAR_SetDefaultWidth(16); HEADER_SetDefaultBkColor(0x00C5903E); HEADER_SetDefaultTextColor(GUI_WHITE); SCROLLBAR_SetDefaultColor(GUI_LIGHTGRAY | 0x20F50000, SCROLLBAR_CI_THUMB); SCROLLBAR_SetDefaultColor(GUI_LIGHTGRAY | 0x20F50000, SCROLLBAR_CI_SHAFT); SCROLLBAR_SetDefaultColor(GUI_LIGHTGRAY | 0x20F50000, SCROLLBAR_CI_ARROW); CHOOSEFILE_SetDelim('/'); GUI_SetDefaultFont(GUI_FONT_13_ASCII); }
/********************************************************************* * * 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(); }
/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX); BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX); RADIO_SetDefaultSkin(RADIO_SKIN_FLEX); CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX); HEADER_SetDefaultSkin(HEADER_SKIN_FLEX); GUI_CURSOR_Show(); WM_SetCallback(WM_HBKWIN, _cbBkWin); while (1) { GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, 0, 0, 0); GUI_Delay(1000); } }
/********************************************************************* * * 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(); } }
/********************************************************************* * * _EnableSkinning */ static void _EnableSkinning(void) { FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX); BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); }