3 * Copyright (C) 1998-2002 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
24 #define TITLE_BOX_HEIGHT 5
26 // Initialize Textual-User-Interface
27 BOOL
InitUserInterface(VOID
);
28 // Fills the entire screen with a backdrop
29 void DrawBackdrop(void);
30 // Fills the area specified with cFillChar and cAttr
31 void FillArea(int nLeft
, int nTop
, int nRight
, int nBottom
, char cFillChar
, char cAttr
/* Color Attributes */);
32 // Draws a shadow on the bottom and right sides of the area specified
33 void DrawShadow(int nLeft
, int nTop
, int nRight
, int nBottom
);
34 // Draws a box around the area specified
35 void DrawBox(int nLeft
, int nTop
, int nRight
, int nBottom
, int nVertStyle
, int nHorzStyle
, int bFill
, int bShadow
, char cAttr
);
36 // Draws text at coordinates specified
37 void DrawText(int nX
, int nY
, char *text
, char cAttr
);
38 // Draws text at the very bottom line on the screen
39 void DrawStatusText(char *text
);
40 // Updates the date and time
41 void UpdateDateTime(void);
42 // Saves the screen so that it can be restored later
43 void SaveScreen(char *buffer
);
44 // Restores the screen from a previous save
45 void RestoreScreen(char *buffer
);
46 // Displays a message box on the screen with an ok button
47 void MessageBox(char *text
);
48 // Adds a line of text to the message box buffer
49 void MessageLine(char *text
);
50 // Returns true if color is valid
51 BOOL
IsValidColor(char *color
);
52 // Converts the text color into it's equivalent color value
53 char TextToColor(char *color
);
54 // Returns true if fill is valid
55 BOOL
IsValidFillStyle(char *fill
);
56 // Converts the text fill into it's equivalent fill value
57 char TextToFillStyle(char *fill
);
58 // Draws the progress bar showing nPos percent filled
59 void DrawProgressBar(int nPos
);
60 // Displays all the message boxes in a given section
61 void ShowMessageBoxesInSection(PUCHAR SectionName
);
64 * Combines the foreground and background colors into a single attribute byte
66 #define ATTR(cFore, cBack) ((cBack << 4)|cFore)
69 * Fill styles for DrawBackdrop()
71 #define LIGHT_FILL 0xB0
72 #define MEDIUM_FILL 0xB1
73 #define DARK_FILL 0xB2
83 #define COLOR_MAGENTA 5
87 #define COLOR_DARKGRAY 8
88 #define COLOR_LIGHTBLUE 9
89 #define COLOR_LIGHTGREEN 10
90 #define COLOR_LIGHTCYAN 11
91 #define COLOR_LIGHTRED 12
92 #define COLOR_LIGHTMAGENTA 13
93 #define COLOR_YELLOW 14
94 #define COLOR_WHITE 15
96 /* Add COLOR_BLINK to a background to cause blinking */
100 * Defines for IBM box drawing characters
102 #define HORZ (0xc4) /* Single horizontal line */
103 #define D_HORZ (0xcd) /* Double horizontal line.*/
104 #define VERT (0xb3) /* Single vertical line */
105 #define D_VERT (0xba) /* Double vertical line. */
107 /* Definitions for corners, depending on HORIZ and VERT */
109 #define UR (0xbf) /* HORZ and VERT */
114 #define D_UR (0xbb) /* D_HORZ and D_VERT */
119 #define HD_UR (0xb8) /* D_HORZ and VERT */
124 #define VD_UR (0xb7) /* HORZ and D_VERT */
129 #define KEY_EXTENDED 0x00
130 #define KEY_ENTER 0x0D
131 #define KEY_SPACE 0x20
133 #define KEY_DOWN 0x50
134 #define KEY_LEFT 0x4B
135 #define KEY_RIGHT 0x4D
149 ///////////////////////////////////////////////////////////////////////////////////////
153 ///////////////////////////////////////////////////////////////////////////////////////
154 BOOL
DisplayMenu(PUCHAR MenuItemList
[], ULONG MenuItemCount
, ULONG DefaultMenuItem
, LONG MenuTimeOut
, PULONG SelectedMenuItem
);
157 #endif // #defined __TUI_H