]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.h
01213cb059efe7be824efe498c99cf0fc8b65c13
[mirror_edk2.git] / MdeModulePkg / Library / CustomizedDisplayLib / CustomizedDisplayLibInternal.h
1 /** @file
2
3 This library class defines a set of interfaces to customize Display module
4
5 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __CUSTOMIZED_DISPLAY_LIB_INTERNAL_H__
11 #define __CUSTOMIZED_DISPLAY_LIB_INTERNAL_H__
12
13 #include <PiDxe.h>
14
15 #include <Protocol/SimpleTextOut.h>
16 #include <Protocol/SimpleTextIn.h>
17 #include <Protocol/FormBrowser2.h>
18 #include <Protocol/FormBrowserEx2.h>
19 #include <Protocol/DisplayProtocol.h>
20 #include <Protocol/DevicePath.h>
21 #include <Protocol/UnicodeCollation.h>
22 #include <Protocol/HiiConfigAccess.h>
23 #include <Protocol/HiiConfigRouting.h>
24 #include <Protocol/HiiDatabase.h>
25 #include <Protocol/HiiString.h>
26 #include <Protocol/UserManager.h>
27 #include <Protocol/DevicePathFromText.h>
28
29 #include <Guid/MdeModuleHii.h>
30 #include <Guid/HiiPlatformSetupFormset.h>
31 #include <Guid/HiiFormMapMethodGuid.h>
32
33 #include <Library/PrintLib.h>
34 #include <Library/DebugLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/UefiRuntimeServicesTableLib.h>
37 #include <Library/UefiDriverEntryPoint.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/BaseLib.h>
40 #include <Library/MemoryAllocationLib.h>
41 #include <Library/HiiLib.h>
42 #include <Library/PcdLib.h>
43 #include <Library/DevicePathLib.h>
44 #include <Library/CustomizedDisplayLib.h>
45
46 #include "Colors.h"
47
48 #define FORMSET_CLASS_PLATFORM_SETUP 0x0001
49 #define FORMSET_CLASS_FRONT_PAGE 0x0002
50
51 #define FRONT_PAGE_HEADER_HEIGHT 6
52 #define NONE_FRONT_PAGE_HEADER_HEIGHT 3
53 #define FOOTER_HEIGHT 4
54 #define STATUS_BAR_HEIGHT 1
55
56 //
57 // Screen definitions
58 //
59 #define BANNER_HEIGHT 6
60 #define BANNER_COLUMNS 3
61 #define BANNER_LEFT_COLUMN_INDENT 1
62
63 //
64 // Character definitions
65 //
66 #define UPPER_LOWER_CASE_OFFSET 0x20
67
68 //
69 // This is the Input Error Message
70 //
71 #define INPUT_ERROR 1
72
73 //
74 // This is the NV RAM update required Message
75 //
76 #define NV_UPDATE_REQUIRED 2
77
78 typedef struct {
79 EFI_STRING_ID Banner[BANNER_HEIGHT][BANNER_COLUMNS];
80 } BANNER_DATA;
81
82 extern UINT16 gClassOfVfr; // Formset class information
83 extern BANNER_DATA *gBannerData;
84 extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
85 extern UINTN gFooterHeight;
86
87 //
88 // Browser Global Strings
89 //
90 extern CHAR16 *gEnterString;
91 extern CHAR16 *gEnterCommitString;
92 extern CHAR16 *gEnterEscapeString;
93 extern CHAR16 *gEscapeString;
94 extern CHAR16 *gMoveHighlight;
95 extern CHAR16 *gDecNumericInput;
96 extern CHAR16 *gHexNumericInput;
97 extern CHAR16 *gToggleCheckBox;
98 extern CHAR16 *gLibEmptyString;
99 extern CHAR16 *gAreYouSure;
100 extern CHAR16 *gYesResponse;
101 extern CHAR16 *gNoResponse;
102 extern CHAR16 *gPlusString;
103 extern CHAR16 *gMinusString;
104 extern CHAR16 *gAdjustNumber;
105 extern CHAR16 *gSaveChanges;
106 extern CHAR16 *gNvUpdateMessage;
107 extern CHAR16 *gInputErrorMessage;
108
109 /**
110
111 Print banner info for front page.
112
113 @param[in] FormData Form Data to be shown in Page
114
115 **/
116 VOID
117 PrintBannerInfo (
118 IN FORM_DISPLAY_ENGINE_FORM *FormData
119 );
120
121 /**
122 Print framework and form title for a page.
123
124 @param[in] FormData Form Data to be shown in Page
125 **/
126 VOID
127 PrintFramework (
128 IN FORM_DISPLAY_ENGINE_FORM *FormData
129 );
130
131 /**
132 Validate the input screen diemenstion info.
133
134 @param FormData The input form data info.
135
136 @return EFI_SUCCESS The input screen info is acceptable.
137 @return EFI_INVALID_PARAMETER The input screen info is not acceptable.
138
139 **/
140 EFI_STATUS
141 ScreenDiemensionInfoValidate (
142 IN FORM_DISPLAY_ENGINE_FORM *FormData
143 );
144
145 /**
146 Get the string based on the StringId and HII Package List Handle.
147
148 @param Token The String's ID.
149 @param HiiHandle The package list in the HII database to search for
150 the specified string.
151
152 @return The output string.
153
154 **/
155 CHAR16 *
156 LibGetToken (
157 IN EFI_STRING_ID Token,
158 IN EFI_HII_HANDLE HiiHandle
159 );
160
161 /**
162 Count the storage space of a Unicode string.
163
164 This function handles the Unicode string with NARROW_CHAR
165 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
166 does not count in the resultant output. If a WIDE_CHAR is
167 hit, then 2 Unicode character will consume an output storage
168 space with size of CHAR16 till a NARROW_CHAR is hit.
169
170 If String is NULL, then ASSERT ().
171
172 @param String The input string to be counted.
173
174 @return Storage space for the input string.
175
176 **/
177 UINTN
178 LibGetStringWidth (
179 IN CHAR16 *String
180 );
181
182 /**
183 Show all registered HotKey help strings on bottom Rows.
184
185 @param FormData The curent input form data info.
186 @param SetState Set HotKey or Clear HotKey
187
188 **/
189 VOID
190 PrintHotKeyHelpString (
191 IN FORM_DISPLAY_ENGINE_FORM *FormData,
192 IN BOOLEAN SetState
193 );
194
195 /**
196 Get step info from numeric opcode.
197
198 @param[in] OpCode The input numeric op code.
199
200 @return step info for this opcode.
201 **/
202 UINT64
203 LibGetFieldFromNum (
204 IN EFI_IFR_OP_HEADER *OpCode
205 );
206
207 /**
208 Initialize the HII String Token to the correct values.
209
210 **/
211 VOID
212 InitializeLibStrings (
213 VOID
214 );
215
216 /**
217 Free the HII String.
218
219 **/
220 VOID
221 FreeLibStrings (
222 VOID
223 );
224
225 /**
226 Wait for a key to be pressed by user.
227
228 @param Key The key which is pressed by user.
229
230 @retval EFI_SUCCESS The function always completed successfully.
231
232 **/
233 EFI_STATUS
234 WaitForKeyStroke (
235 OUT EFI_INPUT_KEY *Key
236 );
237
238 /**
239 Set Buffer to Value for Size bytes.
240
241 @param Buffer Memory to set.
242 @param Size Number of bytes to set
243 @param Value Value of the set operation.
244
245 **/
246 VOID
247 LibSetUnicodeMem (
248 IN VOID *Buffer,
249 IN UINTN Size,
250 IN CHAR16 Value
251 );
252
253 /**
254 Prints a formatted unicode string to the default console, at
255 the supplied cursor position.
256
257 @param Width Width of String to be printed.
258 @param Column The cursor position to print the string at.
259 @param Row The cursor position to print the string at.
260 @param Fmt Format string.
261 @param ... Variable argument list for format string.
262
263 @return Length of string printed to the console
264
265 **/
266 UINTN
267 EFIAPI
268 PrintAt (
269 IN UINTN Width,
270 IN UINTN Column,
271 IN UINTN Row,
272 IN CHAR16 *Fmt,
273 ...
274 );
275
276 /**
277 Process some op codes which is out side of current form.
278
279 @param FormData Pointer to the form data.
280
281 **/
282 VOID
283 ProcessExternedOpcode (
284 IN FORM_DISPLAY_ENGINE_FORM *FormData
285 );
286
287 #endif