072ac5c794237217c647f31422a4612ed2e04de4
[reactos.git] / freeldr / freeldr / tui.h
1 /*
2 * FreeLoader
3 * Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
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; either version 2 of the License, or
8 * (at your option) any later version.
9 *
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.
14 *
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.
18 */
19
20 #ifndef __TUI_H
21 #define __TUI_H
22
23 #define SCREEN_MEM 0xB8000
24 #define TITLE_BOX_HEIGHT 5
25
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
61 /*
62 * Combines the foreground and background colors into a single attribute byte
63 */
64 #define ATTR(cFore, cBack) ((cBack << 4)|cFore)
65
66 /*
67 * Fill styles for DrawBackdrop()
68 */
69 #define LIGHT_FILL 0xB0
70 #define MEDIUM_FILL 0xB1
71 #define DARK_FILL 0xB2
72
73 /*
74 * Screen colors
75 */
76 #define COLOR_BLACK 0
77 #define COLOR_BLUE 1
78 #define COLOR_GREEN 2
79 #define COLOR_CYAN 3
80 #define COLOR_RED 4
81 #define COLOR_MAGENTA 5
82 #define COLOR_BROWN 6
83 #define COLOR_GRAY 7
84
85 #define COLOR_DARKGRAY 8
86 #define COLOR_LIGHTBLUE 9
87 #define COLOR_LIGHTGREEN 10
88 #define COLOR_LIGHTCYAN 11
89 #define COLOR_LIGHTRED 12
90 #define COLOR_LIGHTMAGENTA 13
91 #define COLOR_YELLOW 14
92 #define COLOR_WHITE 15
93
94 /* Add COLOR_BLINK to a background to cause blinking */
95 #define COLOR_BLINK 8
96
97 /*
98 * Defines for IBM box drawing characters
99 */
100 #define HORZ (0xc4) /* Single horizontal line */
101 #define D_HORZ (0xcd) /* Double horizontal line.*/
102 #define VERT (0xb3) /* Single vertical line */
103 #define D_VERT (0xba) /* Double vertical line. */
104
105 /* Definitions for corners, depending on HORIZ and VERT */
106 #define UL (0xda)
107 #define UR (0xbf) /* HORZ and VERT */
108 #define LL (0xc0)
109 #define LR (0xd9)
110
111 #define D_UL (0xc9)
112 #define D_UR (0xbb) /* D_HORZ and D_VERT */
113 #define D_LL (0xc8)
114 #define D_LR (0xbc)
115
116 #define HD_UL (0xd5)
117 #define HD_UR (0xb8) /* D_HORZ and VERT */
118 #define HD_LL (0xd4)
119 #define HD_LR (0xbe)
120
121 #define VD_UL (0xd6)
122 #define VD_UR (0xb7) /* HORZ and D_VERT */
123 #define VD_LL (0xd3)
124 #define VD_LR (0xbd)
125
126 // Key codes
127 #define KEY_EXTENDED 0x00
128 #define KEY_ENTER 0x0D
129 #define KEY_SPACE 0x20
130 #define KEY_UP 0x48
131 #define KEY_DOWN 0x50
132 #define KEY_LEFT 0x4B
133 #define KEY_RIGHT 0x4D
134 #define KEY_ESC 0x1B
135 #define KEY_F1 0x3B
136 #define KEY_F2 0x3C
137 #define KEY_F3 0x3D
138 #define KEY_F4 0x3E
139 #define KEY_F5 0x3F
140 #define KEY_F6 0x40
141 #define KEY_F7 0x41
142 #define KEY_F8 0x42
143 #define KEY_F9 0x43
144 #define KEY_F10 0x44
145
146 #endif // #defined __TUI_H