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 <getkey.h>
18 #include <consoles.h>
19 #include "syslnx.h"
20 #include "com32io.h"
21
22 #ifndef NULL
23 #define NULL ((void *)0)
24 #endif
25
26 #define SO '\016'
27 #define SI '\017'
28
29 #define TOP_LEFT_CORNER_BORDER '\154'
30 #define TOP_BORDER '\161'
31 #define TOP_RIGHT_CORNER_BORDER '\153'
32 #define BOTTOM_LEFT_CORNER_BORDER '\155'
33 #define BOTTOM_BORDER '\161'
34 #define BOTTOM_RIGHT_CORNER_BORDER '\152'
35 #define LEFT_BORDER '\170'
36 #define RIGHT_BORDER '\170'
37 #define LEFT_MIDDLE_BORDER '\164'
38 #define MIDDLE_BORDER '\161'
39 #define RIGHT_MIDDLE_BORDER '\165'
40
41 #define BELL 0x07
42 #define GETSTRATTR 0x07
43
44 // Generic user input,
45 // password = 0 iff chars echoed on screen
46 // showoldvalue <> 0 iff current displayed for editing
47 void getuserinput(char *str, unsigned int size,
48 unsigned int password, unsigned int showoldvalue);
49
getstring(char * str,unsigned int size)50 static inline void getstring(char *str, unsigned int size)
51 {
52 getuserinput(str, size, 0, 0);
53 }
54
editstring(char * str,unsigned int size)55 static inline void editstring(char *str, unsigned int size)
56 {
57 getuserinput(str, size, 0, 1);
58 }
59
getpwd(char * str,unsigned int size)60 static inline void getpwd(char *str, unsigned int size)
61 {
62 getuserinput(str, size, 1, 0);
63 }
64
65 void drawbox(const char, const char, const char, const char,
66 const char);
67
68 // Draw a horizontal line
69 // dumb == 1, means just draw the line
70 // dumb == 0 means check the first and last positions and depending on what is
71 // currently on the screen make it a LTRT and/or RTLT appropriately.
72 void drawhorizline(const char, const char, const char, const char,
73 const char dumb);
74
75 #endif
76