[FREELDR]
[reactos.git] / reactos / boot / freeldr / freeldr / include / ui / tui.h
1 /*
2 * FreeLoader
3 * Copyright (C) 1998-2003 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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #define TUI_SCREEN_MEM 0xB8000
23 #define TUI_TITLE_BOX_CHAR_HEIGHT 5
24
25 ///////////////////////////////////////////////////////////////////////////////////////
26 //
27 // Textual User Interface Functions
28 //
29 ///////////////////////////////////////////////////////////////////////////////////////
30 BOOLEAN TuiInitialize(VOID); // Initialize User-Interface
31 VOID TuiUnInitialize(VOID); // Un-initialize User-Interface
32
33 VOID TuiDrawBackdrop(VOID); // Fills the entire screen with a backdrop
34 VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
35 VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified
36 VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr); // Draws a box around the area specified
37 VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr); // Draws text at coordinates specified
38 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
39 VOID TuiDrawStatusText(PCSTR StatusText); // Draws text at the very bottom line on the screen
40 VOID TuiUpdateDateTime(VOID); // Updates the date and time
41 VOID TuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later
42 VOID TuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save
43 VOID TuiMessageBox(PCSTR MessageText); // Displays a message box on the screen with an ok button
44 VOID TuiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources
45 VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
46 VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
47 BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length);
48 int TuiPrintf(const char *format, ... );
49 UCHAR TuiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value
50 UCHAR TuiTextToFillStyle(PCSTR FillStyleText); // Converts the text fill into it's equivalent fill value
51
52 VOID TuiFadeInBackdrop(VOID); // Draws the backdrop and fades the screen in
53 VOID TuiFadeOut(VOID); // Fades the screen out
54
55 ///////////////////////////////////////////////////////////////////////////////////////
56 //
57 // Menu Functions
58 //
59 ///////////////////////////////////////////////////////////////////////////////////////
60
61 struct tagUI_MENU_INFO
62 {
63 PCSTR MenuTitle;
64
65 PCSTR *MenuItemList;
66 ULONG MenuItemCount;
67 LONG MenuTimeRemaining;
68 ULONG SelectedMenuItem;
69
70 ULONG Left;
71 ULONG Top;
72 ULONG Right;
73 ULONG Bottom;
74 };
75
76 VOID NTAPI TuiCalcMenuBoxSize(PUI_MENU_INFO MenuInfo);
77 VOID TuiDrawMenu(PUI_MENU_INFO MenuInfo);
78 VOID NTAPI TuiDrawMenuBox(PUI_MENU_INFO MenuInfo);
79 VOID NTAPI TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber);
80 ULONG NTAPI TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter);
81 BOOLEAN TuiDisplayMenu(PCSTR MenuTitle, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter);
82
83 /* Definitions for corners, depending on HORIZ and VERT */
84 #define UL (0xda)
85 #define UR (0xbf) /* HORZ and VERT */
86 #define LL (0xc0)
87 #define LR (0xd9)
88
89 #define D_UL (0xc9)
90 #define D_UR (0xbb) /* D_HORZ and D_VERT */
91 #define D_LL (0xc8)
92 #define D_LR (0xbc)
93
94 #define HD_UL (0xd5)
95 #define HD_UR (0xb8) /* D_HORZ and VERT */
96 #define HD_LL (0xd4)
97 #define HD_LR (0xbe)
98
99 #define VD_UL (0xd6)
100 #define VD_UR (0xb7) /* HORZ and D_VERT */
101 #define VD_LL (0xd3)
102 #define VD_LR (0xbd)
103
104 extern const UIVTBL TuiVtbl;