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 /* GENERIC TUI UTILS *********************************************************/ 23 24 INT 25 TuiPrintf( 26 _In_ PCSTR Format, ...); 27 28 VOID 29 TuiTruncateStringEllipsis( 30 _Inout_z_ PSTR StringText, 31 _In_ ULONG MaxChars); 32 33 #define TUI_TITLE_BOX_CHAR_HEIGHT 5 34 35 /* Textual User Interface Functions ******************************************/ 36 37 BOOLEAN TuiInitialize(VOID); // Initialize User-Interface 38 VOID TuiUnInitialize(VOID); // Un-initialize User-Interface 39 40 VOID TuiDrawBackdrop(VOID); // Fills the entire screen with a backdrop 41 VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr 42 VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified 43 44 /* Draws a box around the area specified */ 45 VOID 46 TuiDrawBox( 47 _In_ ULONG Left, 48 _In_ ULONG Top, 49 _In_ ULONG Right, 50 _In_ ULONG Bottom, 51 _In_ UCHAR VertStyle, 52 _In_ UCHAR HorzStyle, 53 _In_ BOOLEAN Fill, 54 _In_ BOOLEAN Shadow, 55 _In_ UCHAR Attr); 56 57 VOID 58 TuiDrawBoxTopLine( 59 _In_ ULONG Left, 60 _In_ ULONG Top, 61 _In_ ULONG Right, 62 _In_ UCHAR VertStyle, 63 _In_ UCHAR HorzStyle, 64 _In_ UCHAR Attr); 65 66 VOID 67 TuiDrawBoxBottomLine( 68 _In_ ULONG Left, 69 _In_ ULONG Bottom, 70 _In_ ULONG Right, 71 _In_ UCHAR VertStyle, 72 _In_ UCHAR HorzStyle, 73 _In_ UCHAR Attr); 74 75 /* Draws text at coordinates specified */ 76 VOID 77 TuiDrawText( 78 _In_ ULONG X, 79 _In_ ULONG Y, 80 _In_ PCSTR Text, 81 _In_ UCHAR Attr); 82 83 /* Draws text at coordinates specified */ 84 VOID 85 TuiDrawText2( 86 _In_ ULONG X, 87 _In_ ULONG Y, 88 _In_opt_ ULONG MaxNumChars, 89 _In_reads_or_z_(MaxNumChars) PCSTR Text, 90 _In_ UCHAR Attr); 91 92 /* Draws centered text at the coordinates specified and clips the edges */ 93 VOID 94 TuiDrawCenteredText( 95 _In_ ULONG Left, 96 _In_ ULONG Top, 97 _In_ ULONG Right, 98 _In_ ULONG Bottom, 99 _In_ PCSTR TextString, 100 _In_ UCHAR Attr); 101 102 VOID TuiDrawStatusText(PCSTR StatusText); // Draws text at the very bottom line on the screen 103 VOID TuiUpdateDateTime(VOID); // Updates the date and time 104 105 /* Saves the screen so that it can be restored later */ 106 _Ret_maybenull_ 107 __drv_allocatesMem(Mem) 108 PUCHAR 109 TuiSaveScreen(VOID); 110 111 /* Restores the screen from a previous save */ 112 VOID 113 TuiRestoreScreen( 114 _In_opt_ __drv_freesMem(Mem) PUCHAR Buffer); 115 116 /* Displays a message box on the screen with an ok button */ 117 VOID 118 TuiMessageBox( 119 _In_ PCSTR MessageText); 120 121 /* Displays a message box on the screen with an ok button using no system resources */ 122 VOID 123 TuiMessageBoxCritical( 124 _In_ PCSTR MessageText); 125 126 BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length); 127 UCHAR TuiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value 128 UCHAR TuiTextToFillStyle(PCSTR FillStyleText); // Converts the text fill into it's equivalent fill value 129 130 VOID TuiFadeInBackdrop(VOID); // Draws the backdrop and fades the screen in 131 VOID TuiFadeOut(VOID); // Fades the screen out 132 133 /* Menu Functions ************************************************************/ 134 135 VOID 136 TuiDrawMenu( 137 _In_ PUI_MENU_INFO MenuInfo); 138 139 VOID 140 TuiDrawMenuBox( 141 _In_ PUI_MENU_INFO MenuInfo); 142 143 VOID 144 TuiDrawMenuItem( 145 _In_ PUI_MENU_INFO MenuInfo, 146 _In_ ULONG MenuItemNumber); 147 148 BOOLEAN 149 TuiDisplayMenu( 150 IN PCSTR MenuHeader, 151 IN PCSTR MenuFooter OPTIONAL, 152 IN BOOLEAN ShowBootOptions, 153 IN PCSTR MenuItemList[], 154 IN ULONG MenuItemCount, 155 IN ULONG DefaultMenuItem, 156 IN LONG MenuTimeOut, 157 OUT PULONG SelectedMenuItem, 158 IN BOOLEAN CanEscape, 159 IN UiMenuKeyPressFilterCallback KeyPressFilter OPTIONAL, 160 IN PVOID Context OPTIONAL); 161 162 /* 163 * Definitions for corners, depending on HORZ and VERT 164 */ 165 #define UL 0xDA /* HORZ and VERT */ 166 #define UR 0xBF 167 #define LL 0xC0 168 #define LR 0xD9 169 170 #define D_UL 0xC9 /* D_HORZ and D_VERT */ 171 #define D_UR 0xBB 172 #define D_LL 0xC8 173 #define D_LR 0xBC 174 175 #define HD_UL 0xD5 /* D_HORZ and VERT */ 176 #define HD_UR 0xB8 177 #define HD_LL 0xD4 178 #define HD_LR 0xBE 179 180 #define VD_UL 0xD6 /* HORZ and D_VERT */ 181 #define VD_UR 0xB7 182 #define VD_LL 0xD3 183 #define VD_LR 0xBD 184 185 extern const UIVTBL TuiVtbl; 186