/********************************************************************* * * 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); } }
/********************************************************************* * * 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); } }
/********************************************************************* * * MULTIPAGE_Create */ MULTIPAGE_Handle MULTIPAGE_Create(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int Id, int Flags, int ExFlags) { return MULTIPAGE_CreateEx(x0, y0, xsize, ysize, hParent, Flags, ExFlags, Id); }
static void GUIMakeWinOut() { hWinOut = WINDOW_CreateEx( 20, 140, 200, 150, 0, WM_CF_SHOW, 0, ++curId, 0 ); hMultipage = MULTIPAGE_CreateEx( 10, 10, 180, 130, hWinOut, WM_CF_SHOW, 0, ++curId ); MULTIPAGE_SetSkin(hMultipage, MULTIPAGE_SKIN_FLEX); WM_HWIN hMultipageWindow1 = WINDOW_CreateEx( 0, 0, 180, 110, hMultipage, 0, 0, ++curId, _cbPage1 ); WINDOW_SetBkColor(hMultipageWindow1, GUI_RED); MULTIPAGE_AddPage(hMultipage, hMultipageWindow1, "Custom"); hListview = LISTVIEW_CreateEx(0, 0, 180, 130, hMultipageWindow1, WM_CF_SHOW, 0, ++curId ); LISTVIEW_AddColumn( hListview, 120 , "Cloth", GUI_TA_HCENTER | GUI_TA_VCENTER ); LISTVIEW_AddColumn( hListview, 60 , "Position", GUI_TA_HCENTER | GUI_TA_VCENTER ); const char* name[][2] = { {"Polka dot long dress", "40"}, {"White Shirt", "60"} }; LISTVIEW_AddRow( hListview, (GUI_ConstString*)name[0] ); LISTVIEW_AddRow( hListview, (GUI_ConstString*)name[1] ); WM_HWIN hMultipageWindow2 = WINDOW_CreateEx( 0, 0, 180, 110, hMultipage, 0, 0, ++curId, NULL ); WINDOW_SetBkColor(hMultipageWindow2, GUI_BLUE); MULTIPAGE_AddPage(hMultipage, hMultipageWindow2, "Suggest"); }