Fixed the length of the command line.
[reactos.git] / freeldr / freeldr / ui.h
1 /*
2 * FreeLoader
3 * Copyright (C) 1998-2002 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 // Displays all the message boxes in a given section
61 void ShowMessageBoxesInSection(PUCHAR SectionName);
62
63 /*
64 * Combines the foreground and background colors into a single attribute byte
65 */
66 #define ATTR(cFore, cBack) ((cBack << 4)|cFore)
67
68 /*
69 * Fill styles for DrawBackdrop()
70 */
71 #define LIGHT_FILL 0xB0
72 #define MEDIUM_FILL 0xB1
73 #define DARK_FILL 0xB2
74
75 /*
76 * Screen colors
77 */
78 #define COLOR_BLACK 0
79 #define COLOR_BLUE 1
80 #define COLOR_GREEN 2
81 #define COLOR_CYAN 3
82 #define COLOR_RED 4
83 #define COLOR_MAGENTA 5
84 #define COLOR_BROWN 6
85 #define COLOR_GRAY 7
86
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
95
96 /* Add COLOR_BLINK to a background to cause blinking */
97 #define COLOR_BLINK 8
98
99 /*
100 * Defines for IBM box drawing characters
101 */
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. */
106
107 /* Definitions for corners, depending on HORIZ and VERT */
108 #define UL (0xda)
109 #define UR (0xbf) /* HORZ and VERT */
110 #define LL (0xc0)
111 #define LR (0xd9)
112
113 #define D_UL (0xc9)
114 #define D_UR (0xbb) /* D_HORZ and D_VERT */
115 #define D_LL (0xc8)
116 #define D_LR (0xbc)
117
118 #define HD_UL (0xd5)
119 #define HD_UR (0xb8) /* D_HORZ and VERT */
120 #define HD_LL (0xd4)
121 #define HD_LR (0xbe)
122
123 #define VD_UL (0xd6)
124 #define VD_UR (0xb7) /* HORZ and D_VERT */
125 #define VD_LL (0xd3)
126 #define VD_LR (0xbd)
127
128 // Key codes
129 #define KEY_EXTENDED 0x00
130 #define KEY_ENTER 0x0D
131 #define KEY_SPACE 0x20
132 #define KEY_UP 0x48
133 #define KEY_DOWN 0x50
134 #define KEY_LEFT 0x4B
135 #define KEY_RIGHT 0x4D
136 #define KEY_ESC 0x1B
137 #define KEY_F1 0x3B
138 #define KEY_F2 0x3C
139 #define KEY_F3 0x3D
140 #define KEY_F4 0x3E
141 #define KEY_F5 0x3F
142 #define KEY_F6 0x40
143 #define KEY_F7 0x41
144 #define KEY_F8 0x42
145 #define KEY_F9 0x43
146 #define KEY_F10 0x44
147
148
149 ///////////////////////////////////////////////////////////////////////////////////////
150 //
151 // Menu Functions
152 //
153 ///////////////////////////////////////////////////////////////////////////////////////
154 BOOL DisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, PULONG SelectedMenuItem);
155
156
157 #endif // #defined __TUI_H