home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / c / cwl30 / cwl3demo / cwldemo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-15  |  3.6 KB  |  130 lines

  1. #define CWLDEMO_GLOBAL
  2. #include "cwldemo.h"
  3. #include <alloc.h>
  4.  
  5. /* opening lines */
  6. char *openline[] = {
  7. "This is a small demo of The C Window Library 3.0.  This demo shows some of",
  8. "the various things that can be done with text windows, including menus,",
  9. "dialog boxes, screen manipulation, and an example of an event driven clock.",
  10. " ",
  11. "The C Window Library has libraries for Turbo C Version 2.0 and higher,",
  12. "Turbo C++, Borland C++, Microsoft C Version 5.1 and higher, Visual C++",
  13. "and Symantec C++ version 6.0 and higher.  Watcom support will be available",
  14. "in November 1994, with OS/2 and UNIX support thereafter.",
  15. " ",
  16. "The C Window Library order form is found in the file ORDER.FRM.  To order ",
  17. "directly, contact Paul McKenzie at (718) 379-6777 for more information.",
  18. " ",
  19. "This demo is in itself an example of a pulldown menu system that was created",
  20. "with CWL.  To end the pulldown menu, press Escape twice to exit the pulldown",
  21. "menu.  If you have installed a mouse driver, you can use the mouse to access",
  22. "the menu, clock, and dialog box demos."
  23. };
  24.  
  25.  
  26. main()
  27. {
  28.   /* Initialize CWL */
  29.   InitCWL();
  30.  
  31.   /* Display Opening Screen */
  32.   Intro( );
  33.  
  34.   /* Create Pulldown Menu */
  35.   InitPulldown();
  36.  
  37.   /* Do the Demo */
  38.   DoDemo();
  39.   /* Uninitialize CWL */
  40.   last_function( );
  41. }
  42.  
  43.  
  44. CWL_VOID InitCWL()
  45. {
  46.   int dummy;
  47.  
  48.   /* Initialize CWL System */
  49.   WindowInitializeSystem( );
  50.  
  51.   /* Set error function */
  52.   CWLerror_func = custom_error_func;
  53.  
  54.   /* Clear the screen */
  55.   ClearScreen(0x7);
  56.  
  57.   /* Initialize the Desktop Window */
  58.   WindowInitDesktop( 0 );
  59.  
  60.   /* Initialize Mouse */
  61.   MouseInitializeSystem(MOUSE_FULL_INSTALL, &dummy, CWLscreen_rows / 2,
  62.                         CWLscreen_cols / 2);
  63.  
  64.   /* Initialize Form System */
  65.   FormInitializeSystem();
  66.  
  67. }
  68.  
  69. CWL_VOID Intro()
  70. {
  71.   int i;
  72.  
  73.   error_window = WindowInitialize(DESKTOP_WINDOW,BORDER,0,0,1,4,
  74.                                   CREATE_VIDEO_ATTRIBUTE(RED_, LIGHTWHITE_),
  75.                                   CREATE_VIDEO_ATTRIBUTE(RED_, LIGHTWHITE_),
  76.                                   DOUBLEBOX);
  77.  
  78.   wOpeningScreen = WindowInitialize(DESKTOP_WINDOW,BORDER,0,0,78,NUMLINES + 2,
  79.                                     CREATE_VIDEO_ATTRIBUTE(RED_, LIGHTWHITE_),
  80.                                     CREATE_VIDEO_ATTRIBUTE(RED_, LIGHTWHITE_),
  81.                                     SINGLEBOX);
  82.  
  83.   wNotAvailable = WindowInitialize(DESKTOP_WINDOW, BORDER, 0,0, 40, 2,
  84.                                    CREATE_VIDEO_ATTRIBUTE(RED_, LIGHTWHITE_),
  85.                                    CREATE_VIDEO_ATTRIBUTE(RED_, LIGHTWHITE_),
  86.                                    DOUBLEBOX);
  87.  
  88.   WindowCenter(wNotAvailable, HORIZCENTER | VERTCENTER);
  89.   WindowWriteCenterString(wNotAvailable,"Not Available in Shareware Version",0);
  90.   WindowWriteCenterString(wNotAvailable,"Press a key to continue...",1);
  91.  
  92.   for (i = 0; i < NUMLINES; i++)
  93.     WindowWriteString(wOpeningScreen, openline[i], i, 0);
  94.   WindowTitleTop(wOpeningScreen,"[ CWL Demo ]",TITLECENTER);
  95.   WindowCenter(wOpeningScreen, HORIZCENTER | VERTCENTER);
  96.  
  97.   WindowDisplay(wOpeningScreen,1,EXPLODE);
  98.  
  99.   delay(1000);
  100.   WindowWriteCenterString(wOpeningScreen, "Press a key to start the demo...",
  101.                           NUMLINES + 1);
  102.   GET_KEY();
  103.  
  104. /*  WindowClose(wOpeningScreen, CONTRACT);*/
  105. }
  106.  
  107.  
  108.  
  109.  
  110. CWL_VOID DoDemo( )
  111. {
  112.   PulldownSelectMenu(pull,1,0,0);
  113. }
  114.  
  115. CWL_VOID UninitCWL( )
  116. {
  117.   WindowUninitSystem( );
  118. }
  119.  
  120. CWL_VOID NotAvailable( )
  121. {
  122.   WindowDisplay(wNotAvailable, 1, NOEFFECT);
  123.   GET_KEY();
  124.   WindowHide(wNotAvailable, NOEFFECT);
  125. }
  126.  
  127. int Descript(POPUP_MENU_PTR p, int sel) { return POPUP_CONTINUE; }
  128.  
  129.  
  130.