3 * Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
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; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define SCREEN_MEM 0xB8000
25 extern int nScreenWidth
; // Screen Width
26 extern int nScreenHeight
; // Screen Height
28 extern char cStatusBarFgColor
; // Status bar foreground color
29 extern char cStatusBarBgColor
; // Status bar background color
30 extern char cBackdropFgColor
; // Backdrop foreground color
31 extern char cBackdropBgColor
; // Backdrop background color
32 extern char cBackdropFillStyle
; // Backdrop fill style
33 extern char cTitleBoxFgColor
; // Title box foreground color
34 extern char cTitleBoxBgColor
; // Title box background color
35 extern char cMessageBoxFgColor
; // Message box foreground color
36 extern char cMessageBoxBgColor
; // Message box background color
37 extern char cMenuFgColor
; // Menu foreground color
38 extern char cMenuBgColor
; // Menu background color
39 extern char cTextColor
; // Normal text color
40 extern char cSelectedTextColor
; // Selected text color
41 extern char cSelectedTextBgColor
; // Selected text background color
42 extern char szTitleBoxTitleText
[260]; // Title box's title text
44 // Fills the entire screen with a backdrop
45 void DrawBackdrop(void);
46 // Fills the area specified with cFillChar and cAttr
47 void FillArea(int nLeft
, int nTop
, int nRight
, int nBottom
, char cFillChar
, char cAttr
/* Color Attributes */);
48 // Draws a shadow on the bottom and right sides of the area specified
49 void DrawShadow(int nLeft
, int nTop
, int nRight
, int nBottom
);
50 // Draws a box around the area specified
51 void DrawBox(int nLeft
, int nTop
, int nRight
, int nBottom
, int nVertStyle
, int nHorzStyle
, int bFill
, int bShadow
, char cAttr
);
52 // Draws text at coordinates specified
53 void DrawText(int nX
, int nY
, char *text
, char cAttr
);
54 // Draws text at the very bottom line on the screen
55 void DrawStatusText(char *text
);
56 // Updates the date and time
57 void UpdateDateTime(void);
58 // Saves the screen so that it can be restored later
59 void SaveScreen(char *buffer
);
60 // Restores the screen from a previous save
61 void RestoreScreen(char *buffer
);
62 // Displays a message box on the screen with an ok button
63 void MessageBox(char *text
);
64 // Adds a line of text to the message box buffer
65 void MessageLine(char *text
);
66 // Returns true if color is valid
67 BOOL
IsValidColor(char *color
);
68 // Converts the text color into it's equivalent color value
69 char TextToColor(char *color
);
70 // Returns true if fill is valid
71 BOOL
IsValidFillStyle(char *fill
);
72 // Converts the text fill into it's equivalent fill value
73 char TextToFillStyle(char *fill
);
74 // Draws the progress bar showing nPos percent filled
75 void DrawProgressBar(int nPos
);
78 * Combines the foreground and background colors into a single attribute byte
80 #define ATTR(cFore, cBack) ((cBack << 4)|cFore)
83 * Fill styles for DrawBackdrop()
85 #define LIGHT_FILL 0xB0
86 #define MEDIUM_FILL 0xB1
87 #define DARK_FILL 0xB2
97 #define COLOR_MAGENTA 5
101 #define COLOR_DARKGRAY 8
102 #define COLOR_LIGHTBLUE 9
103 #define COLOR_LIGHTGREEN 10
104 #define COLOR_LIGHTCYAN 11
105 #define COLOR_LIGHTRED 12
106 #define COLOR_LIGHTMAGENTA 13
107 #define COLOR_YELLOW 14
108 #define COLOR_WHITE 15
110 /* Add COLOR_BLINK to a background to cause blinking */
111 #define COLOR_BLINK 8
114 * Defines for IBM box drawing characters
116 #define HORZ (0xc4) /* Single horizontal line */
117 #define D_HORZ (0xcd) /* Double horizontal line.*/
118 #define VERT (0xb3) /* Single vertical line */
119 #define D_VERT (0xba) /* Double vertical line. */
121 /* Definitions for corners, depending on HORIZ and VERT */
123 #define UR (0xbf) /* HORZ and VERT */
128 #define D_UR (0xbb) /* D_HORZ and D_VERT */
133 #define HD_UR (0xb8) /* D_HORZ and VERT */
138 #define VD_UR (0xb7) /* HORZ and D_VERT */
143 #define KEY_EXTENDED 0x00
144 #define KEY_ENTER 0x0D
145 #define KEY_SPACE 0x20
147 #define KEY_DOWN 0x50
148 #define KEY_LEFT 0x4B
149 #define KEY_RIGHT 0x4D
162 #endif // #defined __TUI_H