/******************************************************************* * * _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); } }
/********************************************************************* * * _DemoMultiedit */ static void _DemoMultiedit(void) { GUI_RECT Rect; int WinFlags; _hFrame = 1; _Overwrite = 0; _ReadOnly = 0; _Password = 0; /* Create framewin */ _ChangeInfoText("Create framewin", SPEED); _hFrame = FRAMEWIN_CreateEx(60, 80, 200, 120, WM_HBKWIN, WM_CF_SHOW, 0, 0, "Notepad", 0); _hClient = WM_GetClientWindow(_hFrame); _pcbFrameWin = WM_SetCallback(_hFrame, _cbFrameWin); _pcbFrameWinClient = WM_SetCallback(_hClient, _cbFrameWinClient); /* Set framewin properties */ FRAMEWIN_SetMoveable(_hFrame, 1); FRAMEWIN_SetActive(_hFrame, 1); FRAMEWIN_SetTextAlign(_hFrame, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetFont(_hFrame, &GUI_Font8x12_ASCII); FRAMEWIN_SetTitleHeight(_hFrame, 16); /* Add framewin buttons */ if (_ChangeInfoText("Add framewin buttons", SPEED)) return; FRAMEWIN_AddCloseButton(_hFrame, FRAMEWIN_BUTTON_LEFT, 0); FRAMEWIN_AddMaxButton(_hFrame, FRAMEWIN_BUTTON_RIGHT, 0); FRAMEWIN_AddMinButton(_hFrame, FRAMEWIN_BUTTON_RIGHT, 1); WM_InvalidateWindow(_hFrame); /* Create buttons */ if (_ChangeInfoText("Add option buttons", SPEED)) return; _hWrapButton = _CreateLButton("None", 0, 36, 16, _hClient, ID_NONEWRAP); _CreateLButton("Word", 37, 36, 16, _hClient, ID_WORDWRAP); _CreateLButton("Char", 74, 36, 16, _hClient, ID_CHARWRAP); _CreateRButton("PSW", 52, 25, 16, _hClient, ID_PASSWORD); _CreateRButton("OVR", 26, 25, 16, _hClient, ID_OVERWRITE); _CreateRButton("R/O", 0, 25, 16, _hClient, ID_READONLY); _SetButtonState(_hWrapButton, 1); /* Create multiedit */ if (_ChangeInfoText("using\nMULTIEDIT_CreateEx", SPEED)) return; WinFlags = WM_CF_SHOW | WM_CF_ANCHOR_RIGHT | WM_CF_ANCHOR_LEFT | WM_CF_ANCHOR_TOP | WM_CF_ANCHOR_BOTTOM; WM_GetClientRectEx(_hClient, &Rect); _hMEdit = MULTIEDIT_CreateEx(0, 0, 0, Rect.y1 - 16 + 1, _hClient, WinFlags, MULTIEDIT_CF_INSERT, 0, 0, ""); _pcbMultiEdit = WM_SetCallback(_hMEdit, _cbMultiEdit); MULTIEDIT_SetAutoScrollH(_hMEdit, 1); MULTIEDIT_SetAutoScrollV(_hMEdit, 1); WM_SetFocus(_hMEdit); if (_ChangeInfoText("using\nMULTIEDIT_SetText", SPEED)) return; MULTIEDIT_SetText(_hMEdit, "This sample demonstrates the use of a multiedit widget!"); if (_ChangeInfoText("using\nMULTIEDIT_SetFont", SPEED)) return; MULTIEDIT_SetFont(_hMEdit, &GUI_Font16_1); if (_ChangeInfoText("using\nMULTIEDIT_SetTextColor", SPEED)) return; MULTIEDIT_SetTextColor(_hMEdit, 0, 0xE00000); if (_ChangeInfoText("using\nMULTIEDIT_SetBkColor", SPEED)) return; MULTIEDIT_SetBkColor(_hMEdit, 0, 0xD0FFFF); if (_ChangeInfoText("using\nMULTIEDIT_SetWrapWord", SPEED)) return; MULTIEDIT_SetWrapWord(_hMEdit); _SetButtonState(_hWrapButton, 0); _hWrapButton = WM_GetDialogItem(_hClient, ID_WORDWRAP); _SetButtonState(_hWrapButton, 1); if (_ChangeInfoText("using\nMULTIEDIT_SetHBorder", SPEED)) return; MULTIEDIT_SetHBorder(_hMEdit, 3); if (_ChangeInfoText("using\nMULTIEDIT_SetPrompt", SPEED)) return; MULTIEDIT_SetPrompt(_hMEdit, "Type: "); if (_ChangeInfoText("Play with multiedit...", SPEED)) return; while (_hFrame) { GUI_Delay(100); } }