Metropoli BBS
VIEWER: wgt40.c MODE: TEXT (ASCII)
/*
==============================================================================
                      WordUp Graphics Toolkit Version 5.0                     
                             Demonstration Program 40                         
                                                                              
  Shows how to use the drop down menu library.                                
                                                                              
  *** PROJECT ***                                                             
  This program requires the WGT5_WC.LIB and WMENU_WC.LIB files to be linked.  
                                                                              
  *** DATA FILES ***                                                          
  LITTLE.WFN must be in your executable directory.                        
                                                           WATCOM C++ VERSION 
==============================================================================
*/

#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <wgt5.h>
#include <wgtmenu.h>

wgtfont little;
color pal[256];
char *menubar[10]={" QUIT  "," MENU1  "," MENU2 "," MENU3  ",NULL,NULL,NULL,NULL,NULL,NULL};
short menuchoice;

short oldmode;

void main (void)
{
  oldmode = wgetmode ();
  
  printf ("WGT Example #40\n\n");
  printf ("Some simple drop-down menus are created. Choose the QUIT menu to end the\n");
  printf ("program.\n");
  printf ("\n\nPress any key to continue.\n");
  getch ();

  vga256 ();
  /* change the directory if needed */
  little = wloadfont ("little.wfn");

  wreadpalette (0, 255, pal);
  wsetrgb (1, 63, 63, 63, pal);
  wsetrgb (253, 50, 50, 50, pal);
  wsetrgb (254, 40, 40, 40, pal);
  wsetrgb (255, 30, 30, 30, pal);
  wsetpalette (0, 255, pal);

  menubarcolor = 254;
  menubartextcolor = 1;
  bordercolor = 255;
  highlightcolor = 144;
 
  menufont = little;

  strcpy (dropdown[0].choice[0], " QUIT ");
 
  strcpy (dropdown[1].choice[0], "This is a drop");
  strcpy (dropdown[1].choice[1], "down menu. You can");
  strcpy (dropdown[1].choice[2], "put any text in here");
  strcpy (dropdown[1].choice[3], "and WGT Menus will");
  strcpy (dropdown[1].choice[4], "handle the rest.");
  strcpy (dropdown[1].choice[5], "--------------------");
  strcpy (dropdown[1].choice[6], "You can have up to");
  strcpy (dropdown[1].choice[7], "ten choices per menu");
  strcpy (dropdown[1].choice[8], "and up to ten menus.");
 
  strcpy (dropdown[2].choice[0], " Choice #1 ");
  strcpy (dropdown[2].choice[1], " Choice #2 ");
  strcpy (dropdown[2].choice[2], " Choice #3 ");
  strcpy (dropdown[2].choice[3], "You can even change");
  strcpy (dropdown[2].choice[4], "the colors of each");
  strcpy (dropdown[2].choice[5], "dropdown menu.");
 
  strcpy (dropdown[3].choice[0], "You can also use");
  strcpy (dropdown[3].choice[1], "any font, as long");
  strcpy (dropdown[3].choice[2], "as all the menus");
  strcpy (dropdown[3].choice[3], "fit on the screen.");
  strcpy (dropdown[3].choice[4], "******************");
  strcpy (dropdown[3].choice[5], "Try changing");
  strcpy (dropdown[3].choice[6], "menufont to NULL");
  strcpy (dropdown[3].choice[7], "and the default");
  strcpy (dropdown[3].choice[8], "font will be used.");
  strcpy (dropdown[3].choice[9], "******************");

  initdropdowns ();

  dropdown[2].color = 12;
  dropdown[2].bordercolor = 14;
  dropdown[2].textcolor = 1;

  showmenubar ();
 
  mon ();

  do { 
    menuchoice = checkmenu ();
  } while (menuchoice != 0);

  removemenubar ();
  wfreefont (little);
  mdeinit ();
  wsetmode (oldmode);
}


[ RETURN TO DIRECTORY ]