home *** CD-ROM | disk | FTP | other *** search
- #include "cwldemo.h"
-
- int WinCreate (POPUP_MENU_PTR p, int sel)
- {
- WPOINTER cw, tw;
- char buf[20];
- int i, rand1, rand2, rand3, rand4, rand5, rand6, rand7, j;
- FLUSH_KEYBOARD();
- cw = WindowInitialize(DESKTOP_WINDOW,
- BORDER,0,0,40,2,BLACKONCYAN,BLACKONCYAN,SINGLEBOX);
- WindowWriteCenterString(cw,"You can create windows easily",0);
- WindowWriteCenterString(cw,"with borders...",1);
- WindowCenter(cw,VERTCENTER | HORIZCENTER);
- WindowDisplay(cw,1,NOEFFECT);
-
- delay_approx(5000);
-
- WindowClose(cw,NOEFFECT);
- cw = WindowInitialize(DESKTOP_WINDOW,
- NOBORDER,0,0,40,1,BLACKONCYAN,BLACKONCYAN,SINGLEBOX);
- WindowWriteCenterString(cw,"...and without borders...",0);
- WindowCenter(cw,VERTCENTER | HORIZCENTER);
- WindowDisplay(cw,1,NOEFFECT);
- delay_approx(5000);
- WindowClose(cw,NOEFFECT);
-
- cw = WindowInitialize(DESKTOP_WINDOW,
- BORDER,0,0,50,1,BLACKONCYAN,BLACKONCYAN,SINGLEBOX);
- WindowWriteCenterString(cw,"You can create overlapping windows ...",0);
- WindowCenter(cw,VERTCENTER | HORIZCENTER);
- WindowDisplay(cw,1,NOEFFECT);
- delay_approx(3000);
- for (i = 0; i < 50; i++)
- {
- rand1 = rand() % (CWLscreen_rows - 1);
- rand2 = rand() % (CWLscreen_cols - 1);
- rand3 = (rand() % (CWLscreen_cols - 1)) + 1;
- rand4 = (rand() % (CWLscreen_rows - 1)) + 1;
- rand5 = rand() % 16;
- rand6 = rand() % 16;
- wTemp[i] = WindowInitialize(DESKTOP_WINDOW, BORDER, rand1, rand2,
- rand3, rand4, rand5, rand6, SINGLEBOX);
- if (!wTemp[i])
- break;
- sprintf(buf,"Window %d",i + 1);
- WindowWriteCenterString(wTemp[i],buf,rand4 / 2);
- WindowDisplay(wTemp[i],1,NOEFFECT);
- }
- delay_approx(5000);
- WindowClear(cw);
- WindowWriteCenterString(cw,"Press a key to clear the windows...",0);
- WindowDisplay(cw,1,NOEFFECT);
- GET_KEY();
- for (j = i-1; j >= 0; j--)
- WindowClose(wTemp[j],NOEFFECT);
- WindowClose(cw,NOEFFECT);
- return POPUP_CONTINUE;
- }