/** * @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); }
/********************************************************************* * * MainTask */ void MainTask(void) { WM_HWIN hTree; TREEVIEW_ITEM_Handle hNode; int xSize, ySize; char acBuffer[(TREEVIEW_DEPTH << 1) + 1]; // // Initialize emWin // WM_SetCreateFlags(WM_CF_MEMDEV); GUI_Init(); xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); // // Set defaults for background and widgets // WM_SetCallback(WM_HBKWIN, _cbBk); SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); SCROLLBAR_SetDefaultWidth(20); SCROLLBAR_SetThumbSizeMin(25); // // // GUI_SetFont(GUI_FONT_24_ASCII); GUI_DispStringHCenterAt("Customized TREEVIEW widget", 160, 5); // // Create TREEVIEW // hTree = TREEVIEW_CreateEx(0, 35, xSize, ySize - 35, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS, 0, GUI_ID_TREEVIEW0); TREEVIEW_SetAutoScrollV(hTree, 1); TREEVIEW_SetFont(hTree, GUI_FONT_24_ASCII); TREEVIEW_SetIndent(hTree, 30); TREEVIEW_SetTextIndent(hTree, 20); TREEVIEW_SetImage(hTree, TREEVIEW_BI_PLUS, &bmPlus); TREEVIEW_SetImage(hTree, TREEVIEW_BI_MINUS, &bmMinus); TREEVIEW_SetImage(hTree, TREEVIEW_BI_CLOSED, &bmClosed); TREEVIEW_SetImage(hTree, TREEVIEW_BI_OPEN, &bmOpen); TREEVIEW_SetImage(hTree, TREEVIEW_BI_LEAF, &bmLeaf); TREEVIEW_SetBitmapOffset(hTree, TREEVIEW_BI_PM, -21, -6); TREEVIEW_SetOwnerDraw(hTree, _TREEVIEW_OwnerDraw); TREEVIEW_SetBkColor(hTree, TREEVIEW_CI_SEL, USER_COLOR); TREEVIEW_SetBkColor(hTree, TREEVIEW_CI_UNSEL, GUI_BLACK); TREEVIEW_SetTextColor(hTree, TREEVIEW_CI_SEL, GUI_WHITE); TREEVIEW_SetTextColor(hTree, TREEVIEW_CI_UNSEL, GUI_WHITE); WIDGET_SetEffect(hTree, &WIDGET_Effect_None); // // Fill TREEVIEW // hNode = TREEVIEW_InsertItem(hTree, TREEVIEW_ITEM_TYPE_NODE, 0, 0, "Tree"); _FillNode(hTree, hNode, NUM_CHILD_NODES, NUM_CHILD_ITEMS, TREEVIEW_DEPTH, TREEVIEW_DEPTH, acBuffer, acBuffer); TREEVIEW_ITEM_Expand(hNode); WM_SetFocus(hTree); while (1) { GUI_Delay(100); } }
/** * @brief set the GUI profile * @param None. * @retval None. */ void k_SetGuiProfile(void) { SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX); DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX); FRAMEWIN_SetDefaultTextColor(0, GUI_WHITE); FRAMEWIN_SetDefaultTextColor(1, GUI_WHITE); FRAMEWIN_SetDefaultBarColor(0, 0x00DCA939); FRAMEWIN_SetDefaultBarColor(1, 0x00DCA939); FRAMEWIN_SetDefaultFont(&GUI_FontITCAvantGardeStdBk20); FRAMEWIN_SetDefaultClientColor(GUI_WHITE); FRAMEWIN_SetDefaultTitleHeight(25); WINDOW_SetDefaultBkColor(GUI_WHITE); LISTVIEW_SetDefaultGridColor(GUI_WHITE); LISTVIEW_SetDefaultBkColor(LISTVIEW_CI_SEL, 0x00DCA939); DROPDOWN_SetDefaultColor(DROPDOWN_CI_SEL, 0x00DCA939); LISTVIEW_SetDefaultBkColor(LISTVIEW_CI_SELFOCUS, 0x00DCA939); DROPDOWN_SetDefaultColor(DROPDOWN_CI_SELFOCUS, 0x00DCA939); SCROLLBAR_SetDefaultWidth(16); HEADER_SetDefaultBkColor(0x00DCA939); HEADER_SetDefaultTextColor(GUI_WHITE); HEADER_SetDefaultFont(&GUI_FontITCAvantGardeStdBk20); SCROLLBAR_SetDefaultColor(0x00DCA939, SCROLLBAR_CI_THUMB); SCROLLBAR_SetDefaultColor(0x00DCA939, SCROLLBAR_CI_SHAFT); SCROLLBAR_SetDefaultColor(0x00DCA939, SCROLLBAR_CI_ARROW); CHOOSEFILE_SetDelim('/'); GUI_SetDefaultFont(GUI_FONT_20_ASCII); TEXT_SetDefaultTextColor(0x00DCA939); TEXT_SetDefaultFont(&GUI_FontLubalGraphXLtBT20); }
/********************************************************************* * * MainTask */ void MainTask(void) { TREEVIEW_ITEM_Handle hNode; WM_HWIN hTree; int xSize; int ySize; int yPos; int r; int TimeStart; int TimeUsed; int ySizeText; U32 BytesFree; U32 BytesUsed; char acBuffer[(TREEVIEW_DEPTH << 1) + 1]; char acNumNodes[30] = "Nodes: "; char acNumLeaves[30] = "Leaves: "; char acNumTotal[30] = "Total: "; char acTimeUsed[30] = "Time: "; char acBytesUsed[30] = "Memory: "; // // Initialize emWin // WM_SetCreateFlags(WM_CF_MEMDEV); GUI_Init(); xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); // // Set defaults for background and widgets // WM_SetDesktopColor(GUI_BLACK); SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); SCROLLBAR_SetDefaultWidth(20); SCROLLBAR_SetThumbSizeMin(25); TEXT_SetDefaultFont(GUI_FONT_6X8); // // Draw info message before creating the widgets // GUI_DrawGradientV(0, 0, xSize - 1, ySize - 1, GUI_BLUE, GUI_BLACK); GUI_SetFont(GUI_FONT_20F_ASCII); GUI_DispStringHCenterAt("Filling TREEVIEW widget...", xSize >> 1, ySize / 3); GUI_X_Delay(1000); // // Create TREEVIEW // hTree = TREEVIEW_CreateEx(0, 0, xSize, ySize, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TREEVIEW0); TREEVIEW_SetAutoScrollV(hTree, 1);//管理自动使用垂直滚动条。 TREEVIEW_SetSelMode(hTree, TREEVIEW_SELMODE_ROW); // // Fill TREEVIEW // hNode = TREEVIEW_InsertItem(hTree, TREEVIEW_ITEM_TYPE_NODE, 0, 0, "Tree"); BytesFree = GUI_ALLOC_GetNumFreeBytes(); TimeStart = GUI_GetTime(); r = _FillNode(hTree, hNode, NUM_CHILD_NODES, NUM_CHILD_ITEMS, TREEVIEW_DEPTH, TREEVIEW_DEPTH, acBuffer, acBuffer); TimeUsed = GUI_GetTime() - TimeStart; BytesUsed = BytesFree - GUI_ALLOC_GetNumFreeBytes(); if (r) { // // Error message // WM_DeleteWindow(hTree); GUI_MessageBox("Error", "Not enough memory available!", 0); } else { // // Show result // yPos = 20; ySizeText = GUI_GetYDistOfFont( TEXT_GetDefaultFont()) + 5; _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumNodes, _NumNodes); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumLeaves, _NumLeaves); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumTotal, _NumNodes + _NumLeaves); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acTimeUsed, TimeUsed); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acBytesUsed, BytesUsed); WM_SetFocus(hTree); } while (1) { GUI_Delay(100); } }