FRAMEWIN_Handle FRAMEWIN_Create( const char* pText, WM_CALLBACK* cb, int Flags, int x0, int y0, int xsize, int ysize) { return FRAMEWIN_CreateAsChild(x0, y0, xsize, ysize, WM_HWIN_NULL, pText, cb, Flags); }
FRAMEWIN_Handle FRAMEWIN_CreateIndirect(const GUI_WIDGET_CREATE_INFO* pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK* pCallback) { FRAMEWIN_Handle hObj; hObj = FRAMEWIN_CreateAsChild( pCreateInfo->x0 + x0, pCreateInfo->y0 + y0, pCreateInfo->xSize, pCreateInfo->ySize, hWinParent, pCreateInfo->pName, pCallback, 0); if (hObj) { FRAMEWIN_Obj* pObj = FRAMEWIN_H2P(hObj); pObj->Flags = pCreateInfo->Flags; } return hObj; }
/********************************************************************* * * GUIDEMO_main(): Small version of the demo * ********************************************************************** */ void GUIDEMO_main(void) { #if GUI_WINSUPPORT int i; #endif #if GUI_WINSUPPORT #if LCD_NUM_DISPLAYS > 1 FRAMEWIN_CreateAsChild(10, 10, 100, 100, WM_GetDesktopWindowEx(1), "Display 1", NULL, WM_CF_SHOW); GUI_Delay(1000); #endif WM_SetCreateFlags(WM_CF_MEMDEV); /* Automatically use memory devices on all windows */ _ButtonSizeX = 27; _ButtonSizeY = 14; _ahButton[0] = BUTTON_Create(LCD_GetXSize() - _ButtonSizeX * 2 - 5, LCD_GetYSize() - _ButtonSizeY - 3, _ButtonSizeX, _ButtonSizeY, 'H' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); _ahButton[1] = BUTTON_Create(LCD_GetXSize() - _ButtonSizeX - 3, LCD_GetYSize() - _ButtonSizeY - 3, _ButtonSizeX, _ButtonSizeY, 'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); BUTTON_SetFont(_ahButton[0], &GUI_Font8_ASCII); BUTTON_SetFont(_ahButton[1], &GUI_Font8_ASCII); BUTTON_SetText(_ahButton[0], "Stop"); BUTTON_SetText(_ahButton[1], "Next"); _UpdateCmdWin(); WM_ExecIdle(); #endif /* Show Intro */ GUIDEMO_Intro(); /* 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(_ahButton); i++) { BUTTON_Delete(_ahButton[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 }