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