]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Refine the logic to handle the device path info get from string token.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Ui.h
CommitLineData
7936fb6a 1/** @file\r
2Private structure, MACRO and function definitions for User Interface related functionalities.\r
3\r
31585af4 4Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5This program and the accompanying materials\r
7936fb6a 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _UI_H_\r
16#define _UI_H_\r
17\r
7936fb6a 18//\r
19// Globals\r
20//\r
21#define REGULAR_NUMERIC 0\r
22#define TIME_NUMERIC 1\r
23#define DATE_NUMERIC 2\r
24\r
25#define SUBTITLE_INDENT 2\r
26\r
40a06b0c 27\r
28//\r
29// It take 23 characters including the NULL to print a 64 bits number with "[" and "]".\r
30// pow(2, 64) = [18446744073709551616]\r
31//\r
32#define MAX_NUMERIC_INPUT_WIDTH 23\r
33\r
7936fb6a 34typedef enum {\r
35 UiNoOperation,\r
7936fb6a 36 UiSelect,\r
37 UiUp,\r
38 UiDown,\r
39 UiLeft,\r
40 UiRight,\r
41 UiReset,\r
7936fb6a 42 UiPrevious,\r
43 UiPageUp,\r
44 UiPageDown,\r
48a9d5f7 45 UiHotKey,\r
7936fb6a 46 UiMaxOperation\r
47} UI_SCREEN_OPERATION;\r
48\r
49typedef enum {\r
50 CfInitialization,\r
51 CfCheckSelection,\r
52 CfRepaint,\r
53 CfRefreshHighLight,\r
54 CfUpdateHelpString,\r
55 CfPrepareToReadKey,\r
56 CfReadKey,\r
57 CfScreenOperation,\r
7936fb6a 58 CfUiSelect,\r
59 CfUiReset,\r
60 CfUiLeft,\r
61 CfUiRight,\r
62 CfUiUp,\r
63 CfUiPageUp,\r
64 CfUiPageDown,\r
65 CfUiDown,\r
7936fb6a 66 CfUiDefault,\r
67 CfUiNoOperation,\r
68 CfExit,\r
48a9d5f7 69 CfUiHotKey,\r
7936fb6a 70 CfMaxControlFlag\r
71} UI_CONTROL_FLAG;\r
72\r
73#define UI_ACTION_NONE 0\r
74#define UI_ACTION_REFRESH_FORM 1\r
75#define UI_ACTION_REFRESH_FORMSET 2\r
76#define UI_ACTION_EXIT 3\r
77\r
b18e7050
ED
78typedef struct _UI_MENU_LIST UI_MENU_LIST;\r
79\r
7936fb6a 80typedef struct {\r
81 EFI_HII_HANDLE Handle;\r
82\r
83 //\r
84 // Target formset/form/Question information\r
85 //\r
86 EFI_GUID FormSetGuid;\r
87 UINT16 FormId;\r
88 UINT16 QuestionId;\r
d88ca2c9 89 UINTN Sequence; // used for time/date only.\r
7936fb6a 90\r
91 UINTN TopRow;\r
92 UINTN BottomRow;\r
93 UINTN PromptCol;\r
94 UINTN OptionCol;\r
95 UINTN CurrentRow;\r
96\r
97 //\r
98 // Ation for Browser to taken:\r
99 // UI_ACTION_NONE - navigation inside a form\r
100 // UI_ACTION_REFRESH_FORM - re-evaluate expressions and repaint form\r
101 // UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary\r
102 //\r
103 UINTN Action;\r
104\r
105 //\r
106 // Current selected fomset/form/Question\r
107 //\r
108 FORM_BROWSER_FORMSET *FormSet;\r
109 FORM_BROWSER_FORM *Form;\r
110 FORM_BROWSER_STATEMENT *Statement;\r
8b0fc5c1 111\r
112 //\r
113 // Whether the Form is editable\r
114 //\r
115 BOOLEAN FormEditable;\r
b18e7050
ED
116\r
117 UI_MENU_LIST *CurrentMenu;\r
7936fb6a 118} UI_MENU_SELECTION;\r
119\r
f3f2e05d 120#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')\r
121#define UI_MENU_LIST_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'l')\r
7936fb6a 122\r
123typedef struct {\r
124 UINTN Signature;\r
125 LIST_ENTRY Link;\r
126\r
127 EFI_HII_HANDLE Handle;\r
128 FORM_BROWSER_STATEMENT *ThisTag;\r
129 UINT16 EntryNumber;\r
130\r
131 UINTN Row;\r
132 UINTN Col;\r
133 UINTN OptCol;\r
134 CHAR16 *Description;\r
135 UINTN Skip; // Number of lines\r
136\r
137 //\r
138 // Display item sequence for date/time\r
139 // Date: Month/Day/Year\r
140 // Sequence: 0 1 2\r
141 //\r
142 // Time: Hour : Minute : Second\r
143 // Sequence: 0 1 2\r
144 //\r
145 //\r
146 UINTN Sequence;\r
147\r
148 BOOLEAN GrayOut;\r
149 BOOLEAN ReadOnly;\r
8b0fc5c1 150\r
151 //\r
152 // Whether user could change value of this item\r
153 //\r
154 BOOLEAN IsQuestion;\r
7936fb6a 155} UI_MENU_OPTION;\r
156\r
157#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)\r
158\r
d66e6c16 159struct _UI_MENU_LIST {\r
7936fb6a 160 UINTN Signature;\r
d66e6c16 161 LIST_ENTRY Link;\r
7936fb6a 162\r
b2e444aa 163 EFI_HII_HANDLE HiiHandle;\r
d66e6c16 164 EFI_GUID FormSetGuid;\r
7936fb6a 165 UINT16 FormId;\r
166 UINT16 QuestionId;\r
d88ca2c9 167 UINTN Sequence; // used for time/date only.\r
d66e6c16 168\r
169 UI_MENU_LIST *Parent;\r
170 LIST_ENTRY ChildListHead;\r
171};\r
172\r
173#define UI_MENU_LIST_FROM_LINK(a) CR (a, UI_MENU_LIST, Link, UI_MENU_LIST_SIGNATURE)\r
7936fb6a 174\r
1ccdbf2a 175typedef struct _MENU_REFRESH_ENTRY MENU_REFRESH_ENTRY;\r
176struct _MENU_REFRESH_ENTRY {\r
177 MENU_REFRESH_ENTRY *Next;\r
7936fb6a 178 UI_MENU_OPTION *MenuOption; // Describes the entry needing an update\r
179 UI_MENU_SELECTION *Selection;\r
180 UINTN CurrentColumn;\r
181 UINTN CurrentRow;\r
182 UINTN CurrentAttribute;\r
211cc6e5 183 EFI_EVENT Event;\r
1ccdbf2a 184};\r
7936fb6a 185\r
186typedef struct {\r
187 UINT16 ScanCode;\r
188 UI_SCREEN_OPERATION ScreenOperation;\r
189} SCAN_CODE_TO_SCREEN_OPERATION;\r
190\r
191typedef struct {\r
192 UI_SCREEN_OPERATION ScreenOperation;\r
193 UI_CONTROL_FLAG ControlFlag;\r
194} SCREEN_OPERATION_T0_CONTROL_FLAG;\r
195\r
196\r
ce6d12cc 197extern LIST_ENTRY gMenuOption;\r
7936fb6a 198extern MENU_REFRESH_ENTRY *gMenuRefreshHead;\r
199extern UI_MENU_SELECTION *gCurrentSelection;\r
8d00a0f1 200extern BOOLEAN mHiiPackageListUpdated;\r
7936fb6a 201\r
202//\r
203// Global Functions\r
204//\r
205/**\r
206 Initialize Menu option list.\r
207\r
208**/\r
209VOID\r
210UiInitMenu (\r
211 VOID\r
ed66e1bc 212 );\r
7936fb6a 213\r
214/**\r
215 Initialize Menu option list.\r
216\r
217**/\r
218VOID\r
219UiInitMenuList (\r
220 VOID\r
ed66e1bc 221 );\r
7936fb6a 222\r
223/**\r
d66e6c16 224 Free Menu option linked list.\r
7936fb6a 225\r
226**/\r
227VOID\r
d66e6c16 228UiFreeMenu (\r
229 VOID\r
ed66e1bc 230 );\r
7936fb6a 231\r
232/**\r
d66e6c16 233 Create a menu with specified formset GUID and form ID, and add it as a child\r
234 of the given parent menu.\r
235\r
236 @param Parent The parent of menu to be added.\r
b2e444aa 237 @param HiiHandle Hii handle related to this formset.\r
d66e6c16 238 @param FormSetGuid The Formset Guid of menu to be added.\r
239 @param FormId The Form ID of menu to be added.\r
240\r
241 @return A pointer to the newly added menu or NULL if memory is insufficient.\r
7936fb6a 242\r
243**/\r
d66e6c16 244UI_MENU_LIST *\r
245UiAddMenuList (\r
246 IN OUT UI_MENU_LIST *Parent,\r
b2e444aa 247 IN EFI_HII_HANDLE HiiHandle,\r
d66e6c16 248 IN EFI_GUID *FormSetGuid,\r
249 IN UINT16 FormId\r
ed66e1bc 250 );\r
7936fb6a 251\r
252/**\r
d66e6c16 253 Search Menu with given FormId in the parent menu and all its child menus.\r
7936fb6a 254\r
d66e6c16 255 @param Parent The parent of menu to search.\r
b2e444aa 256 @param FormSetGuid The Formset GUID of the menu to search. \r
d66e6c16 257 @param FormId The Form ID of menu to search.\r
258\r
259 @return A pointer to menu found or NULL if not found.\r
7936fb6a 260\r
261**/\r
d66e6c16 262UI_MENU_LIST *\r
263UiFindChildMenuList (\r
264 IN UI_MENU_LIST *Parent,\r
b2e444aa 265 IN EFI_GUID *FormSetGuid, \r
d66e6c16 266 IN UINT16 FormId\r
267 );\r
268\r
269/**\r
270 Search Menu with given FormSetGuid and FormId in all cached menu list.\r
271\r
272 @param FormSetGuid The Formset GUID of the menu to search.\r
273 @param FormId The Form ID of menu to search.\r
274\r
275 @return A pointer to menu found or NULL if not found.\r
276\r
277**/\r
278UI_MENU_LIST *\r
279UiFindMenuList (\r
280 IN EFI_GUID *FormSetGuid,\r
281 IN UINT16 FormId\r
ed66e1bc 282 );\r
7936fb6a 283\r
284/**\r
285 Free Menu option linked list.\r
286\r
287**/\r
288VOID\r
d66e6c16 289UiFreeRefreshList (\r
7936fb6a 290 VOID\r
ed66e1bc 291 );\r
7936fb6a 292\r
293/**\r
294 Add one menu option by specified description and context.\r
295\r
296 @param String String description for this option.\r
297 @param Handle Hii handle for the package list.\r
f67c4382 298 @param Form The form this statement belong to.\r
7936fb6a 299 @param Statement Statement of this Menu Option.\r
300 @param NumberOfLines Display lines for this Menu Option.\r
301 @param MenuItemCount The index for this Option in the Menu.\r
302\r
8b0fc5c1 303 @retval Pointer Pointer to the added Menu Option.\r
304\r
7936fb6a 305**/\r
8b0fc5c1 306UI_MENU_OPTION *\r
7936fb6a 307UiAddMenuOption (\r
308 IN CHAR16 *String,\r
309 IN EFI_HII_HANDLE Handle,\r
f67c4382 310 IN FORM_BROWSER_FORM *Form,\r
7936fb6a 311 IN FORM_BROWSER_STATEMENT *Statement,\r
312 IN UINT16 NumberOfLines,\r
313 IN UINT16 MenuItemCount\r
ed66e1bc 314 );\r
7936fb6a 315\r
316/**\r
317 Display menu and wait for user to select one menu option, then return it.\r
318 If AutoBoot is enabled, then if user doesn't select any option,\r
319 after period of time, it will automatically return the first menu option.\r
320\r
321 @param Selection Menu selection.\r
322\r
323 @return Return the pointer of the menu which selected,\r
324 @return otherwise return NULL.\r
325\r
326**/\r
327EFI_STATUS\r
328UiDisplayMenu (\r
329 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 330 );\r
7936fb6a 331\r
332/**\r
333 Free up the resource allocated for all strings required\r
334 by Setup Browser.\r
335\r
336**/\r
337VOID\r
338FreeBrowserStrings (\r
339 VOID\r
ed66e1bc 340 );\r
7936fb6a 341\r
8ca6180f
ED
342/**\r
343 Process the goto op code, update the info in the selection structure.\r
344\r
345 @param Statement The statement belong to goto op code.\r
346 @param Selection The selection info.\r
347 @param Repaint Whether need to repaint the menu.\r
348 @param NewLine Whether need to create new line.\r
349\r
350 @retval EFI_SUCCESS The menu process successfully.\r
351 @return Other value if the process failed.\r
352**/\r
353EFI_STATUS\r
354ProcessGotoOpCode (\r
355 IN OUT FORM_BROWSER_STATEMENT *Statement,\r
356 IN OUT UI_MENU_SELECTION *Selection,\r
357 OUT BOOLEAN *Repaint,\r
358 OUT BOOLEAN *NewLine\r
359 );\r
360\r
361\r
7936fb6a 362/**\r
363 The worker function that send the displays to the screen. On output,\r
364 the selection made by user is returned.\r
365\r
366 @param Selection On input, Selection tell setup browser the information\r
367 about the Selection, form and formset to be displayed.\r
368 On output, Selection return the screen item that is selected\r
369 by user.\r
370\r
371 @retval EFI_SUCCESS The page is displayed successfully.\r
372 @return Other value if the page failed to be diplayed.\r
373\r
374**/\r
375EFI_STATUS\r
376SetupBrowser (\r
377 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 378 );\r
7936fb6a 379\r
7936fb6a 380/**\r
381 Set Buffer to Value for Size bytes.\r
382\r
383 @param Buffer Memory to set.\r
384 @param Size Number of bytes to set\r
385 @param Value Value of the set operation.\r
386\r
387**/\r
388VOID\r
389SetUnicodeMem (\r
390 IN VOID *Buffer,\r
391 IN UINTN Size,\r
392 IN CHAR16 Value\r
ed66e1bc 393 );\r
7936fb6a 394\r
395/**\r
396 Wait for a given event to fire, or for an optional timeout to expire.\r
397\r
398 @param Event The event to wait for\r
399 @param Timeout An optional timeout value in 100 ns units.\r
400 @param RefreshInterval Menu refresh interval (in seconds).\r
401\r
402 @retval EFI_SUCCESS Event fired before Timeout expired.\r
403 @retval EFI_TIME_OUT Timout expired before Event fired.\r
404\r
405**/\r
406EFI_STATUS\r
407UiWaitForSingleEvent (\r
408 IN EFI_EVENT Event,\r
409 IN UINT64 Timeout, OPTIONAL\r
410 IN UINT8 RefreshInterval OPTIONAL\r
ed66e1bc 411 );\r
7936fb6a 412\r
413/**\r
414 Draw a pop up windows based on the dimension, number of lines and\r
415 strings specified.\r
416\r
7064c0a5 417 @param ScreenWidth The width of the pop-up.\r
7936fb6a 418 @param NumberOfLines The number of lines.\r
7936fb6a 419 @param ... A series of text strings that displayed in the pop-up.\r
420\r
421**/\r
422VOID\r
8091267c 423EFIAPI\r
3ebb9bdb 424CreateMultiStringPopUp (\r
7936fb6a 425 IN UINTN ScreenWidth,\r
426 IN UINTN NumberOfLines,\r
7936fb6a 427 ...\r
ed66e1bc 428 );\r
7936fb6a 429\r
430/**\r
431 Get string or password input from user.\r
432\r
433 @param MenuOption Pointer to the current input menu.\r
434 @param Prompt The prompt string shown on popup window.\r
da588638 435 @param StringPtr Old user input and destination for use input string.\r
7936fb6a 436\r
437 @retval EFI_SUCCESS If string input is read successfully\r
438 @retval EFI_DEVICE_ERROR If operation fails\r
439\r
440**/\r
441EFI_STATUS\r
442ReadString (\r
da588638
ED
443 IN UI_MENU_OPTION *MenuOption,\r
444 IN CHAR16 *Prompt,\r
445 IN OUT CHAR16 *StringPtr\r
ed66e1bc 446 );\r
7936fb6a 447\r
448/**\r
449 Get selection for OneOf and OrderedList (Left/Right will be ignored).\r
450\r
451 @param Selection Pointer to current selection.\r
452 @param MenuOption Pointer to the current input menu.\r
453\r
454 @retval EFI_SUCCESS If Option input is processed successfully\r
455 @retval EFI_DEVICE_ERROR If operation fails\r
456\r
457**/\r
458EFI_STATUS\r
459GetSelectionInputPopUp (\r
460 IN UI_MENU_SELECTION *Selection,\r
461 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 462 );\r
7936fb6a 463\r
464/**\r
465 This routine reads a numeric value from the user input.\r
466\r
467 @param Selection Pointer to current selection.\r
468 @param MenuOption Pointer to the current input menu.\r
469\r
470 @retval EFI_SUCCESS If numerical input is read successfully\r
471 @retval EFI_DEVICE_ERROR If operation fails\r
472\r
473**/\r
474EFI_STATUS\r
475GetNumericInput (\r
476 IN UI_MENU_SELECTION *Selection,\r
477 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 478 );\r
7936fb6a 479\r
480/**\r
481 Update status bar on the bottom of menu.\r
482\r
b18e7050 483 @param Selection Current selection info.\r
7936fb6a 484 @param MessageType The type of message to be shown.\r
485 @param Flags The flags in Question header.\r
486 @param State Set or clear.\r
487\r
488**/\r
489VOID\r
490UpdateStatusBar (\r
b18e7050 491 IN UI_MENU_SELECTION *Selection,\r
7936fb6a 492 IN UINTN MessageType,\r
493 IN UINT8 Flags,\r
494 IN BOOLEAN State\r
ed66e1bc 495 );\r
7936fb6a 496\r
497/**\r
498 Process Question Config.\r
499\r
500 @param Selection The UI menu selection.\r
501 @param Question The Question to be peocessed.\r
502\r
503 @retval EFI_SUCCESS Question Config process success.\r
504 @retval Other Question Config process fail.\r
505\r
506**/\r
507EFI_STATUS\r
508ProcessQuestionConfig (\r
509 IN UI_MENU_SELECTION *Selection,\r
510 IN FORM_BROWSER_STATEMENT *Question\r
ed66e1bc 511 );\r
7936fb6a 512\r
513/**\r
514 Print Question Value according to it's storage width and display attributes.\r
515\r
516 @param Question The Question to be printed.\r
517 @param FormattedNumber Buffer for output string.\r
518 @param BufferSize The FormattedNumber buffer size in bytes.\r
519\r
520 @retval EFI_SUCCESS Print success.\r
521 @retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.\r
522\r
523**/\r
524EFI_STATUS\r
525PrintFormattedNumber (\r
526 IN FORM_BROWSER_STATEMENT *Question,\r
527 IN OUT CHAR16 *FormattedNumber,\r
528 IN UINTN BufferSize\r
ed66e1bc 529 );\r
7936fb6a 530\r
531/**\r
532 Search an Option of a Question by its value.\r
533\r
534 @param Question The Question\r
535 @param OptionValue Value for Option to be searched.\r
536\r
537 @retval Pointer Pointer to the found Option.\r
538 @retval NULL Option not found.\r
539\r
540**/\r
541QUESTION_OPTION *\r
542ValueToOption (\r
543 IN FORM_BROWSER_STATEMENT *Question,\r
544 IN EFI_HII_VALUE *OptionValue\r
ed66e1bc 545 );\r
7936fb6a 546\r
d02847d3 547/**\r
548 Return data element in an Array by its Index.\r
549\r
550 @param Array The data array.\r
551 @param Type Type of the data in this array.\r
552 @param Index Zero based index for data in this array.\r
553\r
554 @retval Value The data to be returned\r
555\r
556**/\r
557UINT64\r
558GetArrayData (\r
559 IN VOID *Array,\r
560 IN UINT8 Type,\r
561 IN UINTN Index\r
562 );\r
563\r
564/**\r
565 Set value of a data element in an Array by its Index.\r
566\r
567 @param Array The data array.\r
568 @param Type Type of the data in this array.\r
569 @param Index Zero based index for data in this array.\r
570 @param Value The value to be set.\r
571\r
572**/\r
573VOID\r
574SetArrayData (\r
575 IN VOID *Array,\r
576 IN UINT8 Type,\r
577 IN UINTN Index,\r
578 IN UINT64 Value\r
579 );\r
580\r
7936fb6a 581/**\r
582 Process a Question's Option (whether selected or un-selected).\r
583\r
584 @param Selection Pointer to UI_MENU_SELECTION.\r
585 @param MenuOption The MenuOption for this Question.\r
586 @param Selected TRUE: if Question is selected.\r
587 @param OptionString Pointer of the Option String to be displayed.\r
588\r
589 @retval EFI_SUCCESS Question Option process success.\r
590 @retval Other Question Option process fail.\r
591\r
592**/\r
593EFI_STATUS\r
594ProcessOptions (\r
595 IN UI_MENU_SELECTION *Selection,\r
596 IN UI_MENU_OPTION *MenuOption,\r
597 IN BOOLEAN Selected,\r
598 OUT CHAR16 **OptionString\r
ed66e1bc 599 );\r
7936fb6a 600\r
601/**\r
602 Process the help string: Split StringPtr to several lines of strings stored in\r
603 FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.\r
604\r
605 @param StringPtr The entire help string.\r
606 @param FormattedString The oupput formatted string.\r
6c310dfb 607 @param EachLineWidth The string length of each line in the formatted string.\r
7936fb6a 608 @param RowCount TRUE: if Question is selected.\r
609\r
610**/\r
ba46ab94 611UINTN\r
7936fb6a 612ProcessHelpString (\r
6c310dfb
ED
613 IN CHAR16 *StringPtr,\r
614 OUT CHAR16 **FormattedString,\r
615 OUT UINT16 *EachLineWidth,\r
616 IN UINTN RowCount\r
ed66e1bc 617 );\r
7936fb6a 618\r
619/**\r
620 Update key's help imformation.\r
621\r
8b0fc5c1 622 @param Selection Tell setup browser the information about the Selection\r
7936fb6a 623 @param MenuOption The Menu option\r
624 @param Selected Whether or not a tag be selected\r
625\r
626**/\r
627VOID\r
628UpdateKeyHelp (\r
8b0fc5c1 629 IN UI_MENU_SELECTION *Selection,\r
7936fb6a 630 IN UI_MENU_OPTION *MenuOption,\r
631 IN BOOLEAN Selected\r
ed66e1bc 632 );\r
7936fb6a 633\r
634/**\r
635 Clear retangle with specified text attribute.\r
636\r
637 @param LeftColumn Left column of retangle.\r
638 @param RightColumn Right column of retangle.\r
639 @param TopRow Start row of retangle.\r
640 @param BottomRow End row of retangle.\r
641 @param TextAttribute The character foreground and background.\r
642\r
643**/\r
644VOID\r
645ClearLines (\r
8b0fc5c1 646 IN UINTN LeftColumn,\r
647 IN UINTN RightColumn,\r
648 IN UINTN TopRow,\r
649 IN UINTN BottomRow,\r
650 IN UINTN TextAttribute\r
ed66e1bc 651 );\r
7936fb6a 652\r
653/**\r
654 Count the storage space of a Unicode string.\r
655\r
656 This function handles the Unicode string with NARROW_CHAR\r
657 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR\r
d66e6c16 658 does not count in the resultant output. If a WIDE_CHAR is\r
7936fb6a 659 hit, then 2 Unicode character will consume an output storage\r
660 space with size of CHAR16 till a NARROW_CHAR is hit.\r
661\r
771ececd
LG
662 If String is NULL, then ASSERT ().\r
663\r
7936fb6a 664 @param String The input string to be counted.\r
665\r
666 @return Storage space for the input string.\r
667\r
668**/\r
669UINTN\r
670GetStringWidth (\r
8b0fc5c1 671 IN CHAR16 *String\r
ed66e1bc 672 );\r
7936fb6a 673\r
674/**\r
675 Will copy LineWidth amount of a string in the OutputString buffer and return the\r
676 number of CHAR16 characters that were copied into the OutputString buffer.\r
6c310dfb 677 In the code, it deals \r,\n,\r\n same as \n\r, also it not process the \r or \g.\r
7936fb6a 678\r
679 @param InputString String description for this option.\r
680 @param LineWidth Width of the desired string to extract in CHAR16\r
681 characters\r
6c310dfb 682 @param GlyphWidth The glyph width of the beging char in the string.\r
7936fb6a 683 @param Index Where in InputString to start the copy process\r
684 @param OutputString Buffer to copy the string into\r
685\r
686 @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
687\r
688**/\r
689UINT16\r
690GetLineByWidth (\r
691 IN CHAR16 *InputString,\r
692 IN UINT16 LineWidth,\r
6c310dfb 693 IN OUT UINT16 *GlyphWidth,\r
7936fb6a 694 IN OUT UINTN *Index,\r
695 OUT CHAR16 **OutputString\r
ed66e1bc 696 );\r
7936fb6a 697\r
698/**\r
699 Get the supported width for a particular op-code\r
700\r
701 @param Statement The FORM_BROWSER_STATEMENT structure passed in.\r
702 @param Handle The handle in the HII database being used\r
703\r
704 @return Returns the number of CHAR16 characters that is support.\r
705\r
706**/\r
707UINT16\r
708GetWidth (\r
709 IN FORM_BROWSER_STATEMENT *Statement,\r
710 IN EFI_HII_HANDLE Handle\r
ed66e1bc 711 );\r
7936fb6a 712\r
713/**\r
714 Concatenate a narrow string to another string.\r
715\r
716 @param Destination The destination string.\r
717 @param Source The source string. The string to be concatenated.\r
718 to the end of Destination.\r
719\r
720**/\r
721VOID\r
722NewStrCat (\r
8b0fc5c1 723 IN OUT CHAR16 *Destination,\r
724 IN CHAR16 *Source\r
ed66e1bc 725 );\r
7936fb6a 726\r
727/**\r
728 Wait for a key to be pressed by user.\r
729\r
730 @param Key The key which is pressed by user.\r
731\r
732 @retval EFI_SUCCESS The function always completed successfully.\r
733\r
734**/\r
735EFI_STATUS\r
736WaitForKeyStroke (\r
737 OUT EFI_INPUT_KEY *Key\r
ed66e1bc 738 );\r
7936fb6a 739\r
740/**\r
741 Reset stack pointer to begin of the stack.\r
742\r
743**/\r
744VOID\r
745ResetScopeStack (\r
746 VOID\r
ed66e1bc 747 );\r
7936fb6a 748\r
31585af4
ED
749/**\r
750 Push the expression options onto the Stack.\r
751\r
752 @param Pointer Pointer to the current expression.\r
753 @param Level Which type this expression belong to. Form, \r
754 statement or option?\r
755\r
756 @retval EFI_SUCCESS The value was pushed onto the stack.\r
757 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
758\r
759**/\r
760EFI_STATUS\r
761PushConditionalExpression (\r
762 IN FORM_EXPRESSION *Pointer,\r
763 IN EXPRESS_LEVEL Level\r
764 );\r
765\r
766/**\r
767 Pop the expression options from the Stack\r
768\r
769 @param Level Which type this expression belong to. Form, \r
770 statement or option?\r
771\r
772 @retval EFI_SUCCESS The value was pushed onto the stack.\r
773 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
774\r
775**/\r
776EFI_STATUS\r
777PopConditionalExpression (\r
778 IN EXPRESS_LEVEL Level\r
779 );\r
780 \r
781/**\r
782 Get the expression Buffer pointer.\r
783 \r
784 @param Level Which type this expression belong to. Form, \r
785 statement or option?\r
786\r
787 @retval The start pointer of the expression buffer or NULL.\r
788\r
789**/\r
790FORM_EXPRESSION **\r
791GetConditionalExpressionList (\r
792 IN EXPRESS_LEVEL Level\r
793 );\r
794\r
795/**\r
796 Get the expression list count.\r
797 \r
798 @param Level Which type this expression belong to. Form, \r
799 statement or option?\r
800\r
801 @retval >=0 The expression count\r
802 @retval -1 Input parameter error.\r
803\r
804**/\r
805INTN \r
806GetConditionalExpressionCount (\r
807 IN EXPRESS_LEVEL Level\r
808 );\r
809\r
7936fb6a 810/**\r
811 Push an Operand onto the Stack\r
812\r
813 @param Operand Operand to push.\r
814\r
815 @retval EFI_SUCCESS The value was pushed onto the stack.\r
816 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
817 stack.\r
818\r
819**/\r
820EFI_STATUS\r
821PushScope (\r
822 IN UINT8 Operand\r
ed66e1bc 823 );\r
7936fb6a 824\r
825/**\r
826 Pop an Operand from the Stack\r
827\r
828 @param Operand Operand to pop.\r
829\r
830 @retval EFI_SUCCESS The value was pushed onto the stack.\r
831 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
832 stack.\r
833\r
834**/\r
835EFI_STATUS\r
836PopScope (\r
837 OUT UINT8 *Operand\r
ed66e1bc 838 );\r
7936fb6a 839\r
2573712e
LG
840/**\r
841 Reset stack pointer to begin of the stack.\r
842\r
843**/\r
844VOID\r
845ResetCurrentExpressionStack (\r
846 VOID\r
847 );\r
848\r
849/**\r
850 Push current expression onto the Stack\r
851\r
852 @param Pointer Pointer to current expression.\r
853\r
854 @retval EFI_SUCCESS The value was pushed onto the stack.\r
855 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
856\r
857**/\r
858EFI_STATUS\r
859PushCurrentExpression (\r
860 IN VOID *Pointer\r
861 );\r
862\r
863/**\r
864 Pop current expression from the Stack\r
865\r
866 @param Pointer Pointer to current expression to be pop.\r
867\r
868 @retval EFI_SUCCESS The value was pushed onto the stack.\r
869 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
870\r
871**/\r
872EFI_STATUS\r
873PopCurrentExpression (\r
874 OUT VOID **Pointer\r
875 );\r
876\r
877/**\r
878 Reset stack pointer to begin of the stack.\r
879\r
880**/\r
881VOID\r
882ResetMapExpressionListStack (\r
883 VOID\r
884 );\r
885\r
886/**\r
887 Push the list of map expression onto the Stack\r
888\r
889 @param Pointer Pointer to the list of map expression to be pushed.\r
890\r
891 @retval EFI_SUCCESS The value was pushed onto the stack.\r
892 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
893\r
894**/\r
895EFI_STATUS\r
896PushMapExpressionList (\r
897 IN VOID *Pointer\r
898 );\r
899\r
900/**\r
901 Pop the list of map expression from the Stack\r
902\r
903 @param Pointer Pointer to the list of map expression to be pop.\r
904\r
905 @retval EFI_SUCCESS The value was pushed onto the stack.\r
906 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
907\r
908**/\r
909EFI_STATUS\r
910PopMapExpressionList (\r
911 OUT VOID **Pointer\r
912 );\r
913\r
7936fb6a 914/**\r
915 Get Form given its FormId.\r
916\r
917 @param FormSet The formset which contains this form.\r
918 @param FormId Id of this form.\r
919\r
920 @retval Pointer The form.\r
921 @retval NULL Specified Form is not found in the formset.\r
922\r
923**/\r
924FORM_BROWSER_FORM *\r
925IdToForm (\r
926 IN FORM_BROWSER_FORMSET *FormSet,\r
927 IN UINT16 FormId\r
ed66e1bc 928 );\r
7936fb6a 929\r
930/**\r
931 Search a Question in Formset scope using its QuestionId.\r
932\r
933 @param FormSet The formset which contains this form.\r
934 @param Form The form which contains this Question.\r
935 @param QuestionId Id of this Question.\r
936\r
937 @retval Pointer The Question.\r
938 @retval NULL Specified Question not found in the form.\r
939\r
940**/\r
941FORM_BROWSER_STATEMENT *\r
942IdToQuestion (\r
943 IN FORM_BROWSER_FORMSET *FormSet,\r
944 IN FORM_BROWSER_FORM *Form,\r
945 IN UINT16 QuestionId\r
ed66e1bc 946 );\r
7936fb6a 947\r
948/**\r
949 Zero extend integer/boolean/date/time to UINT64 for comparing.\r
950\r
951 @param Value HII Value to be converted.\r
952\r
953**/\r
954VOID\r
955ExtendValueToU64 (\r
956 IN EFI_HII_VALUE *Value\r
ed66e1bc 957 );\r
7936fb6a 958\r
959/**\r
960 Compare two Hii value.\r
961\r
962 @param Value1 Expression value to compare on left-hand.\r
963 @param Value2 Expression value to compare on right-hand.\r
8f420676
ED
964 @param Result Return value after compare.\r
965 retval 0 Two operators equal.\r
966 return Positive value if Value1 is greater than Value2.\r
967 retval Negative value if Value1 is less than Value2.\r
7936fb6a 968 @param HiiHandle Only required for string compare.\r
969\r
8f420676
ED
970 @retval other Could not perform compare on two values.\r
971 @retval EFI_SUCCESS Compare the value success.\r
7936fb6a 972\r
973**/\r
8f420676 974EFI_STATUS\r
7936fb6a 975CompareHiiValue (\r
976 IN EFI_HII_VALUE *Value1,\r
977 IN EFI_HII_VALUE *Value2,\r
8f420676 978 OUT INTN *Result,\r
7936fb6a 979 IN EFI_HII_HANDLE HiiHandle OPTIONAL\r
ed66e1bc 980 );\r
7936fb6a 981\r
982/**\r
983 Evaluate the result of a HII expression\r
984\r
3018ca2d 985 If Expression is NULL, then ASSERT.\r
986\r
7936fb6a 987 @param FormSet FormSet associated with this expression.\r
988 @param Form Form associated with this expression.\r
989 @param Expression Expression to be evaluated.\r
990\r
991 @retval EFI_SUCCESS The expression evaluated successfuly\r
992 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId\r
993 could not be found.\r
994 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
995 stack.\r
996 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack\r
997 @retval EFI_INVALID_PARAMETER Syntax error with the Expression\r
998\r
999**/\r
1000EFI_STATUS\r
1001EvaluateExpression (\r
1002 IN FORM_BROWSER_FORMSET *FormSet,\r
1003 IN FORM_BROWSER_FORM *Form,\r
1004 IN OUT FORM_EXPRESSION *Expression\r
ed66e1bc 1005 );\r
7936fb6a 1006\r
31585af4
ED
1007/**\r
1008 Return the result of the expression list. Check the expression list and \r
1009 return the highest priority express result. \r
1010 Priority: DisableIf > SuppressIf > GrayOutIf > FALSE\r
1011\r
1012 @param ExpList The input expression list.\r
1013 @param Evaluate Whether need to evaluate the expression first.\r
1014 @param FormSet FormSet associated with this expression. Only \r
1015 needed when Evaluate is TRUE\r
1016 @param Form Form associated with this expression. Only \r
1017 needed when Evaluate is TRUE \r
1018\r
1019 @retval EXPRESS_RESULT Return the higher priority express result. \r
1020 DisableIf > SuppressIf > GrayOutIf > FALSE\r
1021\r
1022**/\r
1023EXPRESS_RESULT \r
1024EvaluateExpressionList (\r
1025 IN FORM_EXPRESSION_LIST *ExpList,\r
1026 IN BOOLEAN Evaluate,\r
1027 IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL\r
1028 IN FORM_BROWSER_FORM *Form OPTIONAL\r
1029 );\r
1030\r
33efdf51
ED
1031/**\r
1032 Transfer the device path string to binary format.\r
1033\r
1034 @param StringPtr The device path string info.\r
1035\r
1036 @retval Device path binary info.\r
1037\r
1038**/\r
1039EFI_DEVICE_PATH_PROTOCOL *\r
1040ConvertDevicePathFromText (\r
1041 IN CHAR16 *StringPtr\r
1042 );\r
1043\r
7936fb6a 1044#endif // _UI_H\r