/******************************************************************
This program is a demonstration for RMT10 and is written
very quick and dirty. All the windows are not real windows
and also the background is not saved and also the cursor is
not turned off
The intention of this demo is to get a coarse overview
of RMT10.
*******************************************************************/

#include "alloc.h"
#include "conio.h"
#include "rmt10.h"

/******************************************************
prototypes of sub-menu functions
******************************************************/

void about();
void files();
void help();
/******************************************************/

main()
{
  void *xx;

  textbackground(BLUE);
  clrscr();
  window(1,1,80,1);
  textbackground(LIGHTGRAY);
  clrscr();
  window(1,1,80,25);
  xx = menu_init(4,LIGHTGRAY*16+BLACK,BLACK*16+WHITE,LIGHTGRAY*16+DARKGRAY,LIGHTGRAY*16+RED,BLUE*16+WHITE,0x0013,25);
  if (xx != NULL) {
    menu_add(xx,2,1,"About","Tells you about the system",0,'A',0x01,about);
    menu_add(xx,9,1,"Files","  ",0,'F',0x01,files);
    menu_add(xx,16,1,"Help","Need some Help ?",0,'H',0x01,help);
    menu_add(xx,22,1,"eXit","Just for fun: Exit",1,'X',0x01,NULL);
    menu_proc(xx);
    menu_exit(xx);
  }
}

/******************************************************/
void about()
{
  int junk;

  textattr(BLUE*16+WHITE);
  gotoxy(40,5);
  cprintf("Richard's Menu Tools Rev. 1.0 !");
  gotoxy(40,6);
  cprintf("Press any key to continue");
  junk = getch();
  if (junk == 0)
    getch();
  gotoxy(40,5);
  cprintf("                                   ");
  gotoxy(40,6);
  cprintf("                         ");
}

void files()
{
  void *xx;

  window(10,3,24,8);
  textbackground(BLACK);
  clrscr();
  window(8,2,22,7);
  textbackground(LIGHTGRAY);
  clrscr();
  window(1,1,80,25);
  xx = menu_init(4,LIGHTGRAY*16+BLACK,BLACK*16+WHITE,LIGHTGRAY*16+DARKGRAY,LIGHTGRAY*16+RED,BLUE*16+YELLOW,0x0004,25);
  menu_add(xx,9,3," Testentry 0 ","Entry 0 is selected",1,'T',0x00,NULL);
  menu_add(xx,9,4," Testentry 1 ","You have selected entry 1!",2,'E',0x00,NULL);
  menu_add(xx,9,5," Testentry 2 ","This is Entry 2",3,'S',0x00,NULL);
  menu_add(xx,9,6," Testentry 3 ","Last not least: Entry 3 !!!",4,'T',0x00,NULL);
  menu_proc(xx);
  menu_exit(xx);
  window(8,2,24,8);
  textbackground(BLUE);
  clrscr();
  window(1,1,80,25);
}

void mhelp()
{
  void *xx;

  window(34,4,48,7);
  textbackground(BLACK);
  clrscr();
  window(32,3,46,6);
  textbackground(LIGHTGRAY);
  clrscr();
  window(1,1,80,25);
  xx = menu_init(2,LIGHTGRAY*16+BLACK,BLACK*16+WHITE,LIGHTGRAY*16+DARKGRAY,LIGHTGRAY*16+RED,BLUE*16+YELLOW,0x0004,25);
  menu_add(xx,33,4," Testentry 0 ","Entry 0 is selected",1,'T',0x01,NULL);
  menu_add(xx,33,5," Testentry 1 ","You have selected entry 1!",2,'E',0x01,NULL);
  menu_proc(xx);
  menu_exit(xx);
  window(32,3,48,7);
  textbackground(BLUE);
  clrscr();
  window(1,1,80,25);
}

void help()
{
  void *xx;

  window(17,3,31,8);
  textbackground(BLACK);
  clrscr();
  window(15,2,29,7);
  textbackground(LIGHTGRAY);
  clrscr();
  window(1,1,80,25);
  xx = menu_init(4,LIGHTGRAY*16+BLACK,BLACK*16+WHITE,LIGHTGRAY*16+DARKGRAY,LIGHTGRAY*16+RED,BLUE*16+YELLOW,0x000c,25);
  menu_add(xx,16,3," Testentry 0 ","Entry 0 is selected",1,'T',0x00,NULL);
  menu_add(xx,16,4," More Help ->","Need more help?",1,'M',0x01,mhelp);
  menu_add(xx,16,5," Testentry 2 ","This is Entry 2",1,'T',0x01,NULL);
  menu_add(xx,16,6," Testentry 3 ","Last not least: Entry 3 !!!",4,'T',0x01,NULL);
  menu_proc(xx);
  menu_exit(xx);
  window(15,2,31,8);
  textbackground(BLUE);
  clrscr();
  window(1,1,80,25);
}



