syslinux-3.08-2 sources from FC4
[bootcd.git] / syslinux / menu / libmenu / tui.h
1 /* -*- c -*- ------------------------------------------------------------- *
2  *   
3  *   Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8  *   Boston MA 02111-1307, USA; either version 2 of the License, or
9  *   (at your option) any later version; incorporated herein by reference.
10  *
11  * ----------------------------------------------------------------------- */
12
13 #ifndef __TUI_H__
14 #define __TUI_H__
15
16 #include <com32.h>
17 #include "com32io.h"
18
19 #ifndef NULL
20 #define NULL ((void *)0)
21 #endif
22
23 #define BELL 0x07
24 // CHRELATTR = ^N, CHABSATTR = ^O
25 #define CHABSATTR 15 
26 #define CHRELATTR 14
27
28 void clearwindow(char top, char left, char bot, char right, 
29                  char page, char fillchar, char fillattr);
30
31 void cls(void); /* Clears the entire current screen page */
32
33 // Generic user input, 
34 // password = 0 iff chars echoed on screen
35 // showoldvalue <> 0 iff current displayed for editing
36 void getuserinput(char *str, unsigned int size, 
37      unsigned int password, unsigned int showoldvalue);
38
39 static inline void getstring(char *str, unsigned int size) 
40 {
41    getuserinput(str,size,0,0);
42 }
43
44 static inline void editstring(char *str, unsigned int size)
45 {
46    getuserinput(str,size,0,1);
47 }
48
49 static inline void getpwd(char * str, unsigned int size)
50 {
51    getuserinput(str,size,1,0);
52 }
53
54 // Box drawing Chars offsets into array
55 #define BOX_TOPLEFT  0x0
56 #define BOX_BOTLEFT  0x1
57 #define BOX_TOPRIGHT 0x2
58 #define BOX_BOTRIGHT 0x3
59 #define BOX_TOP      0x4 // TOP = BOT = HORIZ
60 #define BOX_BOT      0x4
61 #define BOX_HORIZ    0x4
62 #define BOX_LEFT     0x5
63 #define BOX_RIGHT    0x5
64 #define BOX_VERT     0x5 // LEFT=RIGHT=VERT
65 #define BOX_LTRT     0x6 
66 #define BOX_RTLT     0x7 
67 #define BOX_TOPBOT   0x8
68 #define BOX_BOTTOP   0x9
69 #define BOX_MIDDLE   0xA
70
71 typedef enum {BOX_SINSIN,BOX_DBLDBL, BOX_SINDBL, BOX_DBLSIN} boxtype;
72
73 unsigned char * getboxchars(boxtype bt);
74
75 void drawbox(char top,char left,char bot, char right, 
76              char page, char attr,boxtype bt);
77
78 // Draw a horizontal line
79 // dumb == 1, means just draw the line
80 // dumb == 0 means check the first and last positions and depending on what is
81 //    currently on the screen make it a LTRT and/or RTLT appropriately.
82 void drawhorizline(char top, char left, char right, char page, char attr,
83                    boxtype bt, char dumb);
84
85 #endif