/******************************************************************* * * _DemoListBoxAsChild */ static void _DemoListBoxAsChild(void) { FRAMEWIN_Handle hFrame; LISTBOX_Handle hListBox; /* Display titel */ GUI_SetBkColor(0xB00000); GUI_SetColor(0xFFFFFF); GUI_SetFont(&GUI_Font24_ASCII); GUI_DispStringHCenterAt("Listbox as child - Sample", 160, 5); GUI_Delay(SPEED / 2); /* Create framewin */ GUI_SetFont(&GUI_Font8x16); GUI_SetTextAlign(GUI_TA_LEFT); GUI_DispStringAtCEOL("using", 5, 40); GUI_DispStringAtCEOL("FRAMEWIN_Create", 5, 55); GUI_Delay(SPEED); hFrame = FRAMEWIN_Create("List box", NULL, WM_CF_SHOW, 100, 80, 120, 140); FRAMEWIN_SetFont(hFrame, &GUI_Font16B_ASCII); FRAMEWIN_SetActive(hFrame, 1); GUI_Delay(SPEED * 0.75); /* Create listbox */ GUI_DispStringAtCEOL("LISTBOX_CreateAsChild", 5, 55); GUI_Delay(SPEED); hListBox = LISTBOX_CreateAsChild(_ListBox, WM_GetClientWindow(hFrame), 0, 0, 0, 0, WM_CF_SHOW); GUI_Delay(SPEED * 0.75); /* Show serveral functions of listbox */ _ShowSeveralFunctions(hListBox); /* Delete framewin widget */ GUI_DispStringAtCEOL("FRAMEWIN_Delete", 5, 55); GUI_Delay(SPEED); FRAMEWIN_Delete(hFrame); GUI_Delay(SPEED * 0.75); /* Clear display */ GUI_Clear(); GUI_Delay(SPEED * 1.5); }
/******************************************************************* * * _DemoDropDownAsChild */ static void _DemoDropDownAsChild(void) { WM_HWIN hFrame; WM_HWIN hDropDown; /* Display titel */ GUI_SetBkColor(0xB00000); GUI_SetColor(0xFFFFFF); GUI_SetFont(&GUI_Font24_ASCII); GUI_DispStringHCenterAt("Dropdown as child - Sample", 160, 5); GUI_Delay(SPEED / 2); /* Create framewin */ GUI_SetFont(&GUI_Font8x16); GUI_SetTextAlign(GUI_TA_LEFT); GUI_DispStringAtCEOL("using", 5, 40); GUI_DispStringAtCEOL("FRAMEWIN_Create", 5, 55); GUI_Delay(SPEED); hFrame = FRAMEWIN_Create("DropDown", NULL, WM_CF_SHOW, 80, 80, 160, 140); FRAMEWIN_SetFont(hFrame, &GUI_Font16B_ASCII); FRAMEWIN_SetActive(hFrame, 1); GUI_Delay(SPEED * 0.75); /* Create listbox */ GUI_DispStringAtCEOL("DROPDOWN_CreateEx", 5, 55); GUI_Delay(SPEED); hDropDown = DROPDOWN_CreateEx(20, 20, 120, 65, WM_GetClientWindow(hFrame), WM_CF_SHOW, 0, 0); GUI_Delay(SPEED * 0.75); /* Show serveral functions of listbox */ _ShowSeveralFunctions(hDropDown); /* Delete framewin widget */ GUI_DispStringAtCEOL("FRAMEWIN_Delete", 5, 55); GUI_Delay(SPEED); FRAMEWIN_Delete(hFrame); GUI_Delay(SPEED * 0.75); /* Clear display */ GUI_Clear(); GUI_Delay(SPEED * 1.5); }
/********************************************************************* * * MainTask */ void CreateWindow(void) { WM_HWIN hMultiPage; WM_HWIN hFrameWin; WM_HWIN hDialog; // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } WM_SetCallback(WM_HBKWIN, _cbBkWindow); // // Create the frame window // hFrameWin = FRAMEWIN_Create("Sample", NULL, WM_CF_SHOW, 0, 0, 240, 152); FRAMEWIN_SetClientColor(hFrameWin, GUI_GREEN); FRAMEWIN_SetActive(hFrameWin, 1); FRAMEWIN_SetMoveable(hFrameWin, 1); // // Create the MULTIPAGE widget // hMultiPage = MULTIPAGE_CreateEx(7, 6, 220, 120, WM_GetClientWindow(hFrameWin), WM_CF_SHOW, 0, 0); GUI_Delay(500); // // Create and attach the MULTIPAGE dialog windows // hDialog = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 1"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 2"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate3), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 3"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate4, GUI_COUNTOF(_aDialogCreate4), _cbDialog4, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 4"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate5, GUI_COUNTOF(_aDialogCreate5), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 5"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate6, GUI_COUNTOF(_aDialogCreate6), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 6"); GUI_Delay(500); // // Demonstrate the use of MULTIPAGE_SetAlign // MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_RIGHT); GUI_Delay(500); MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_RIGHT | MULTIPAGE_ALIGN_BOTTOM); GUI_Delay(500); MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_LEFT | MULTIPAGE_ALIGN_BOTTOM); while (1) { GUI_Delay(100); } }
/********************************************************************* * * _DemoHeaderFrameWin */ static void _DemoHeaderFrameWin(void) { FRAMEWIN_Handle hFrameWin; _ChangeMainText("HEADER control inside a FRAMEWIN"); hFrameWin = FRAMEWIN_Create("Title", _cbWindow, WM_CF_SHOW, 10, 80, 300, 140); FRAMEWIN_SetActive(hFrameWin, 1); _hHeader = HEADER_CreateAttached(WM_GetClientWindow(hFrameWin), 1234, 0); _Demo(); FRAMEWIN_Delete(hFrameWin); }
/********************************************************************* * * MainTask */ void MainTask(void) { WM_HWIN hMultiPage; WM_HWIN hFrameWin; WM_HWIN hDialog; // // Enable use of memory devices // WM_SetCreateFlags(WM_CF_MEMDEV); GUI_Init(); WM_SetCallback(WM_HBKWIN, _cbBkWindow); // // Create the frame window // hFrameWin = FRAMEWIN_Create("FrameWindow", NULL, WM_CF_SHOW, 40, 44, 240, 152); FRAMEWIN_SetClientColor(hFrameWin, GUI_GREEN); FRAMEWIN_SetActive(hFrameWin, 1); FRAMEWIN_SetMoveable(hFrameWin, 1); // // Create the MULTIPAGE widget // hMultiPage = MULTIPAGE_CreateEx(7, 6, 220, 120, WM_GetClientWindow(hFrameWin), WM_CF_SHOW, 0, 0); GUI_Delay(500); // // Create and attach the MULTIPAGE dialog windows // hDialog = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 1"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 2"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate3), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 3"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate4, GUI_COUNTOF(_aDialogCreate4), _cbDialog4, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 4"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate5, GUI_COUNTOF(_aDialogCreate5), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 5"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate6, GUI_COUNTOF(_aDialogCreate6), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 6"); GUI_Delay(500); // // Demonstrate the use of MULTIPAGE_SetAlign // MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_RIGHT); GUI_Delay(500); MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_RIGHT | MULTIPAGE_ALIGN_BOTTOM); GUI_Delay(500); MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_LEFT | MULTIPAGE_ALIGN_BOTTOM); while (1) { GUI_Delay(100); } }
/********************************************************************* * * 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); }
/******************************************************************* * * _DemoTransWindow */ static void _DemoTransWindow(void) { WM_HWIN hTransWin; WM_HWIN hFrameWin; WM_SetDesktopColor(GUI_RED); hTransWin = WM_CreateWindow(10, 10, 72, 52, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_STAYONTOP, _cbTransWindow, 0); hFrameWin = FRAMEWIN_Create("Framewin", 0, WM_CF_SHOW, 100, 70, 120, 100); FRAMEWIN_SetActive(hFrameWin, 1); FRAMEWIN_SetMoveable(hFrameWin, 1); GUI_CURSOR_Show(); while (1) { WM_InvalidateWindow(hTransWin); GUI_Delay(20); } }
void configuration_panel_init() { int frmWinWidth = GUI_X_MAX; int frmWinHeight = GUI_Y_MAX - 40; int x0 = 0; int y0 = 20; int checkBoxX = 5; int checkBoxY = 22; int checkBoxWidth = 60; int checkBoxHeight = 15; int buttonWidth = 90; int buttonHeight = 20; int buttonX = 5; int buttonY = frmWinHeight - (buttonHeight + 5); sel_conf_language = sel_language; configPageWin = FRAMEWIN_Create(confFrmText[sel_language], _cbConfigWin, WM_CF_SHOW, x0, y0, frmWinWidth, frmWinHeight); FRAMEWIN_SetFont(configPageWin, &GUI_FontArialBold14_8_Unicode); for (int i = 0; i < NUM_CONF_ITEMS; i++) { int id = i + ID_CONF_DSTP_CFG_PRT_ONB; CHECKBOX_Handle checkBox = CHECKBOX_Create(checkBoxX, checkBoxY, checkBoxWidth, checkBoxHeight, configPageWin, id, WM_CF_SHOW); CHECKBOX_SetFont(checkBox, &GUI_FontArialStandard14_8_Unicode); CHECKBOX_SetText(checkBox, conf_checkbox_item[sel_language][i]); CHECKBOX_SetBoxBkColor(checkBox, GUI_USER_LIGHTGRAY, CHECKBOX_CI_DISABLED); CHECKBOX_SetBoxBkColor(checkBox, GUI_YELLOW, CHECKBOX_CI_ENABLED); CHECKBOX_SetFocusColor(checkBox, GUI_BLUE); checkBoxY += 15; } BUTTON_Handle ESC_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ESC); BUTTON_SetFont(ESC_Button, &GUI_FontArialBold14_8_Unicode); BUTTON_SetText(ESC_Button, escButtonExpl[sel_language]); buttonX = frmWinWidth - (buttonWidth + 5); BUTTON_Handle ENTER_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ENTER); BUTTON_SetFont(ENTER_Button, &GUI_FontArialBold14_8_Unicode); BUTTON_SetText(ENTER_Button, enterButtonExpl[sel_language]); }
void GUIDEMO_main(void) { #if GUI_WINSUPPORT int i; #endif GUI_Clear(); #if GUI_WINSUPPORT WM_SetCreateFlags(WM_CF_MEMDEV); /* Automatically use memory devices on all windows */ /* Calculate position and size of FrameWin[1] */ _FrameWinSizeX[1] = 80; _FrameWinSizeY[1] = 60; _FrameWinPosX[1] = LCD_GetXSize() - _FrameWinSizeX[1]; _FrameWinPosY[1] = LCD_GetYSize() - _FrameWinSizeY[1]; _ButtonSizeX = (_FrameWinSizeX[1] - 20) / 2; _ButtonSizeY = 20; /* Create the control window incl. buttons */ _ahFrameWin[1] = FRAMEWIN_Create("Control", NULL, WM_CF_SHOW | WM_CF_STAYONTOP, _FrameWinPosX[1], _FrameWinPosY[1], _FrameWinSizeX[1], _FrameWinSizeY[1]); _ahInfoWin[1] = WM_CreateWindowAsChild(0, 0, 0, 0, _ahFrameWin[1], WM_CF_SHOW | WM_CF_STAYONTOP, 0, 0); _ahButton[0] = BUTTON_CreateAsChild(_FrameWinSizeX[1] / 20, + 20, _ButtonSizeX, _ButtonSizeY, _ahFrameWin[1], 'H' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); _ahButton[1] = BUTTON_CreateAsChild(_FrameWinSizeX[1] / 2, + 20, _ButtonSizeX, _ButtonSizeY, _ahFrameWin[1], 'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); BUTTON_SetText(_ahButton[0], "Stop"); BUTTON_SetText(_ahButton[1], "Next"); _UpdateCmdWin(); WM_ExecIdle(); #endif /* Show Intro */ GUIDEMO_Intro(); #if GUI_WINSUPPORT /* Calculate position and size of FrameWin[0] */ _FrameWinSizeX[0] = LCD_GetXSize() / 2; _FrameWinSizeY[0] = 65; _FrameWinPosX[0] = LCD_GetXSize() - _FrameWinSizeX[0]; _FrameWinPosY[0] = 0; /* Create info window and run the individual demos */ _ahFrameWin[0] = FRAMEWIN_Create("ARMSYS Demo", NULL, WM_CF_STAYONTOP, _FrameWinPosX[0], _FrameWinPosY[0], _FrameWinSizeX[0], _FrameWinSizeY[0]); _ahInfoWin[0] = WM_CreateWindowAsChild(0, 0, 0, 0, _ahFrameWin[0], WM_CF_STAYONTOP, 0, 0); WM_ExecIdle(); #endif /* Run the individual demos ! */ for (_iTest = 0; _apfTest[_iTest]; _iTest++) { GUI_CONTEXT ContextOld; GUI_SaveContext(&ContextOld); _iTestMinor = 0; _UpdateCmdWin(); (*_apfTest[_iTest])(); _CmdNext = 0; GUI_RestoreContext(&ContextOld); } /* Cleanup */ #if GUI_WINSUPPORT for (i = 0; i < countof(_ahFrameWin); i++) { WM_DeleteWindow(_ahFrameWin[i]); } for (i = 0; i < countof(_ahInfoWin); i++) { WM_DeleteWindow(_ahInfoWin[i]); } #endif }
void GUIDEMO_main(void) { #if GUI_WINSUPPORT int i; int xSize, ySize, xPos, yPos; #endif #if (GUI_SUPPORT_CURSOR|GUI_SUPPORT_TOUCH) GUI_CURSOR_Show(); #endif GUI_Clear(); #if GUI_WINSUPPORT #if LCD_NUM_DISPLAYS > 1 FRAMEWIN_CreateAsChild(10, 10, 100, 100, WM_GetDesktopWindowEx(1), "Display 1", NULL, WM_CF_SHOW); WM_SetDesktopColorEx(GUI_RED, 1); GUI_Delay(1000); #endif WM_SetCreateFlags(WM_CF_MEMDEV); /* Automatically use memory devices on all windows */ /* Calculate position and size of FrameWin[1] */ _ButtonSizeX = 30; _ButtonSizeY = 20; /* Create the control window incl. buttons */ _ahFrameWin[1] = FRAMEWIN_Create("Control", NULL, WM_CF_SHOW | WM_CF_STAYONTOP, LCD_GetXSize() - 80, LCD_GetYSize() - 60, 80, 60); _ahInfoWin[1] = WM_CreateWindowAsChild( 0, 0, 0, 0, WM_GetFirstChild(_ahFrameWin[1]), WM_CF_SHOW | WM_CF_STAYONTOP, &_cbCmdWin, 0); _ahButton[0] = BUTTON_CreateAsChild(4, 20, _ButtonSizeX, _ButtonSizeY, _ahInfoWin[1], 'S' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); _ahButton[1] = BUTTON_CreateAsChild(40, 20, _ButtonSizeX, _ButtonSizeY, _ahInfoWin[1], 'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); BUTTON_SetText(_ahButton[0], "Stop"); BUTTON_SetText(_ahButton[1], "Next"); _UpdateCmdWin(); WM_ExecIdle(); #endif /* Show Intro */ GUIDEMO_Intro(); #if GUI_WINSUPPORT /* Calculate position and size of FrameWin[0] */ xSize = LCD_GetXSize() / 2; ySize = 65; xPos = LCD_GetXSize() - xSize; yPos = 0; /* Create info window and run the individual demos */ _ahFrameWin[0] = FRAMEWIN_Create("µC/GUI Demo", NULL, WM_CF_STAYONTOP, xPos, yPos, xSize, ySize); // _ahInfoWin[0] = WM_GetFirstChild(_ahFrameWin[0]); _ahInfoWin[0] = WM_CreateWindowAsChild(0, 0, 0, 0, WM_GetFirstChild(_ahFrameWin[0]), WM_CF_SHOW | WM_CF_STAYONTOP, 0, 0); WM_ExecIdle(); #endif /* Run the individual demos ! */ for (_iTest = 0; _apfTest[_iTest]; _iTest++) { GUI_CONTEXT ContextOld; GUI_SaveContext(&ContextOld); _iTestMinor = 0; _UpdateCmdWin(); (*_apfTest[_iTest])(); _CmdNext = 0; GUI_RestoreContext(&ContextOld); } /* Cleanup */ #if GUI_WINSUPPORT for (i = 0; i < countof(_ahFrameWin); i++) { WM_DeleteWindow(_ahFrameWin[i]); } for (i = 0; i < countof(_ahInfoWin); i++) { WM_DeleteWindow(_ahInfoWin[i]); } #endif }