home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / c / cwl30 / cwl3demo / cwlfun13.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-24  |  5.7 KB  |  193 lines

  1. #include "cwldemo.h"
  2.  
  3. CWL_VOID InitPulldown( )
  4. {
  5.   WPOINTER wBar;
  6.   FILE *infile;
  7.   int len;
  8.   int maxwidth;
  9.   char buf[100];
  10.   char *temp;
  11.   int count = NUMWAIT;
  12.  
  13.   /* define colors */
  14.   menu_colors[ENTRYCOLOR] =
  15.   menu_colors[BORDERCOLOR] = BLACKONWHITE;
  16.   menu_colors[UNAVAILCOLOR] = GRAYONWHITE;
  17.   menu_colors[HOTKEYCOLOR] =
  18.   menu_colors[HIGHLIGHTCOLOR] = WHITEONBLACK;
  19.  
  20.   /* Initialize pulldown Menu */
  21.   pull = PulldownCreateMenu(DESKTOP_WINDOW, BARDEFOPTIONS,
  22.                             menu_colors, 0, 0, 80);
  23.  
  24.  
  25.   /* Make Bar borderless */
  26.   wBar = BAR_WINDOW(BAR_MENU_PTR_FROM_PULLDOWN(pull));
  27.   WindowRemoveBorder(wBar);
  28.   WindowMove(wBar,0,0);
  29.  
  30.   /* Initialize popup entry 0 */
  31.   popup[0] = PopupCreateMenu(DESKTOP_WINDOW, POPUPDEFOPTIONS | POPUPWRAP,
  32.                              menu_colors, 0, 0);
  33.  
  34.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  35.                    " Creating...", 0, WindowFunc[0]);
  36.  
  37.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  38.                    " Colors...", 0, WindowFunc[1]);
  39.  
  40.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  41.                    " &Borders...", 0, WindowFunc[2]);
  42.  
  43.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  44.                    " Writing Text...", 0, WindowFunc[3]);
  45.  
  46.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  47.                    " Titles...", 0, WindowFunc[4]);
  48.  
  49.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  50.                    " Moving...", 0, WindowFunc[5]);
  51.  
  52. /*  PopupAppendEntry(popup[0],CWL_MSTRING ,
  53.                    " Hiding...", 0, WindowFunc[6]);        */
  54.  
  55.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  56.                    " Child...", 0, WindowFunc[6]);
  57.  
  58.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  59.                    " Virtual...", 0, WindowFunc[7]);
  60.  
  61.   PopupAppendEntry(popup[0],CWL_MSTRING ,
  62.                    " Effects...", 0, WindowFunc[8]);
  63.  
  64.   PulldownInsertEntry(pull, CWL_MSTRING ,
  65.                       0,"&Window",
  66.                       0,(BARSELECTPROC)0,
  67.                       popup[0]);
  68.  
  69.  
  70.   /* Initialize popup entry 1 */
  71.   popup[1] = PopupCreateMenu(DESKTOP_WINDOW, POPUPDEFOPTIONS | POPUPWRAP,
  72.                              menu_colors, 0, 0);
  73.  
  74.   PopupAppendEntry(popup[1],CWL_MSTRING ,
  75.                    " Dialog Box...", 0, FormFunc[0]);
  76.  
  77.   PulldownAppendEntry(pull, CWL_MSTRING ,
  78.                       "&Data Entry",
  79.                       0,(BARSELECTPROC)0,
  80.                       popup[1]);
  81.  
  82.  
  83.   /* Initialize popup entry 2 */
  84.  
  85.   popup[2] = PopupCreateMenu(DESKTOP_WINDOW, POPUPDEFOPTIONS | POPUPWRAP,
  86.                              menu_colors, 0, 0);
  87.  
  88.   PopupAppendEntry(popup[2],CWL_MSTRING  | CWL_MCHECKED,
  89.                    " Direct Screen", 0, ScreenFunc[0]);
  90.   PopupAppendEntry(popup[2],CWL_MSTRING ,
  91.                    " BIOS", 0, ScreenFunc[1]);
  92.  
  93.   PopupAppendEntry(popup[2],CWL_MSTRING ,
  94.                    " Check Snow", 0, ScreenFunc[2]);
  95.  
  96.   PopupAppendEntry(popup[2],CWL_MSEPARATOR, SEPARATOR, 0, (POPUPSELECTPROC)0);
  97.  
  98.   PopupAppendEntry(popup[2],CWL_MSTRING ,
  99.                    " 25 Rows", 0, ScreenFunc[3]);
  100.  
  101.   PopupAppendEntry(popup[2],CWL_MSTRING ,
  102.                    " 43 Rows", 0, ScreenFunc[4]);
  103.  
  104.   PopupAppendEntry(popup[2],CWL_MSTRING ,
  105.                    " 50 Rows", 0, ScreenFunc[5]);
  106.  
  107.   PulldownAppendEntry(pull, CWL_MSTRING ,
  108.                       "&Screen Access",
  109.                       0,(BARSELECTPROC)0,
  110.                       popup[2]);
  111.  
  112.   /* Check proper screen mode */
  113.   if (LINEMODE25)
  114.     PopupCheckEntry(popup[2],4,TRUE);
  115.   else
  116.   if (LINEMODE43)
  117.     PopupCheckEntry(popup[2],5,TRUE);
  118.   else
  119.   if (LINEMODE50)
  120.     PopupCheckEntry(popup[2],6,TRUE);
  121.  
  122.   /* Initialize popup entry 3 */
  123.   popup[3] = PopupCreateMenu(DESKTOP_WINDOW, POPUPDEFOPTIONS | POPUPWRAP,
  124.                              menu_colors, 0, 0);
  125.  
  126.   PopupAppendEntry(popup[3],CWL_MSTRING ,
  127.                    "Clock...", 0, EventFunc[0]);
  128.  
  129.   PulldownAppendEntry(pull, CWL_MSTRING ,
  130.                       "&Event System",
  131.                       0,(BARSELECTPROC)0,
  132.                       popup[3]);
  133.  
  134.   /* Initialize popup entry 3 */
  135.   PulldownAppendEntry(pull, CWL_MSTRING ,
  136.                       "&Function List",
  137.                       0,ListFunctions,
  138.                       POPUP_NULL_PTR);
  139.  
  140.   /* Fill in popup menu structure */
  141.  
  142.   WindowWriteString(wOpeningScreen,"Loading Data...", NUMLINES, 0);
  143.  
  144.   funclist = PopupCreateMenu(DESKTOP_WINDOW, POPUPDEFOPTIONS | POPUPWRAP,
  145.                                              menu_colors, 0, 0);
  146.   infile = fopen("FUNCLIST.OUT","r");
  147.   if (!infile)
  148.     PopupMenuClose(funclist);
  149.   PopupSetWinDimensions(funclist, 0, 12, POPUP_SETHEIGHT);
  150.   fgets(buf,99,infile);
  151.   maxwidth = 0;
  152.   while(!feof(infile))
  153.   {
  154.     WindowWriteString(wOpeningScreen, waitchars[(count % NUMWAIT)], NUMLINES,
  155.                       16);
  156.     temp = strtok(buf,"\n");
  157.     if (PopupAppendEntry(funclist,
  158.         CWL_MSTRING , buf, 0, Descript) != NO_ERROR)
  159.       break;
  160.     if ((len = strlen(buf)) > maxwidth)
  161.       maxwidth = len;
  162.     fgets(buf,99,infile);
  163.     count++;
  164.     if (count > 100)
  165.       break;
  166.   }
  167.   fclose(infile);
  168.  
  169.  
  170.   WindowTitleTop(POPUP_WINDOW(funclist)," - CWL Functions - ",TITLETOP);
  171.   PopupSetWinDimensions(funclist, maxwidth, 0, POPUP_SETWIDTH);
  172.  
  173.   /* Initialize popup entry 4 */
  174.   popup[4] = PopupCreateMenu(DESKTOP_WINDOW, POPUPDEFOPTIONS | POPUPWRAP,
  175.                              menu_colors, 0, 0);
  176.  
  177.   PopupAppendEntry(popup[4],CWL_MSTRING ,
  178.                    " Popup Menu...", 0, MenuFunc[0]);
  179.  
  180.   PopupAppendEntry(popup[4],CWL_MSTRING ,
  181.                    " Bar Menu...", 0, MenuFunc[1]);
  182.  
  183.   PulldownAppendEntry(pull, CWL_MSTRING ,
  184.                       "&Menus",
  185.                       0,(BARSELECTPROC)0,
  186.                       popup[4]);
  187.  
  188.  
  189.   PulldownCUA(pull);
  190.  
  191.   WindowClose(wOpeningScreen, NOEFFECT);
  192. }
  193.