Port DriverSample.inf, HiiDatabase.inf and SetupBrowser.inf
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / SetupBrowserDxe / Ui.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 Ui.h
15
16 Abstract:
17
18 Head file UI
19
20 Revision History
21
22 --*/
23
24 #ifndef _UI_H
25 #define _UI_H
26
27 //
28 // Include common header file for this module.
29 //
30 #include "CommonHeader.h"
31
32 //
33 // Globals
34 //
35 #define REGULAR_NUMERIC 0
36 #define TIME_NUMERIC 1
37 #define DATE_NUMERIC 2
38
39 typedef enum {
40 UiNoOperation,
41 UiDefault,
42 UiSelect,
43 UiUp,
44 UiDown,
45 UiLeft,
46 UiRight,
47 UiReset,
48 UiSave,
49 UiPrevious,
50 UiPageUp,
51 UiPageDown,
52 UiMaxOperation
53 } UI_SCREEN_OPERATION;
54
55 typedef enum {
56 CfInitialization,
57 CfCheckSelection,
58 CfRepaint,
59 CfRefreshHighLight,
60 CfUpdateHelpString,
61 CfPrepareToReadKey,
62 CfReadKey,
63 CfScreenOperation,
64 CfUiPrevious,
65 CfUiSelect,
66 CfUiReset,
67 CfUiLeft,
68 CfUiRight,
69 CfUiUp,
70 CfUiPageUp,
71 CfUiPageDown,
72 CfUiDown,
73 CfUiSave,
74 CfUiDefault,
75 CfUiNoOperation,
76 CfExit,
77 CfMaxControlFlag
78 } UI_CONTROL_FLAG;
79
80 #define UI_MENU_OPTION_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'm')
81 #define UI_MENU_LIST_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'l')
82
83 typedef struct {
84 UINTN Signature;
85 LIST_ENTRY Link;
86
87 UINTN Row;
88 UINTN Col;
89 UINTN OptCol;
90 CHAR16 *Description;
91 UINTN Skip;
92
93 UINTN IfrNumber;
94 VOID *FormBinary;
95 EFI_HII_HANDLE Handle;
96 EFI_TAG *Tags;
97 UINTN TagIndex;
98 EFI_TAG *ThisTag;
99 UINT16 FormId;
100 BOOLEAN Previous;
101 UINT16 EntryNumber;
102 UINT16 Consistency;
103 BOOLEAN GrayOut;
104 } UI_MENU_OPTION;
105
106 typedef struct {
107 UINTN Signature;
108 LIST_ENTRY MenuLink;
109
110 UI_MENU_OPTION Selection;
111 UINTN FormerEntryNumber;
112 } UI_MENU_LIST;
113
114 typedef struct _MENU_REFRESH_ENTRY {
115 struct _MENU_REFRESH_ENTRY *Next;
116 EFI_FILE_FORM_TAGS *FileFormTagsHead;
117 UINTN CurrentColumn;
118 UINTN CurrentRow;
119 UINTN CurrentAttribute;
120 UI_MENU_OPTION *MenuOption; // Describes the entry needing an update
121 } MENU_REFRESH_ENTRY;
122
123 typedef struct {
124 UINT16 ScanCode;
125 UI_SCREEN_OPERATION ScreenOperation;
126 } SCAN_CODE_TO_SCREEN_OPERATION;
127
128 typedef struct {
129 UI_SCREEN_OPERATION ScreenOperation;
130 UI_CONTROL_FLAG ControlFlag;
131 } SCREEN_OPERATION_T0_CONTROL_FLAG;
132
133 LIST_ENTRY Menu;
134 LIST_ENTRY gMenuList;
135 MENU_REFRESH_ENTRY *gMenuRefreshHead;
136
137 INTN gEntryNumber;
138 BOOLEAN gLastOpr;
139 //
140 // Global Functions
141 //
142 VOID
143 UiInitMenu (
144 VOID
145 )
146 ;
147
148 VOID
149 UiInitMenuList (
150 VOID
151 )
152 ;
153
154 VOID
155 UiRemoveMenuListEntry (
156 IN UI_MENU_OPTION *Selection,
157 OUT UI_MENU_OPTION **PreviousSelection
158 )
159 ;
160
161 VOID
162 UiFreeMenuList (
163 VOID
164 )
165 ;
166
167 VOID
168 UiAddMenuListEntry (
169 IN UI_MENU_OPTION *Selection
170 )
171 ;
172
173 VOID
174 UiFreeMenu (
175 VOID
176 )
177 ;
178
179 VOID
180 UiAddMenuOption (
181 IN CHAR16 *String,
182 IN EFI_HII_HANDLE Handle,
183 IN EFI_TAG *Tag,
184 IN VOID *FormBinary,
185 IN UINTN IfrNumber
186 )
187 ;
188
189 VOID
190 UiAddSubMenuOption (
191 IN CHAR16 *String,
192 IN EFI_HII_HANDLE Handle,
193 IN EFI_TAG *Tag,
194 IN UINTN TagIndex,
195 IN UINT16 FormId,
196 IN UINT16 MenuItemCount
197 )
198 ;
199
200 UI_MENU_OPTION *
201 UiDisplayMenu (
202 IN BOOLEAN SubMenu,
203 IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
204 OUT EFI_IFR_DATA_ARRAY *PageData
205 )
206 ;
207
208 VOID
209 InitPage (
210 VOID
211 )
212 ;
213
214 UI_MENU_OPTION *
215 SetupBrowser (
216 IN UI_MENU_OPTION *Selection,
217 IN BOOLEAN Callback,
218 IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
219 IN UINT8 *CallbackData
220 )
221 ;
222
223
224 VOID
225 SetUnicodeMem (
226 IN VOID *Buffer,
227 IN UINTN Size,
228 IN CHAR16 Value
229 )
230 ;
231
232 EFI_STATUS
233 UiWaitForSingleEvent (
234 IN EFI_EVENT Event,
235 IN UINT64 Timeout OPTIONAL
236 )
237 ;
238
239 VOID
240 CreatePopUp (
241 IN UINTN ScreenWidth,
242 IN UINTN NumberOfLines,
243 IN CHAR16 *ArrayOfStrings,
244 ...
245 )
246 ;
247
248 EFI_STATUS
249 ReadString (
250 IN UI_MENU_OPTION *MenuOption,
251 OUT CHAR16 *StringPtr
252 )
253 ;
254
255 EFI_STATUS
256 ReadPassword (
257 IN UI_MENU_OPTION *MenuOption,
258 IN BOOLEAN PromptForPassword,
259 IN EFI_TAG *Tag,
260 IN EFI_IFR_DATA_ARRAY *PageData,
261 IN BOOLEAN SecondEntry,
262 IN EFI_FILE_FORM_TAGS *FileFormTags,
263 OUT CHAR16 *StringPtr
264 )
265 ;
266
267 VOID
268 EncodePassword (
269 IN CHAR16 *Password,
270 IN UINT8 MaxSize
271 )
272 ;
273
274 EFI_STATUS
275 GetSelectionInputPopUp (
276 IN UI_MENU_OPTION *MenuOption,
277 IN EFI_TAG *Tag,
278 IN UINTN ValueCount,
279 OUT UINT16 *Value,
280 OUT UINT16 *KeyValue
281 )
282 ;
283
284 EFI_STATUS
285 GetSelectionInputLeftRight (
286 IN UI_MENU_OPTION *MenuOption,
287 IN EFI_TAG *Tag,
288 IN UINTN ValueCount,
289 OUT UINT16 *Value
290 )
291 ;
292
293 EFI_STATUS
294 GetNumericInput (
295 IN UI_MENU_OPTION *MenuOption,
296 IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
297 IN BOOLEAN ManualInput,
298 IN EFI_TAG *Tag,
299 IN UINTN NumericType,
300 OUT UINT16 *Value
301 )
302 ;
303
304 VOID
305 UpdateStatusBar (
306 IN UINTN MessageType,
307 IN UINT8 Flags,
308 IN BOOLEAN State
309 )
310 ;
311
312 EFI_STATUS
313 ProcessOptions (
314 IN UI_MENU_OPTION *MenuOption,
315 IN BOOLEAN Selected,
316 IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
317 IN EFI_IFR_DATA_ARRAY *PageData,
318 OUT CHAR16 **OptionString
319 )
320 ;
321
322 VOID
323 ProcessHelpString (
324 IN CHAR16 *StringPtr,
325 OUT CHAR16 **FormattedString,
326 IN UINTN RowCount
327 )
328 ;
329
330 VOID
331 UpdateKeyHelp (
332 IN UI_MENU_OPTION *Selection,
333 IN BOOLEAN Selected
334 )
335 ;
336
337 BOOLEAN
338 ValueIsNotValid (
339 IN BOOLEAN Complex,
340 IN UINT16 Value,
341 IN EFI_TAG *Tag,
342 IN EFI_FILE_FORM_TAGS *FileFormTags,
343 IN STRING_REF *PopUp
344 )
345 ;
346
347 VOID
348 FreeData (
349 IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
350 IN CHAR16 *FormattedString,
351 IN CHAR16 *OptionString
352 )
353 ;
354
355 VOID
356 ClearLines (
357 UINTN LeftColumn,
358 UINTN RightColumn,
359 UINTN TopRow,
360 UINTN BottomRow,
361 UINTN TextAttribute
362 )
363 ;
364
365 UINTN
366 GetStringWidth (
367 CHAR16 *String
368 )
369 ;
370
371 UINT16
372 GetLineByWidth (
373 IN CHAR16 *InputString,
374 IN UINT16 LineWidth,
375 IN OUT UINTN *Index,
376 OUT CHAR16 **OutputString
377 )
378 ;
379
380 UINT16
381 GetWidth (
382 IN EFI_TAG *Tag,
383 IN EFI_HII_HANDLE Handle
384 )
385 ;
386
387 VOID
388 NewStrCat (
389 CHAR16 *Destination,
390 CHAR16 *Source
391 )
392 ;
393
394 VOID
395 IfrToFormTag (
396 IN UINT8 OpCode,
397 IN EFI_TAG *TargetTag,
398 IN VOID *FormData,
399 EFI_VARIABLE_DEFINITION *VariableDefinitionsHead
400 )
401 ;
402
403 EFI_STATUS
404 ExtractNvValue (
405 IN EFI_FILE_FORM_TAGS *FileFormTags,
406 IN UINT16 VariableId,
407 IN UINT16 VariableSize,
408 IN UINT16 OffsetValue,
409 OUT VOID **Buffer
410 )
411 ;
412
413 EFI_STATUS
414 ExtractRequestedNvMap (
415 IN EFI_FILE_FORM_TAGS *FileFormTags,
416 IN UINT16 VariableId,
417 OUT EFI_VARIABLE_DEFINITION **VariableDefinition
418 )
419 ;
420
421 BOOLEAN
422 ValueIsScroll (
423 IN BOOLEAN Direction,
424 IN LIST_ENTRY *CurrentPos
425 )
426 ;
427
428 UINTN
429 AdjustDateAndTimePosition (
430 IN BOOLEAN DirectionUp,
431 IN LIST_ENTRY **CurrentPosition
432 )
433 ;
434
435 EFI_STATUS
436 WaitForKeyStroke (
437 OUT EFI_INPUT_KEY *Key
438 )
439 ;
440 #endif // _UI_H