3 * Copyright (C) 1998-2003 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 TUI_SCREEN_MEM 0xB8000
24 #define TUI_TITLE_BOX_CHAR_HEIGHT 5
26 ///////////////////////////////////////////////////////////////////////////////////////
28 // Textual User Interface Functions
30 ///////////////////////////////////////////////////////////////////////////////////////
31 BOOL
TuiInitialize(VOID
); // Initialize User-Interface
32 VOID
TuiUnInitialize(VOID
); // Un-initialize User-Interface
34 VOID
TuiDrawBackdrop(VOID
); // Fills the entire screen with a backdrop
35 VOID
TuiFillArea(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, CHAR FillChar
, UCHAR Attr
/* Color Attributes */); // Fills the area specified with FillChar and Attr
36 VOID
TuiDrawShadow(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
); // Draws a shadow on the bottom and right sides of the area specified
37 VOID
TuiDrawBox(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, UCHAR VertStyle
, UCHAR HorzStyle
, BOOL Fill
, BOOL Shadow
, UCHAR Attr
); // Draws a box around the area specified
38 VOID
TuiDrawText(ULONG X
, ULONG Y
, PCSTR Text
, UCHAR Attr
); // Draws text at coordinates specified
39 VOID
TuiDrawCenteredText(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, PCSTR TextString
, UCHAR Attr
); // Draws centered text at the coordinates specified and clips the edges
40 VOID
TuiDrawStatusText(PCSTR StatusText
); // Draws text at the very bottom line on the screen
41 VOID
TuiUpdateDateTime(VOID
); // Updates the date and time
42 VOID
TuiSaveScreen(PUCHAR Buffer
); // Saves the screen so that it can be restored later
43 VOID
TuiRestoreScreen(PUCHAR Buffer
); // Restores the screen from a previous save
44 VOID
TuiMessageBox(PCSTR MessageText
); // Displays a message box on the screen with an ok button
45 VOID
TuiMessageBoxCritical(PCSTR MessageText
); // Displays a message box on the screen with an ok button using no system resources
46 VOID
TuiDrawProgressBarCenter(ULONG Position
, ULONG Range
, PCHAR ProgressText
); // Draws the progress bar showing nPos percent filled
47 VOID
TuiDrawProgressBar(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, ULONG Position
, ULONG Range
, PCHAR ProgressText
); // Draws the progress bar showing nPos percent filled
48 BOOL
TuiEditBox(PCSTR MessageText
, PCHAR EditTextBuffer
, ULONG Length
);
50 UCHAR
TuiTextToColor(PCSTR ColorText
); // Converts the text color into it's equivalent color value
51 UCHAR
TuiTextToFillStyle(PCSTR FillStyleText
); // Converts the text fill into it's equivalent fill value
53 VOID
TuiFadeInBackdrop(VOID
); // Draws the backdrop and fades the screen in
54 VOID
TuiFadeOut(VOID
); // Fades the screen out
56 ///////////////////////////////////////////////////////////////////////////////////////
60 ///////////////////////////////////////////////////////////////////////////////////////
66 LONG MenuTimeRemaining
;
67 ULONG SelectedMenuItem
;
74 } TUI_MENU_INFO
, *PTUI_MENU_INFO
;
76 VOID WINAPI
TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo
);
77 VOID WINAPI
TuiDrawMenu(PTUI_MENU_INFO MenuInfo
);
78 VOID WINAPI
TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo
);
79 VOID WINAPI
TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo
, ULONG MenuItemNumber
);
80 ULONG WINAPI
TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo
, UiMenuKeyPressFilterCallback KeyPressFilter
);
81 BOOL WINAPI
TuiDisplayMenu(PCSTR MenuItemList
[], ULONG MenuItemCount
, ULONG DefaultMenuItem
, LONG MenuTimeOut
, ULONG
* SelectedMenuItem
, BOOL CanEscape
, UiMenuKeyPressFilterCallback KeyPressFilter
);
85 * Combines the foreground and background colors into a single attribute byte
87 #define ATTR(cFore, cBack) ((cBack << 4)|cFore)
90 * Fill styles for DrawBackdrop()
92 #define LIGHT_FILL 0xB0
93 #define MEDIUM_FILL 0xB1
94 #define DARK_FILL 0xB2
101 #define COLOR_GREEN 2
104 #define COLOR_MAGENTA 5
105 #define COLOR_BROWN 6
108 #define COLOR_DARKGRAY 8
109 #define COLOR_LIGHTBLUE 9
110 #define COLOR_LIGHTGREEN 10
111 #define COLOR_LIGHTCYAN 11
112 #define COLOR_LIGHTRED 12
113 #define COLOR_LIGHTMAGENTA 13
114 #define COLOR_YELLOW 14
115 #define COLOR_WHITE 15
117 /* Add COLOR_BLINK to a background to cause blinking */
118 #define COLOR_BLINK 8
121 * Defines for IBM box drawing characters
123 #define HORZ (0xc4) /* Single horizontal line */
124 #define D_HORZ (0xcd) /* Double horizontal line.*/
125 #define VERT (0xb3) /* Single vertical line */
126 #define D_VERT (0xba) /* Double vertical line. */
128 /* Definitions for corners, depending on HORIZ and VERT */
130 #define UR (0xbf) /* HORZ and VERT */
135 #define D_UR (0xbb) /* D_HORZ and D_VERT */
140 #define HD_UR (0xb8) /* D_HORZ and VERT */
145 #define VD_UR (0xb7) /* HORZ and D_VERT */
150 #endif // #defined __TUI_H