/******************************************************************* * * _DemoHideShowChild Demonstrates the use of WM_HideWindow and WM_ShowWindow */ static void _DemoHideShowChild(void) { _ChangeInfoText("WM_HideWindow(Child)"); GUI_Delay(SPEED); WM_HideWindow(_hChild); GUI_Delay(SPEED); _ChangeInfoText("WM_ShowWindow(Child)"); GUI_Delay(SPEED); WM_ShowWindow(_hChild); GUI_Delay(SPEED); }
/********************************************************************* * * _DemoListView */ static void _DemoListView(void) { _ChangeMainText("LISTVIEW control without parent"); _ChangeInfoText("LISTVIEW_Create"); _hListView = LISTVIEW_Create(10, 80, 300, 89, 0, 1234, WM_CF_SHOW, 0); GUI_Delay(SPEED / 2); _Demo(); _ChangeInfoText("LISTVIEW_Delete"); LISTVIEW_Delete(_hListView); GUI_Delay(SPEED); }
/******************************************************************* * * _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(); }
/******************************************************************* * * _DemoRedrawing * * Function description * Demonstrates how useful can be a callback */ static void _DemoRedrawing(void) { int i; int tm; int tDiff; _ChangeInfoText("Demonstrating redrawing"); GUI_Delay(SPEED); _LiftUp(40); GUI_Delay(SPEED/3); _ChangeInfoText("Using a callback for redrawing"); GUI_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); } GUI_Delay(SPEED/4); _LiftDown(30); GUI_Delay(SPEED/2); _ChangeInfoText("Without redrawing"); GUI_Delay(SPEED); _LiftUp(30); GUI_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); } GUI_Delay(SPEED/3); WM_SetCallback(WM_HBKWIN, _cbBkWindow); _LiftDown(40); GUI_Delay(SPEED); }
/******************************************************************* * * _DemoHideShowParent Demonstrates the use of WM_HideWindow and WM_ShowWindow */ static void _DemoHideShowParent(void) { _ChangeInfoText("WM_HideWindow(Parent)"); GUI_Delay(SPEED); WM_HideWindow(_hWindow2); GUI_Delay(SPEED/3); WM_HideWindow(_hWindow1); GUI_Delay(SPEED); _ChangeInfoText("WM_ShowWindow(Parent)"); GUI_Delay(SPEED); WM_ShowWindow(_hWindow1); GUI_Delay(SPEED/3); WM_ShowWindow(_hWindow2); GUI_Delay(SPEED); }
/******************************************************************* * * _DemoDeleteWindow Demonstrates the use of WM_DeleteWindow */ static void _DemoDeleteWindow(void) { _ChangeInfoText("WM_DeleteWindow()"); GUI_Delay(SPEED); WM_DeleteWindow(_hWindow2); GUI_Delay(SPEED/3); WM_DeleteWindow(_hWindow1); GUI_Delay(SPEED); _ChangeInfoText(""); GUI_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()"); GUI_Delay(SPEED); _LiftUp(30); for (i = 0; i < 20; 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); } for (i = 0; i < 20; i++) { tm = GUI_GetTime(); WM_ResizeWindow(_hWindow1, 1, 1); WM_ResizeWindow(_hWindow2, -1, -1); tDiff = 15 - (GUI_GetTime() - tm); GUI_Delay(tDiff); } _LiftDown(30); GUI_Delay(SPEED); }
/******************************************************************* * * _DemoCreateWindowAsChild Demonstrates the use of WM_CreateWindowAsChild */ static void _DemoCreateWindowAsChild(void) { /* Create windows */ _ChangeInfoText("WM_CreateWindowAsChild()"); GUI_Delay(SPEED); _hChild = WM_CreateWindowAsChild(10, 50, 145, 40, _hWindow2, WM_CF_SHOW | WM_CF_MEMDEV, _cbChild, 0); GUI_Delay(SPEED); }
/******************************************************************* * * _DemoInvalidateWindow Demonstrates the use of WM_InvalidateWindow */ static void _DemoInvalidateWindow(void) { _ChangeInfoText("WM_InvalidateWindow()"); _WindowColor1 = GUI_BLUE; _FrameColor1 = GUI_GREEN; GUI_Delay(SPEED); WM_InvalidateWindow(_hWindow1); GUI_Delay(SPEED); }
/******************************************************************* * * _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(); }
/******************************************************************* * * _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()"); GUI_Delay(SPEED); _hWindow1 = WM_CreateWindow( 50, 70, 165, 100, WM_CF_SHOW | WM_CF_MEMDEV, _cbWindow1, 0); GUI_Delay(SPEED/3); _hWindow2 = WM_CreateWindow(105, 125, 165, 100, WM_CF_SHOW | WM_CF_MEMDEV, _cbWindow2, 0); GUI_Delay(SPEED); }
/******************************************************************* * * _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(); }
/******************************************************************* * * _DemoSetCallback Demonstrates the use of WM_SetCallback */ static void _DemoSetCallback(void) { _ChangeInfoText("WM_SetCallback()"); GUI_Delay(SPEED); WM_SetCallback(_hWindow1, _cbDemoCallback1); WM_InvalidateWindow(_hWindow1); GUI_Delay(SPEED/2); WM_SetCallback(_hWindow2, _cbDemoCallback2); WM_InvalidateWindow(_hWindow2); GUI_Delay(SPEED*3); WM_SetCallback(_hWindow1, _cbWindow1); WM_InvalidateWindow(_hWindow1); GUI_Delay(SPEED/2); WM_SetCallback(_hWindow2, _cbWindow2); WM_InvalidateWindow(_hWindow2); GUI_Delay(SPEED); }
/********************************************************************* * * _Demo */ static void _Demo(void) { int Key = 0; int Cnt = 10; char acInfoText[] = "-- sec to play with header control"; _ChangeInfoText("HEADER_AddItem"); HEADER_AddItem(_hHeader, 100, "Red" , GUI_TA_VCENTER | GUI_TA_HCENTER); HEADER_AddItem(_hHeader, 0, "Green", GUI_TA_VCENTER | GUI_TA_HCENTER); HEADER_AddItem(_hHeader, 0, ":-)" , GUI_TA_VCENTER | GUI_TA_HCENTER); GUI_Delay(750); _ChangeInfoText("HEADER_SetItemWidth"); HEADER_SetItemWidth(_hHeader, 1, 60); GUI_Delay(750); _ChangeInfoText("HEADER_SetItemText"); HEADER_SetItemWidth(_hHeader, 2, 100); HEADER_SetItemText(_hHeader, 2, "Blue"); GUI_Delay(750); _ChangeInfoText("HEADER_SetFont"); HEADER_SetFont(_hHeader, &GUI_Font8x8); GUI_Delay(750); _ChangeInfoText("HEADER_SetHeight"); HEADER_SetHeight(_hHeader, 50); GUI_Delay(750); _ChangeInfoText("HEADER_SetTextColor"); HEADER_SetTextColor(_hHeader, GUI_YELLOW); GUI_Delay(750); _ChangeInfoText("HEADER_SetBkColor"); HEADER_SetBkColor(_hHeader, GUI_DARKGRAY); GUI_Delay(750); _ChangeInfoText("HEADER_SetTextAlign"); HEADER_SetTextAlign(_hHeader, 0, GUI_TA_HCENTER); while (!Key && (Cnt > 0)) { acInfoText[0] = '0' + (Cnt / 10); acInfoText[1] = '0' + (Cnt-- % 10); _ChangeInfoText(acInfoText); GUI_Delay(1000); Key = GUI_GetKey(); } }
/******************************************************************* * * _DemoMoveWindow Demonstrates the use of WM_MoveWindow */ static void _DemoMoveWindow(void) { int i, tm, tDiff; _ChangeInfoText("WM_MoveWindow()"); GUI_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); } GUI_Delay(SPEED); }
/******************************************************************* * * _DemoMoveTo Demonstrates the use of WM_MoveTo */ static void _DemoMoveTo(void) { int i, tm, tDiff; _ChangeInfoText("WM_MoveTo()"); GUI_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); } GUI_Delay(SPEED); }
/******************************************************************* * * _DemoClipping * * Function description * Demonstrates clipping at parent borders */ static void _DemoClipping(void) { int i; int tm; int tDiff; _ChangeInfoText("Demonstrating clipping of child"); GUI_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); } GUI_Delay(SPEED); }
/********************************************************************* * * _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); } }
/********************************************************************* * * _Demo */ static void _Demo(void) { unsigned int i, j; int Key = 0; int Cnt = 15; char acInfoText[] = "-- sec to play with header control"; HEADER_Handle hHeader; hHeader = LISTVIEW_GetHeader(_hListView); WM_SetFocus(_hListView); _ChangeInfoText("LISTVIEW_AddColumn"); LISTVIEW_AddColumn(_hListView, 100, "EAN", GUI_TA_CENTER); GUI_Delay(SPEED / 2); LISTVIEW_AddColumn(_hListView, 50, "Order #\0x0", GUI_TA_CENTER); GUI_Delay(SPEED / 2); LISTVIEW_AddColumn(_hListView, 100, "Description", GUI_TA_CENTER); GUI_Delay(SPEED / 2); _ChangeInfoText("SCROLLBAR_CreateAttached"); SCROLLBAR_CreateAttached(_hListView, SCROLLBAR_CF_VERTICAL); GUI_Delay(SPEED / 2); _ChangeInfoText("LISTVIEW_AddRow"); for (i = 0; i < GUI_COUNTOF(_aTable_1); i++) { LISTVIEW_AddRow(_hListView, _aTable_1[i]); GUI_Delay(SPEED / 3); } _ChangeInfoText("LISTVIEW_IncSel"); for (i = 0; i < LISTVIEW_GetNumRows(_hListView); i++) { LISTVIEW_IncSel(_hListView); GUI_Delay(SPEED / 4); } GUI_Delay(SPEED / 4); _ChangeInfoText("LISTVIEW_DecSel"); for (i = 0; i < LISTVIEW_GetNumRows(_hListView); i++) { LISTVIEW_DecSel(_hListView); GUI_Delay(SPEED / 4); } GUI_Delay(SPEED / 4); _ChangeInfoText("LISTVIEW_SetTextAlign"); LISTVIEW_SetTextAlign(_hListView, 0, GUI_TA_RIGHT); GUI_Delay(SPEED * 0.7); _ChangeInfoText("LISTVIEW_SetColumnWidth"); LISTVIEW_SetColumnWidth(_hListView, 1, 70); GUI_Delay(SPEED * 0.7); _ChangeInfoText("HEADER_SetTextColor"); HEADER_SetTextColor(hHeader, GUI_BLUE); GUI_Delay(SPEED * 0.7); _ChangeInfoText("LISTVIEW_SetItemText"); for (i = 0; i < GUI_COUNTOF(_aTable_2); i++) { for (j = 0; j < GUI_COUNTOF(_aTable_2[i]); j++) { LISTVIEW_SetItemText(_hListView, j, i, _aTable_2[i][j]); } } GUI_Delay(SPEED / 2); _ChangeInfoText("LISTVIEW_SetBkColor"); LISTVIEW_SetBkColor(_hListView, 0, GUI_YELLOW); GUI_Delay(SPEED * 0.7); _ChangeInfoText("LISTVIEW_SetGridVis"); LISTVIEW_SetGridVis(_hListView, 1); GUI_Delay(SPEED * 0.7); _ChangeInfoText("HEADER_SetHeight"); HEADER_SetHeight(hHeader, 30); GUI_Delay(SPEED * 0.7); _ChangeInfoText("HEADER_SetBitmapEx"); HEADER_SetBitmap(hHeader, 0, &bmBarCode); GUI_Delay(SPEED * 0.7); while ((Key != GUI_KEY_ENTER) && (Cnt > 0)) { acInfoText[0] = '0' + (Cnt / 10); acInfoText[1] = '0' + (Cnt-- % 10); _ChangeInfoText(acInfoText); GUI_Delay(1000); Key = GUI_GetKey(); } }
/******************************************************************* * * _DemoBringToBottom Demonstrates the use of WM_BringToBottom */ static void _DemoBringToBottom(void) { _ChangeInfoText("WM_BringToBottom()"); GUI_Delay(SPEED); WM_BringToBottom(_hWindow1); GUI_Delay(SPEED); }