static void _Show(const char* s0, const char* s1) { GUIDEMO_SetColor(GUI_WHITE); #if (LCD_YSIZE < 160) GUI_SetFont(&GUI_Font8_ASCII); #else GUI_SetFont(&GUI_Font13B_ASCII); #endif GUI_DispString("\n"); #if (LCD_YSIZE < 128) GUIDEMO_Delay(200); GUI_GotoXY(0, LCD_YSIZE / 2 - 6); GUI_ClearRect(0, 24, LCD_XSIZE - 1, LCD_YSIZE - 1); GUIDEMO_Delay(200); #endif GUI_DispString(s0); GUIDEMO_Delay(500); #if GUIDEMO_LARGE GUI_GotoX(110); GUIDEMO_SetColor(GUI_GREEN); #else GUI_GotoX(100); GUIDEMO_SetColor(GUI_BLUE); #endif #if (LCD_XSIZE < 320) GUI_DispString("\n"); #if (LCD_XSIZE < 200) GUI_GotoX(10); #else GUI_GotoX(LCD_XSIZE / 6); #endif #endif GUI_DispString(s1); GUIDEMO_Delay(1500); }
void GUIDEMO_Intro(void) { int xCenter = LCD_GET_XSIZE() / 2; int y; char acText[50] = "Version of uC/GUI: "; strcat(acText, GUI_GetVersionString()); GUI_SetBkColor(GUI_BLUE); GUI_SetColor(GUI_YELLOW); GUI_Clear(); GUI_SetFont(&GUI_Font13B_1); GUI_DispStringHCenterAt("uC/GUI", xCenter, y= 10); GUI_SetFont(&GUI_Font10_ASCII); GUI_SetColor(GUI_WHITE); GUI_DispStringHCenterAt("Universal graphic software" "\nfor embedded applications" , xCenter, y += 20); GUI_SetFont(&GUI_Font10S_ASCII); GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25); GUI_DispStringHCenterAt(acText, xCenter, y += 16); GUIDEMO_Delay(5000); GUI_Clear(); GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, 6); GUI_SetFont(&GUI_Font13B_1); GUI_DispStringHCenterAt("www.micrium.com", LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() - 50); GUIDEMO_Delay(5000); }
/******************************************************************* * * _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(); }
/******************************************************************* * * _DemoCreateWindow Demonstrates the use of WM_CreateWindow */ static void _DemoCreateWindow(void) { /* Set callback for background window */ _cbBkWindowOld = WM_SetCallback(WM_HBKWIN, _cbBkWindow); /* Create windows */ _ChangeInfoText("WM_CreateWindow()"); // GUIDEMO_Delay(SPEED); _hWindow1 = WM_CreateWindow( 50, 70, 165, 100, WM_CF_SHOW | WM_CF_MEMDEV, _cbWindow1, 0); GUIDEMO_Delay(SPEED/3); _hWindow2 = WM_CreateWindow(105, 125, 165, 100, WM_CF_SHOW | WM_CF_MEMDEV, _cbWindow2, 0); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/********************************************************************* * * GUIDEMO_DemoFrameWin */ void GUIDEMO_DemoFrameWin(void) { FRAMEWIN_Handle hFrame; LISTBOX_Handle hListBox; int xSize = LCD_GetXSize(); int ySize = LCD_GetYSize(); int i, x, y, w, h; const GUI_FONT* pFont = &GUI_FontComic18B_1; GUI_COLOR DesktopColorOld; #if GUIDEMO_LARGE GUIDEMO_ShowIntro("Frame Window & Listbox", NULL); #else GUIDEMO_ShowIntro("Frame Window\n & Listbox", NULL); #endif DesktopColorOld = GUIDEMO_SetBkColor(GUI_RED); DesktopColorOld = WM_SetDesktopColor(DesktopColorOld); /* Automatically update desktop window */ x = BORDER; #if GUIDEMO_LARGE y = 75; #else y = BORDER; #endif w = xSize - x - BORDER; h = ySize - y - BORDER; if (w > 140) { w = 140; } if (h > 120) { h = 120; } hFrame = FRAMEWIN_Create("Select language", NULL, WM_CF_SHOW, x, y, w, h); FRAMEWIN_SetActive(hFrame, 1); FRAMEWIN_SetMoveable(hFrame, 1); FRAMEWIN_AddMaxButton(hFrame, FRAMEWIN_BUTTON_RIGHT, 0); FRAMEWIN_AddMinButton(hFrame, FRAMEWIN_BUTTON_RIGHT, 1); FRAMEWIN_SetFont(hFrame, &GUI_Font13_ASCII); hListBox = LISTBOX_CreateAsChild(_asLang, WM_GetClientWindow(hFrame), 0, 0, 0, 0, WM_CF_SHOW | WM_SF_ANCHOR_LEFT | WM_SF_ANCHOR_TOP | WM_SF_ANCHOR_RIGHT | WM_SF_ANCHOR_BOTTOM); WM_SetFocus(hListBox); LISTBOX_SetFont(hListBox, pFont); GUIDEMO_Wait(); for (i = 0; (i < 10) && !GUIDEMO_CheckCancel(); i++) { LISTBOX_IncSel(hListBox); GUIDEMO_Delay(250); } for (i = 0; (i < 10) && !GUIDEMO_CheckCancel(); i++) { LISTBOX_DecSel(hListBox); GUIDEMO_Delay(250); } GUIDEMO_Delay(500); LISTBOX_Delete(hListBox); FRAMEWIN_Delete(hFrame); WM_SetDesktopColor(DesktopColorOld); }
/******************************************************************* * * _DemoDeleteWindow Demonstrates the use of WM_DeleteWindow */ static void _DemoDeleteWindow(void) { _ChangeInfoText("WM_DeleteWindow()"); // GUIDEMO_Delay(SPEED); WM_DeleteWindow(_hWindow2); GUIDEMO_Delay(SPEED/3); WM_DeleteWindow(_hWindow1); GUIDEMO_Delay(SPEED); _ChangeInfoText(""); GUIDEMO_Delay(SPEED); /* Restore background callback and window colors */ WM_SetCallback(WM_HBKWIN, _cbBkWindowOld); _WindowColor1 = GUI_GREEN; _WindowColor2 = GUI_RED; }
/******************************************************************* * * _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(); }
/******************************************************************* * * _DemoBringToBottom Demonstrates the use of WM_BringToBottom */ static void _DemoBringToBottom(void) { _ChangeInfoText("WM_BringToBottom()"); // GUIDEMO_Delay(SPEED); WM_BringToBottom(_hWindow1); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/******************************************************************* * * _DemoResizeWindow Demonstrates the use of WM_ResizeWindow */ static void _DemoResizeWindow(void) { int i, tm,tDiff; _ChangeInfoText("WM_ResizeWindow()"); // GUIDEMO_Delay(SPEED); _LiftUp(30); for (i = 0; i < 40; i++) { tm = GUI_GetTime(); WM_ResizeWindow(_hWindow1, 1, 1); WM_ResizeWindow(_hWindow2, -1, -1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 80; i++) { tm = GUI_GetTime(); WM_ResizeWindow(_hWindow1, -1, -1); WM_ResizeWindow(_hWindow2, 1, 1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 40; i++) { tm = GUI_GetTime(); WM_ResizeWindow(_hWindow1, 1, 1); WM_ResizeWindow(_hWindow2, -1, -1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } _LiftDown(30); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
void GUIDEMO_HardwareInfo(void) { #if (LCD_CONTROLLER == 1375) | (LCD_CONTROLLER == 13705) | (LCD_CONTROLLER == 1386) | (LCD_CONTROLLER == 13806) GUIDEMO_ShowIntro("Hardware info", "" ); GUI_Clear(); #if GUIDEMO_LARGE GUI_SetFont(&GUI_FontComic24B_ASCII); #else GUI_SetFont(&GUI_FontComic18B_ASCII); #endif GUIDEMO_SetColor(GUI_WHITE); #if (LCD_CONTROLLER == 1375) | (LCD_CONTROLLER == 13705) #if GUIDEMO_LARGE GUI_DispStringAt("EPSON 13705\n", 10, 65 ); #else GUI_DispStringHCenterAt("EPSON 13705\n", LCD_XSIZE >> 1, LCD_YSIZE / 14); #endif _Show("On chip VRAM", "80 kb"); _Show("Max. colors", "4096 (4 bit per color)"); _Show("Display types", "Mono / color / TFT"); _Show("LUT", "256 index colors"); #elif (LCD_CONTROLLER == 1386) | (LCD_CONTROLLER == 13806) #if GUIDEMO_LARGE GUI_DispStringAt("EPSON 13806\n", 10, 65 ); #else GUI_DispStringHCenterAt("EPSON 13806\n", LCD_XSIZE >> 1, LCD_YSIZE / 14); #endif _Show("On chip VRAM", "1200 kb"); _Show("Max. colors", "65536 (up to 16 bpp)"); _Show("Display types", "Mono / color / TFT (analog / digital)"); _Show("LUT", "256 index colors"); #endif GUIDEMO_Delay(1500); #endif }
void GUIDEMO_ShowIntro(const char * s, const char * sExp) { GUI_CONTEXT ContextOld; GUI_SaveContext(&ContextOld); _sInfo = s; _sExplain = sExp; GUI_SetDefault(); GUIDEMO_HideInfoWin(); GUI_SetBkColor(GUI_BLUE); GUI_SetColor(GUI_WHITE); GUI_Clear(); //GUI_SetFont(&GUI_FontComic18B_ASCII); GUI_SetFont(&GUI_FontHZ12); GUI_DispStringHCenterAt(s, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 3 - 10); if (_sExplain) { GUI_SetFont(&GUI_Font8_ASCII); GUI_DispStringHCenterAt(_sExplain, LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() / 2 - 10); } GUIDEMO_Delay(_sExplain ? 2000 : 4000); #if GUI_WINSUPPORT _UpdateInfoWin(); _UpdateCmdWin(); #endif GUI_RestoreContext(&ContextOld); #if GUI_WINSUPPORT WM_ExecIdle(); #endif GUIDEMO_NotifyStartNext(); GUI_SetBkColor(GUI_RED); GUI_Clear(); }
/******************************************************************* * * _DemoInvalidateWindow Demonstrates the use of WM_InvalidateWindow */ static void _DemoInvalidateWindow(void) { _ChangeInfoText("WM_InvalidateWindow()"); _WindowColor1 = GUI_BLUE; // GUIDEMO_Delay(SPEED); WM_InvalidateWindow(_hWindow1); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/******************************************************************* * * _DemoSetCallback Demonstrates the use of WM_SetCallback */ static void _DemoSetCallback(void) { _ChangeInfoText("WM_SetCallback()"); // GUIDEMO_Delay(SPEED); WM_SetCallback(_hWindow1, _cbDemoCallback1); WM_InvalidateWindow(_hWindow1); GUIDEMO_Delay(SPEED/2); WM_SetCallback(_hWindow2, _cbDemoCallback2); WM_InvalidateWindow(_hWindow2); GUIDEMO_Delay(SPEED*3); WM_SetCallback(_hWindow1, _cbWindow1); WM_InvalidateWindow(_hWindow1); GUIDEMO_Delay(SPEED/2); WM_SetCallback(_hWindow2, _cbWindow2); WM_InvalidateWindow(_hWindow2); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/******************************************************************* * * _DemoRedrawing Demonstrates how useful can be a callback */ static void _DemoRedrawing(void) { int i, tm, tDiff; _ChangeInfoText("Demonstrating redrawing"); // GUIDEMO_Delay(SPEED); _LiftUp(40); GUIDEMO_Delay(SPEED/3); _ChangeInfoText("Using a callback for redrawing"); GUIDEMO_Delay(SPEED/3); for (i = 0; i < 55; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hWindow1, 1, 1); WM_MoveWindow(_hWindow2, -1, -1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 55; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hWindow1, -1, -1); WM_MoveWindow(_hWindow2, 1, 1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } GUIDEMO_Delay(SPEED/4); _LiftDown(30); GUIDEMO_Delay(SPEED/2); _ChangeInfoText("Without redrawing"); GUIDEMO_Delay(SPEED); _LiftUp(30); GUIDEMO_Delay(SPEED/4); WM_SetCallback(WM_HBKWIN, _cbBkWindowOld); for (i = 0; i < 55; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hWindow1, 1, 1); WM_MoveWindow(_hWindow2, -1, -1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 55; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hWindow1, -1, -1); WM_MoveWindow(_hWindow2, 1, 1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } GUIDEMO_Delay(SPEED/3); WM_SetCallback(WM_HBKWIN, _cbBkWindow); _LiftDown(40); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/********************************************************************* * * _DemoVScreen */ static void _DemoVScreen(void) { GUI_RECT Rect; unsigned j; int xSize; int ySize; int n; int aDelay[] = { 20, 5 }; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); GUI_SetFont(&GUI_FontComic24B_ASCII); GUI_SetTextMode(GUI_TM_TRANS); Rect.x0 = 0; Rect.y0 = 0; Rect.x1 = xSize - 1; Rect.y1 = ySize - 1; GUI_SetColor(GUI_WHITE); GUI_DispStringInRect("Default screen", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER); GUI_Delay(250); Rect.y0 += ySize; Rect.y1 += ySize; GUI_DrawGradientV(Rect.x0, Rect.y0, Rect.x1, Rect.y1, 0xFFFFFF, 0x000000); Rect.y1 -= ySize / 3; GUI_SetColor(GUI_DARKGREEN); GUI_DispStringInRect("Here is the virtual screen", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER); n = ySize / 5; for (j = 0; j < GUI_COUNTOF(aDelay); j++) { if (_Loop(0, 5, n, aDelay[j]) == 1) { return; } GUI_SetOrg(0, ySize); GUI_Delay(250); if (_Loop(ySize, -5, n, aDelay[j]) == 1) { return; } GUI_SetOrg(0, 0); GUI_Delay(250); if (GUIDEMO_CheckCancel()) { return; } } for (j = 0; j < 5; j++) { GUI_SetOrg(0, ySize); GUI_Delay(200); GUI_SetOrg(0, 0); GUI_Delay(200); if (GUIDEMO_CheckCancel()) { return; } } GUIDEMO_Delay(1000); }
/********************************************************************* * * GUIDEMO_Intro * ********************************************************************** */ void GUIDEMO_Intro(void) { char acVersion[30] = "Version of emWin: "; int xCenter, xSize, ySize; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); xCenter = xSize >> 1; GUIDEMO_DrawBk(0); GUI_AA_SetFactor(3); GUI_AA_DrawArc(60*3,60*3,50*3,50*3,0,180); GUI_SetTextMode(GUI_TM_TRANS); // // emWin // GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_FontRounded22); GUI_DispStringHCenterAt("emWin", xCenter, (FACTOR_EMWIN * ySize) >> SCREEN_DIV); // // emWin description // GUI_SetFont(&GUI_FontSouvenir18); GUI_DispStringHCenterAt("Universal graphic software\nfor embedded applications", xCenter, (FACTOR_DESC * ySize) >> SCREEN_DIV); // // Any text // GUI_SetColor(0x2288ff); GUI_DispStringHCenterAt("Any CPU - Any Display - Any Application", xCenter, (FACTOR_ANY_COMP * ySize) >> SCREEN_DIV); // // Compiled // GUI_SetFont(&GUI_Font10S_ASCII); GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, ((FACTOR_ANY_COMP * ySize) >> SCREEN_DIV) + DIST_ANY_COMP); // // Version // GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_FontSouvenir18); strcat(acVersion, GUI_GetVersionString()); GUI_DispStringHCenterAt(acVersion, xCenter, (FACTOR_VERSION * ySize) >> SCREEN_DIV); // // Logo // GUI_DrawBitmap(&bmSeggerLogo, (xSize - bmSeggerLogo.XSize) >> 1, (FACTOR_LOGO * ySize) >> SCREEN_DIV); // // www.segger.com // GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_FontRounded22); GUI_DispStringHCenterAt("www.segger.com", xCenter, (FACTOR_WWW * ySize) >> SCREEN_DIV); GUIDEMO_Delay(5000); }
void GUIDEMO_Intro(void) { int xCenter = LCD_GET_XSIZE() / 2; int y; char acText[50] = "Version of uC/GUI: "; strcat(acText, GUI_GetVersionString()); GUI_SetBkColor(GUI_BLUE); GUI_SetColor(GUI_LIGHTRED); GUI_Clear(); GUI_SetFont(&GUI_Font24B_1); GUI_DispStringHCenterAt("uC/GUI", xCenter, y= 15); GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_Font13H_ASCII); GUI_DispStringHCenterAt("Universal graphic software" "\nfor embedded applications" , xCenter, y += 30); GUI_SetColor(GUI_LIGHTRED); GUI_SetFont(&GUI_Font16_ASCII); GUI_DispStringHCenterAt("Any CPU - Any LCD - Any Application" , xCenter, y += 40); GUI_SetFont(&GUI_Font10S_ASCII); GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25); GUI_SetFont(&GUI_Font13HB_1); GUI_SetColor(GUI_WHITE); GUI_DispStringHCenterAt(acText, xCenter, y += 21); GUI_SetFont(&GUI_FontComic18B_1); GUI_SetColor(GUI_WHITE); GUI_DispStringHCenterAt("www.micrium.com", LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() - 40); GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, 150); GUI_SetFont(&GUI_Font10S_ASCII); GUI_DispStringAt("GUI_OS: ", 0,210); GUI_DispDecMin(GUI_OS); GUI_DispStringAt("GUI_ALLOC_SIZE: ",0, 220); GUI_DispDecMin(GUI_ALLOC_SIZE); GUI_DispStringAt("Compiler: " #ifdef _MSC_VER "Microsoft" #elif defined (NC308) "Mitsubishi NC308" #elif defined (NC30) "Mitsubishi NC30" #elif defined (__TID__) #if (((__TID__ >>8) &0x7f) == 48) /* IAR MC80 */ "IAR M32C" #elif (((__TID__ >>8) &0x7f) == 85) /* IAR V850 */ "IAR V850" #else /* IAR MC16 */ "IAR M32C" #endif #else "Unknown" #endif ,0, 230); GUIDEMO_Delay(5000); }
/******************************************************************* * * _DemoSetDesktopColor Demonstrates the use of WM_SetDesktopColor */ static void _DemoSetDesktopColor(void) { GUI_SetBkColor(GUI_BLUE); GUI_Clear(); _DrawInfoText("WM_SetDesktopColor()"); // GUIDEMO_Delay(SPEED*2); WM_SetDesktopColor(GUI_BLACK); GUIDEMO_Delay(SPEED/2); /* Set background color and invalidate desktop color. This is needed for the later redrawing demo. */ GUI_SetBkColor(GUI_BLACK); WM_SetDesktopColor(GUI_INVALID_COLOR); GUIDEMO_NotifyStartNext(); }
void GUIDEMO_Dialog(void) { int i; WM_HWIN hWin; GUI_COLOR DesktopColorOld; GUI_CURSOR_Show(); GUIDEMO_ShowIntro("Dialog boxes", "Dialog boxes" "\ncan easily be created"); GUIDEMO_HideInfoWin(); DesktopColorOld = WM_SetDesktopColor(GUI_RED); /* Automatically update desktop window */ hWin = GUI_CreateDialogBox(aDialogCreate, GUI_COUNTOF(aDialogCreate), _cbCallback, 0, 0, 0); for (i = 0; i < GUI_COUNTOF(_aID); i++) { GUIDEMO_Delay(_aID[i].Time); GUI_SendKeyMsg(_aID[i].Id, 1); } GUIDEMO_Delay(1000); for (i = 0; i <= 100; i+=10) { if (WM_IsWindow(hWin)) { SLIDER_SetValue(WM_GetDialogItem(hWin, GUI_ID_SLIDER1), i); } GUIDEMO_Delay(100); } if (WM_IsWindow(hWin)) { GUIDEMO_Delay(1000); WM_MoveTo(hWin, 20,50); } if (WM_IsWindow(hWin)) { GUI_Delay(1000); WM_MoveTo(hWin,120,50); } /* Cleanup ... */ if (WM_IsWindow(hWin)) { GUI_Delay(1000); WM_DeleteWindow(hWin); } GUIDEMO_NotifyStartNext(); WM_SetDesktopColor(DesktopColorOld); /* Restore old settings */ }
/********************************************************************* * * GUIDEMO_Intro * ********************************************************************** */ void GUIDEMO_Intro(void) { char acVersion[30] = "Version of STemWin: "; int xCenter, xSize, ySize; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); xCenter = xSize >> 1; GUIDEMO_DrawBk(0); GUI_SetTextMode(GUI_TM_TRANS); // // emWin // GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_FontRounded22); GUI_DispStringHCenterAt("STemWin", xCenter, (FACTOR_EMWIN * ySize) >> SCREEN_DIV); // // emWin description // GUI_SetFont(&GUI_Font16_ASCII); GUI_DispStringHCenterAt("Universal graphic software\nfor embedded applications", xCenter, (FACTOR_DESC * ySize) >> SCREEN_DIV); // // Any text // GUI_SetColor(0x2288ff); GUI_DispStringHCenterAt("For STM32 MCU Products - Cortex M3 - Cortex M4", xCenter, (FACTOR_ANY_COMP * ySize) >> SCREEN_DIV); // // Compiled // GUI_SetFont(&GUI_Font10S_ASCII); GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, ((FACTOR_ANY_COMP * ySize) >> SCREEN_DIV) + DIST_ANY_COMP); // // Version // GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_Font16_ASCII); strcat(acVersion, GUI_GetVersionString()); GUI_DispStringHCenterAt(acVersion, xCenter, (FACTOR_VERSION * ySize) >> SCREEN_DIV); // // Logo // GUI_DrawBitmap(&bmSTLogo, (xSize - bmSeggerLogo.XSize) >> 1, (FACTOR_LOGO * ySize) >> SCREEN_DIV); // // www.segger.com // GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_FontRounded22); GUI_DispStringHCenterAt("www.st.com/stm32", xCenter, (FACTOR_WWW * ySize) >> SCREEN_DIV); GUIDEMO_Delay(5000); }
void GUIDEMO_Touch(void) { #define ID_KEYBOARD 1 #define ID_TESTCAL 2 #define ID_CALIBRATE 3 int i, r; int XSize = LCD_GetXSize(); int YSize = LCD_GetYSize(); int XMid = XSize / 2; int YMid = YSize / 2; //GUIDEMO_NotifyStartNext(); GUIDEMO_HideInfoWin(); do { GUI_RECT rText;/*= {0, 80, XSize, 120};*/ BUTTON_Handle ahButton[3]; rText.x0=0; rText.y0=50; rText.x1=XSize; rText.y1=90; GUI_SetBkColor(GUI_BLUE); GUI_Clear(); GUI_DrawBitmap(&bmMicriumLogo, (XSize - 1 - bmMicriumLogo.XSize) / 2, 15); GUI_SetFont(&GUI_Font16B_1); GUI_DispStringInRect("µC/GUI Touch screen demo", &rText, GUI_TA_HCENTER | GUI_TA_VCENTER); ahButton[0] = BUTTON_Create( XMid - 50, YMid - 30, 100, 50, ID_CALIBRATE,BUTTON_CF_SHOW ); ahButton[1] = BUTTON_Create( XMid - 90, YMid + 30, 80, 30, ID_KEYBOARD, BUTTON_CF_SHOW ); ahButton[2] = BUTTON_Create( XMid + 10, YMid + 30, 80, 30, ID_TESTCAL,BUTTON_CF_SHOW ); BUTTON_SetText (ahButton[0], "Calibrate"); BUTTON_SetBkColor(ahButton[0], 0, GUI_RED); BUTTON_SetText (ahButton[1], "Keyboard"); BUTTON_SetText (ahButton[2], "Test calibration"); BUTTON_SetFont(ahButton[0], &GUI_FontComic18B_ASCII); r = GUIDEMO_WaitKey(); if (r==0) { r = ID_KEYBOARD; BUTTON_SetState(ahButton[1],BUTTON_STATE_PRESSED); GUIDEMO_Delay(500); } for (i=0; i< countof(ahButton); i++) { BUTTON_Delete(ahButton[i]); } switch (r) { case ID_KEYBOARD: init_uart0(); send_press_key(); break; case ID_CALIBRATE: _ExecCalibration(); break; case ID_TESTCAL: _TestCalibration(); break; } } while (r && (r!='n') && (r!='N')); }
/******************************************************************* * * _DemoCreateWindowAsChild Demonstrates the use of WM_CreateWindowAsChild */ static void _DemoCreateWindowAsChild(void) { /* Create windows */ _ChangeInfoText("WM_CreateWindowAsChild()"); // GUIDEMO_Delay(SPEED); /* _hMEdit = MULTIEDIT_Create(10, 50, 145, 40, _hWindow2, 10, WM_CF_SHOW | WM_CF_MEMDEV, MULTIEDIT_CF_AUTOSCROLLBAR_V, "This is a test of multi edit box\n", 200); */ // MULTIEDIT_SetAutoScrollV(_hMEdit, 1); _hChild = WM_CreateWindowAsChild(10, 50, 145, 40, _hWindow2, WM_CF_SHOW | WM_CF_MEMDEV, _cbChild, 0); GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
void GUIDEMO_Cursor(void) { int i = 0; GUIDEMO_ShowIntro("Cursor", "\nuC/GUI supports" "\nsoftware cursor"); GUI_SetBkColor(GUI_BLUE); GUI_Clear(); _DispCursor(); GUIDEMO_Delay(2000); GUIDEMO_NotifyStartNext(); GUI_CURSOR_Show(); for ( i = 0;(i < countof(_aCursor) && !GUIDEMO_CheckCancel()); i++) { _MoveCursor(_aCursor[i]); } GUI_CURSOR_SetPosition(0,0); GUI_CURSOR_Select(&GUI_CursorArrowM); }
static void _MoveCursor(const GUI_CURSOR* Cursor){ int x, y; int xMax, yMax; xMax = LCD_GetXSize()/2; yMax = LCD_GetYSize()/2; GUI_CURSOR_Select(Cursor); for(x = y = 0; ((x != xMax) && (y != yMax) && !GUIDEMO_CheckCancel()); x += 4, y += 4) { if ( x == xMax) { x = xMax; } if ( y == yMax) { y = yMax; } GUI_CURSOR_SetPosition(x,y); GUIDEMO_Delay(75); } }
/******************************************************************* * * _DemoMoveTo Demonstrates the use of WM_MoveTo */ static void _DemoMoveTo(void) { int i, tm, tDiff; _ChangeInfoText("WM_MoveTo()"); // GUIDEMO_Delay(SPEED); for (i = 1; i < 56; i++) { tm = GUI_GetTime(); WM_MoveTo(_hWindow1, 50 + i, 70 + i); WM_MoveTo(_hWindow2, 105 - i, 125 - i); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 1; i < 56; i++) { tm = GUI_GetTime(); WM_MoveTo(_hWindow1, 105 - i, 125 - i); WM_MoveTo(_hWindow2, 50 + i, 70 + i); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/******************************************************************* * * _DemoMoveWindow Demonstrates the use of WM_MoveWindow */ static void _DemoMoveWindow(void) { int i, tm, tDiff; _ChangeInfoText("WM_MoveWindow()"); // GUIDEMO_Delay(SPEED); for (i = 0; i < 55; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hWindow1, 1, 1); WM_MoveWindow(_hWindow2, -1, -1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 55; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hWindow1, -1, -1); WM_MoveWindow(_hWindow2, 1, 1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
static void _ShowCharacters(const char*s, const GUI_FONT* pFont, int IncX) { int i; int ix=0, y; int FontSizeY; GUI_SetFont(pFont); FontSizeY = GUI_GetFontSizeY(); _Label(s); GUI_SetFont(pFont); y = _GetYPos(); for (i = 0; i < 20000; i++) { if (GUI_IsInFont(NULL, (U16)i)) { GUI_GotoXY(ix * IncX, y); if (ix++ > 20) { ix = 0; y += FontSizeY; } GUI_DispChar((U16)i); } } GUIDEMO_Delay(2000); GUIDEMO_NotifyStartNext(); }
/******************************************************************* * * _DemoClipping Demonstrates clipping at parent borders */ static void _DemoClipping(void) { int i, tm, tDiff; _ChangeInfoText("Demonstrating clipping of child"); // GUIDEMO_Delay(SPEED); for (i = 0; i < 25; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hChild, 1, 0); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 25; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hChild, 0, 1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 50; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hChild, -1, 0); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 25; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hChild, 0, -1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } for (i = 0; i < 25; i++) { tm = GUI_GetTime(); WM_MoveWindow(_hChild, 1, 0); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } GUIDEMO_Delay(SPEED); GUIDEMO_NotifyStartNext(); }
/********************************************************************* * * GUIDEMO_Dialog */ void GUIDEMO_Dialog(void) { int i; WM_HWIN hWin; GUI_COLOR DesktopColorOld; GUIDEMO_ShowIntro("Dialog boxes", "\nDialog boxes\ncan easily be created"); GUIDEMO_HideInfoWin(); DesktopColorOld = WM_SetDesktopColor(GUI_RED); /* Automatically update desktop window */ hWin = GUI_CreateDialogBox(aDialogCreate, GUI_COUNTOF(aDialogCreate), _cbCallback, 0, 0, 0); for (i = 0; i < GUI_COUNTOF(_aID); i++) { GUIDEMO_Delay(_aID[i].Time); GUI_SendKeyMsg(_aID[i].Id, 1); /* 把消息发送至指定键,把键盘数据发送到输入焦点所在窗口,1表示放开状态 */ } #if !(GUIDEMO_TINY) #if !(GUIDEMO_LARGE) if (LCD_GetYSize() < 120) { } else #endif { GUIDEMO_Delay(1000); for (i = 0; i <= 100; i += 10) { if (WM_IsWindow(hWin)) { /* 确定指定句柄是否是有效的窗口句柄,0:句柄不是有效的窗口句柄,1:句柄是有效的窗口句柄 */ SLIDER_SetValue(WM_GetDialogItem(hWin, GUI_ID_SLIDER0), i); /* 返回对话框项目(小工具)的窗口句柄, 设置滑动条的当前值 */ } GUIDEMO_Delay(100); } } #endif GUIDEMO_Delay(800); if (WM_IsWindow(hWin)) { WM_MoveTo(hWin, 20, 20); /* 将指定窗口移动到某个位置。 */ GUIDEMO_Delay(500); } if (WM_IsWindow(hWin)) { WM_MoveTo(hWin, 60, 20); GUIDEMO_Delay(800); } /* Cleanup ... */ if (WM_IsWindow(hWin)) { WM_DeleteWindow(hWin); /* 删除窗口。 */ } GUIDEMO_NotifyStartNext(); WM_SetDesktopColor(DesktopColorOld); /* Restore old settings */ }
void GUIDEMO_Intro(void) { int xCenter = LCD_GET_XSIZE() / 2; int y; char acText[50] = "Version of 礐/GUI: "; strcat(acText, GUI_GetVersionString()); GUI_SetBkColor(GUI_BLUE); GUI_SetColor(GUI_LIGHTRED); GUI_Clear(); GUI_SetFont(&GUI_Font24B_1); GUI_DispStringHCenterAt("礐/GUI", xCenter, y= 15); // GUI_SetColor(GUI_WHITE); // GUI_SetFont(&GUI_Font13H_ASCII); // GUI_DispStringHCenterAt("Universal graphic software" // "\nfor embedded applications" // , xCenter, y += 30); // GUI_SetColor(GUI_LIGHTRED); // GUI_SetFont(&GUI_Font16_ASCII); // GUI_DispStringHCenterAt("Any CPU - Any LCD - Any Application", xCenter, y += 40); // GUI_SetFont(&GUI_Font10S_ASCII); // GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25); GUI_SetFont(&GUI_Font13HB_1); GUI_SetColor(GUI_WHITE); GUI_DispStringHCenterAt(acText, xCenter, y += 26); GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, y += 16); GUI_Line(0, y+45, 320-1, y+45, GUI_WHITE); GUI_Line(0, y+46, 320-1, y+46, GUI_WHITE); //GUI_SetFont(&GUI_Font24B_1); GUI_SetFont(&GUI_FontHZ_hwhb_32); GUI_SetColor(GUI_RED); //GUI_DispStringHCenterAt("FD-STM32-Sun68", LCD_GET_XSIZE() / 2, y += 50); GUI_DispStringHCenterAt("STM32研究开发平台", LCD_GET_XSIZE() / 2, y += 50); GUI_SetFont(&GUI_Font13HB_1);//GUI_Font16_ASCII GUI_SetColor(GUI_RED); GUI_DispStringHCenterAt("http://www.heyaodz.com", LCD_GET_XSIZE() / 2, y += 36); // GUI_SetColor(GUI_WHITE); // GUI_SetFont(&GUI_Font10S_ASCII); // GUI_DispStringAt("GUI_OS: ", 0,210); GUI_DispDecMin(GUI_OS); // GUI_DispStringAt("GUI_ALLOC_SIZE: ",0, 220); GUI_DispDecMin(GUI_ALLOC_SIZE); // GUI_DispStringAt("Compiler: " // #ifdef _MSC_VER // "Microsoft" // #elif defined (NC308) // "Mitsubishi NC308" // #elif defined (NC30) // "Mitsubishi NC30" // #elif defined (__TID__) // #if (((__TID__ >>8) &0x7f) == 48) /* IAR MC80 */ // "IAR M32C" // #elif (((__TID__ >>8) &0x7f) == 85) /* IAR V850 */ // "IAR V850" // #else /* IAR MC16 */ // "IAR M32C" // #endif // #else // "RealViewMDK 3.50" // #endif // ,0, 230); GUIDEMO_Delay(5000); }