Close Back

#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<graphics.h>
#include<stdlib.h>
#include<tsr.h>

#define statx 13
#define staty 25

main()
{
	char *menu_items[3]={
				"File",
				"Edit",
				"About"
			    };
	char far *kb;
	kb=(char far *)0x417;
	clrscr();
	fillcolor();
	navbar();
	statusbar();
	box(1,0,23,79,WHITE,BLUE);
	menus(3,menu_items);
	while(1)
	{
		char ch;
		ch=getch();
		if(ch == 0x1b)
			exit(0);
		if((*kb & 8) == 8)
		{
			gotoxy(29,12);
			textcolor(RED);
			textbackground(BLUE);
			cprintf("Menus Not ready yet");
			while(!kbhit());
			gotoxy(29,12);
			printf("                   ");

		}
	}
}
fillcolor()
{
	int i;
	textbackground(BLUE);
	textcolor(BLUE);
	gotoxy(1,2);
	for(i=0;i<2000-80;i++)
		cprintf("a");
}
navbar()
{
	int i;
	textbackground(7);
	textcolor(7);
	gotoxy(1,1);
	for(i=0;i<80;i++)
		cprintf("a");
}
statusbar()
{
	int i;
	textbackground(7);
	textcolor(7);
	gotoxy(1,25);
	for(i=0;i<79;i++)
		cprintf("a");
	{
		char far *p=((char far *)(0xB0008000+3999));
		*p=122;
	}
	textbackground(7);
	textcolor(BLACK);
	gotoxy(1,25);
	cprintf("   Status : ");

}
menus(int no_of_menus,char **menu_items)
{
	char *blank="  ";
	int i;
	textbackground(7);
	gotoxy(3,1);
	textcolor(RED);
	i=240;
	putch(i);
	gotoxy(4,1);
	for(i=0;i<no_of_menus;i++)
	{
		int x;
		textcolor(BLACK);
		cprintf("%s",blank);
		cprintf("%s",menu_items[i]);
		x=wherex();
		gotoxy(x-strlen(menu_items[i]),wherey());
		textcolor(RED);
		cprintf("%c",menu_items[i][0]);
		gotoxy(x,wherey());
	}
}
box(int r1,int c1,int r2,int c2,int attrb,int bk)
{

	int rr,cc;
	      /*
	clrwin(r1,c1,r2,c2,attrb);
	      */
	textbackground(bk);
	textcolor(attrb);

	gotoxy(c1+1,r1+1);
	putch(201);
	gotoxy(c2+1,r1+1);
	putch(187);
	gotoxy(c1+1,r2+1);
	putch(200);
	gotoxy(c2+1,r2+1);
	putch(188);

	for(rr=r1+1;rr<r2;rr++)
	{
		gotoxy(c1+1,rr+1);
		putch(186);
		gotoxy(c2+1,rr+1);
		putch(186);
	}

	for(cc=c1+1;cc<c2;cc++)
	{
		gotoxy(cc+1,r1+1);
		putch(205);
		gotoxy(cc+1,r2+1);
		putch(205);
	}

}