很象用TURBO VISION写的界面。
/* DATE:05/2000 TOPIC:文本菜单 pass by:turboc 20
*/
# include <graphics.h># include <alloc.h># include <process.h># include <stdio.h># include <stdlib.h># include <time.h># include <string.h># include <dos.h># include <bios.h># include <conio.h># include <ctype.h>
# define SCREENMINX 0# define SCREENMINY 0# define SCREENMAXX 79# define SCREENMAXY 24
#define WindowMaxX 79#define WindowMinX 0#define WindowMaxY 24#define WindowMinY 0
/* #define BLINK 0x80 */#define LIGHT 0x08#define WHITE 0x07#define BLACK 0x00#define RED 0x04#define GREEN 0x02#define BLUE 0x01
#define MIXCOLOR(A,B) A|B#define LIGHTSHOW(A) A|LIGHT#define DARKSHOW(A) A&0xf7#define BLINKSHOW(A) A|BLINK#define NOTBLINKSHOW(A) A&0x7f#define BACKCOLOR(A) A<<4#define MIX(A,B) (A | BACKCOLOR(B))#define GetBackColor(A) ((A&0x70)>>4)#define GetForeColor(A) A&0x0f#define EnabledSelectMenuItem MIX(BLACK,WHITE)#define EnabledMenuItem MIX(BLACK,GREEN)#define DisabledSelectMenuItem MIX(LIGHSHOW(BLACK),BLACK)#define DisabledMenuItem MIX(LIGHSHOW(BLACK),WHITE)
# define INSERT 0x5200# define ESC 0x001b# define TAB 0x0f09# define RETURN 0x000d# define RIGHT 0x4d00# define LEFT 0x4b00# define UP 0x4800# define DOWN 0x5000# define BS 0x0e08# define HOME 0x4700# define END 0x4f00# define PGUP 0x4900# define PGDN 0x5100# define DEL 0x5300# define F1 0x3b00# define F2 0x3c00# define F3 0x3d00# define F4 0x3e00# define F5 0x3f00# define F6 0x4000# define F7 0x4100# define F8 0x4200# define F9 0x4300# define F10 0x4400
# define MenuInGround 1# define MenuActiveGround 2# define MenuActiveItem 3# define MenuInItem 4# define MenuEdge 5# define WindowEdge 6# define WindowGround 7# define PopWindow 8
/*unsigned char AllColors[20] = { 0 ,CYAN , LIGHTRED , YELLOW , BLACK , WHITE , LIGHTRED,BLUE, CYAN ,9 ,10,11 ,12 ,13 ,14,15} ;*/
typedef unsigned char UCHAR;typedef unsigned int UINT;typedef unsigned long ULONG;
char edge[7]={0xda,0xc4,0xbf,0xb3,0xd9,0xc0,'/0'};
/* char edge1[7]={}; */
#define INUM 10 /* R maximum IO itenls in each MENU w */
typedef struct _menu { char coor[4]; /* The menu's area w */ char itemcoor[4 * INUM]; /* max IO item, each with xl,yl ,x2,y2 w */ char itemdispxy[2 * INUM] ; /* Actually disp item name's X coor w */ char select; /* selected item's ord # */ char itemnum; /* The number of items in this menu w */ char **itemname; /* w item's name(point to static data) R */ int COMMAND_ID[INUM]; /* w Key number R */}MENUTYPE ;
static char * MainMenuItem[]= {" File "," Edit "," Run "," Compile "," Help ", " Exit ", 0 };static char *Syshelp=" F1-Help F5-Zoom F6-Switch F7-Trace F8-Step F9-Make F10-Menu";
static char * SubMenuItem1[]= {" Load File... F3 ", " Pick File Alt+F3 ", " New ", " Save F2 ", " Write to ", " Os Shell ", " Quit Alt+X ",0};/*static char *SubMenuItem[6][]={{"Help11..."}, {*/static char * SubMenuItem2[]= {" Item21...", " Draw ", " Item23 ", " Item24 ", " Item25 ", " Item26 ", " Item27 ", " Item28 ",0};
static char * SubMenuItem3[]= {" Item31... ", " Item32... ", " Item add... ", " Item33 ", 0 };static char * SubMenuItem4[]= {" Item41... ", " Item42... ", " Moving Text ", " Item44 ", " Item45 ", " item ** ", 0} ;static char * SubMenuItem5[]= {" Help Index F1 ", " About... ", " System Info ",0};
static char * SubMenuItem6[]= {0};
void getitemcount(char ** ,int * ,int * ,int * );
void LoadMainMenu(void);
void LoadSubMenu(char **name, int ord);
int ManageSubMenu (void ) ;
void ManageMainMenu (void) ;void DisplayMainMenu (void ) ;int DisplaySubMenu (int ord) ;void Help_page_show(void) {return ; } ;void Exitmenu (int) ;void In_ActiveMainMenuItem(int select , char In_Active) ;void In_ActiveSubMenuItem(int ord , int select , char In_Active) ;int GetKey (void) ;void FuncProc (int ID) ;void Draw(void) ;void MoveText (void) ;void About (void) ;void MessageBox(char * Message) ;void GoodBye(char * pcInf1 , char * pcInf2) ;
void win();char gettextattrib();void settextattrib();void cprintfxy();
char *textbuf;MENUTYPE MainMenu , SubMenu[INUM] ;/* int maxx, texth, textw; */
void main(void){
clrscr(); win(0,1,SCREENMAXX+1,SCREENMAXY,'/xb0',BLUE<<4|LIGHTSHOW(GREEN)); cprintfxy(25,9,"Analytic Hierarchy Process",BLUE<<4|BLACK);
cprintfxy(26,11,"Howard.Hsu & WeiGuoZhang",BLUE<<4|BLACK); cprintfxy(33,18,"05/18/2000",BLUE<<4|BLACK); win(0,24,80,1,' ',WHITE<<4|BLUE); LoadMainMenu(); LoadSubMenu (SubMenuItem1 , 0); LoadSubMenu (SubMenuItem2 , 1); LoadSubMenu (SubMenuItem3 , 2); LoadSubMenu (SubMenuItem4 , 3); LoadSubMenu (SubMenuItem5 , 4); LoadSubMenu (SubMenuItem6 , 5); ManageMainMenu();}
void prncharxy(char xpos,char ypos,char ch,char attrib){ char far *p=(char far *)0xb8000000; if(xpos<SCREENMINX || xpos>SCREENMAXX || ypos<SCREENMINY || ypos>SCREENMAXY) return;
*(p+ypos%*160+2*(xpos