]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Support call of SendForm() from Callback(), i.e. nested call of SendForm().
[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
d66e6c16 4Copyright (c) 2004 - 2009, Intel Corporation\r
7936fb6a 5All rights reserved. This program and the accompanying materials\r
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
18#include "Setup.h"\r
19\r
20//\r
21// Globals\r
22//\r
23#define REGULAR_NUMERIC 0\r
24#define TIME_NUMERIC 1\r
25#define DATE_NUMERIC 2\r
26\r
27#define SUBTITLE_INDENT 2\r
28\r
40a06b0c 29\r
30//\r
31// It take 23 characters including the NULL to print a 64 bits number with "[" and "]".\r
32// pow(2, 64) = [18446744073709551616]\r
33//\r
34#define MAX_NUMERIC_INPUT_WIDTH 23\r
35\r
7936fb6a 36typedef enum {\r
37 UiNoOperation,\r
38 UiDefault,\r
39 UiSelect,\r
40 UiUp,\r
41 UiDown,\r
42 UiLeft,\r
43 UiRight,\r
44 UiReset,\r
45 UiSave,\r
46 UiPrevious,\r
47 UiPageUp,\r
48 UiPageDown,\r
49 UiMaxOperation\r
50} UI_SCREEN_OPERATION;\r
51\r
52typedef enum {\r
53 CfInitialization,\r
54 CfCheckSelection,\r
55 CfRepaint,\r
56 CfRefreshHighLight,\r
57 CfUpdateHelpString,\r
58 CfPrepareToReadKey,\r
59 CfReadKey,\r
60 CfScreenOperation,\r
7936fb6a 61 CfUiSelect,\r
62 CfUiReset,\r
63 CfUiLeft,\r
64 CfUiRight,\r
65 CfUiUp,\r
66 CfUiPageUp,\r
67 CfUiPageDown,\r
68 CfUiDown,\r
69 CfUiSave,\r
70 CfUiDefault,\r
71 CfUiNoOperation,\r
72 CfExit,\r
73 CfMaxControlFlag\r
74} UI_CONTROL_FLAG;\r
75\r
76#define UI_ACTION_NONE 0\r
77#define UI_ACTION_REFRESH_FORM 1\r
78#define UI_ACTION_REFRESH_FORMSET 2\r
79#define UI_ACTION_EXIT 3\r
80\r
81typedef struct {\r
82 EFI_HII_HANDLE Handle;\r
83\r
84 //\r
85 // Target formset/form/Question information\r
86 //\r
87 EFI_GUID FormSetGuid;\r
88 UINT16 FormId;\r
89 UINT16 QuestionId;\r
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
7936fb6a 116} UI_MENU_SELECTION;\r
117\r
f3f2e05d 118#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')\r
119#define UI_MENU_LIST_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'l')\r
7936fb6a 120\r
121typedef struct {\r
122 UINTN Signature;\r
123 LIST_ENTRY Link;\r
124\r
125 EFI_HII_HANDLE Handle;\r
126 FORM_BROWSER_STATEMENT *ThisTag;\r
127 UINT16 EntryNumber;\r
128\r
129 UINTN Row;\r
130 UINTN Col;\r
131 UINTN OptCol;\r
132 CHAR16 *Description;\r
133 UINTN Skip; // Number of lines\r
134\r
135 //\r
136 // Display item sequence for date/time\r
137 // Date: Month/Day/Year\r
138 // Sequence: 0 1 2\r
139 //\r
140 // Time: Hour : Minute : Second\r
141 // Sequence: 0 1 2\r
142 //\r
143 //\r
144 UINTN Sequence;\r
145\r
146 BOOLEAN GrayOut;\r
147 BOOLEAN ReadOnly;\r
8b0fc5c1 148\r
149 //\r
150 // Whether user could change value of this item\r
151 //\r
152 BOOLEAN IsQuestion;\r
7936fb6a 153} UI_MENU_OPTION;\r
154\r
155#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)\r
156\r
d66e6c16 157typedef struct _UI_MENU_LIST UI_MENU_LIST;\r
158\r
159struct _UI_MENU_LIST {\r
7936fb6a 160 UINTN Signature;\r
d66e6c16 161 LIST_ENTRY Link;\r
7936fb6a 162\r
d66e6c16 163 EFI_GUID FormSetGuid;\r
7936fb6a 164 UINT16 FormId;\r
165 UINT16 QuestionId;\r
d66e6c16 166\r
167 UI_MENU_LIST *Parent;\r
168 LIST_ENTRY ChildListHead;\r
169};\r
170\r
171#define UI_MENU_LIST_FROM_LINK(a) CR (a, UI_MENU_LIST, Link, UI_MENU_LIST_SIGNATURE)\r
7936fb6a 172\r
173typedef struct _MENU_REFRESH_ENTRY {\r
174 struct _MENU_REFRESH_ENTRY *Next;\r
175 UI_MENU_OPTION *MenuOption; // Describes the entry needing an update\r
176 UI_MENU_SELECTION *Selection;\r
177 UINTN CurrentColumn;\r
178 UINTN CurrentRow;\r
179 UINTN CurrentAttribute;\r
180} MENU_REFRESH_ENTRY;\r
181\r
182typedef struct {\r
183 UINT16 ScanCode;\r
184 UI_SCREEN_OPERATION ScreenOperation;\r
185} SCAN_CODE_TO_SCREEN_OPERATION;\r
186\r
187typedef struct {\r
188 UI_SCREEN_OPERATION ScreenOperation;\r
189 UI_CONTROL_FLAG ControlFlag;\r
190} SCREEN_OPERATION_T0_CONTROL_FLAG;\r
191\r
192\r
ce6d12cc 193extern LIST_ENTRY gMenuOption;\r
7936fb6a 194extern MENU_REFRESH_ENTRY *gMenuRefreshHead;\r
195extern UI_MENU_SELECTION *gCurrentSelection;\r
8d00a0f1 196extern BOOLEAN mHiiPackageListUpdated;\r
7936fb6a 197\r
198//\r
199// Global Functions\r
200//\r
201/**\r
202 Initialize Menu option list.\r
203\r
204**/\r
205VOID\r
206UiInitMenu (\r
207 VOID\r
ed66e1bc 208 );\r
7936fb6a 209\r
210/**\r
211 Initialize Menu option list.\r
212\r
213**/\r
214VOID\r
215UiInitMenuList (\r
216 VOID\r
ed66e1bc 217 );\r
7936fb6a 218\r
219/**\r
d66e6c16 220 Free Menu option linked list.\r
7936fb6a 221\r
222**/\r
223VOID\r
d66e6c16 224UiFreeMenu (\r
225 VOID\r
ed66e1bc 226 );\r
7936fb6a 227\r
228/**\r
d66e6c16 229 Create a menu with specified formset GUID and form ID, and add it as a child\r
230 of the given parent menu.\r
231\r
232 @param Parent The parent of menu to be added.\r
233 @param FormSetGuid The Formset Guid of menu to be added.\r
234 @param FormId The Form ID of menu to be added.\r
235\r
236 @return A pointer to the newly added menu or NULL if memory is insufficient.\r
7936fb6a 237\r
238**/\r
d66e6c16 239UI_MENU_LIST *\r
240UiAddMenuList (\r
241 IN OUT UI_MENU_LIST *Parent,\r
242 IN EFI_GUID *FormSetGuid,\r
243 IN UINT16 FormId\r
ed66e1bc 244 );\r
7936fb6a 245\r
246/**\r
d66e6c16 247 Search Menu with given FormId in the parent menu and all its child menus.\r
7936fb6a 248\r
d66e6c16 249 @param Parent The parent of menu to search.\r
250 @param FormId The Form ID of menu to search.\r
251\r
252 @return A pointer to menu found or NULL if not found.\r
7936fb6a 253\r
254**/\r
d66e6c16 255UI_MENU_LIST *\r
256UiFindChildMenuList (\r
257 IN UI_MENU_LIST *Parent,\r
258 IN UINT16 FormId\r
259 );\r
260\r
261/**\r
262 Search Menu with given FormSetGuid and FormId in all cached menu list.\r
263\r
264 @param FormSetGuid The Formset GUID of the menu to search.\r
265 @param FormId The Form ID of menu to search.\r
266\r
267 @return A pointer to menu found or NULL if not found.\r
268\r
269**/\r
270UI_MENU_LIST *\r
271UiFindMenuList (\r
272 IN EFI_GUID *FormSetGuid,\r
273 IN UINT16 FormId\r
ed66e1bc 274 );\r
7936fb6a 275\r
276/**\r
277 Free Menu option linked list.\r
278\r
279**/\r
280VOID\r
d66e6c16 281UiFreeRefreshList (\r
7936fb6a 282 VOID\r
ed66e1bc 283 );\r
7936fb6a 284\r
285/**\r
286 Add one menu option by specified description and context.\r
287\r
288 @param String String description for this option.\r
289 @param Handle Hii handle for the package list.\r
290 @param Statement Statement of this Menu Option.\r
291 @param NumberOfLines Display lines for this Menu Option.\r
292 @param MenuItemCount The index for this Option in the Menu.\r
293\r
8b0fc5c1 294 @retval Pointer Pointer to the added Menu Option.\r
295\r
7936fb6a 296**/\r
8b0fc5c1 297UI_MENU_OPTION *\r
7936fb6a 298UiAddMenuOption (\r
299 IN CHAR16 *String,\r
300 IN EFI_HII_HANDLE Handle,\r
301 IN FORM_BROWSER_STATEMENT *Statement,\r
302 IN UINT16 NumberOfLines,\r
303 IN UINT16 MenuItemCount\r
ed66e1bc 304 );\r
7936fb6a 305\r
306/**\r
307 Display menu and wait for user to select one menu option, then return it.\r
308 If AutoBoot is enabled, then if user doesn't select any option,\r
309 after period of time, it will automatically return the first menu option.\r
310\r
311 @param Selection Menu selection.\r
312\r
313 @return Return the pointer of the menu which selected,\r
314 @return otherwise return NULL.\r
315\r
316**/\r
317EFI_STATUS\r
318UiDisplayMenu (\r
319 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 320 );\r
7936fb6a 321\r
322/**\r
323 Free up the resource allocated for all strings required\r
324 by Setup Browser.\r
325\r
326**/\r
327VOID\r
328FreeBrowserStrings (\r
329 VOID\r
ed66e1bc 330 );\r
7936fb6a 331\r
332/**\r
333 The worker function that send the displays to the screen. On output,\r
334 the selection made by user is returned.\r
335\r
336 @param Selection On input, Selection tell setup browser the information\r
337 about the Selection, form and formset to be displayed.\r
338 On output, Selection return the screen item that is selected\r
339 by user.\r
340\r
341 @retval EFI_SUCCESS The page is displayed successfully.\r
342 @return Other value if the page failed to be diplayed.\r
343\r
344**/\r
345EFI_STATUS\r
346SetupBrowser (\r
347 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 348 );\r
7936fb6a 349\r
350/**\r
351 VSPrint worker function that prints a Value as a decimal number in Buffer.\r
352\r
353 @param Buffer Location to place ascii decimal number string of Value.\r
354 @param Flags Flags to use in printing decimal string, see file header for\r
355 details.\r
356 @param Value Decimal value to convert to a string in Buffer.\r
357\r
358 @return Number of characters printed.\r
359\r
360**/\r
361VOID\r
362ValueToString (\r
363 IN CHAR16 *Buffer,\r
364 IN BOOLEAN Flags,\r
365 IN INT64 Value\r
ed66e1bc 366 );\r
7936fb6a 367\r
368/**\r
369 Set Buffer to Value for Size bytes.\r
370\r
371 @param Buffer Memory to set.\r
372 @param Size Number of bytes to set\r
373 @param Value Value of the set operation.\r
374\r
375**/\r
376VOID\r
377SetUnicodeMem (\r
378 IN VOID *Buffer,\r
379 IN UINTN Size,\r
380 IN CHAR16 Value\r
ed66e1bc 381 );\r
7936fb6a 382\r
383/**\r
384 Wait for a given event to fire, or for an optional timeout to expire.\r
385\r
386 @param Event The event to wait for\r
387 @param Timeout An optional timeout value in 100 ns units.\r
388 @param RefreshInterval Menu refresh interval (in seconds).\r
389\r
390 @retval EFI_SUCCESS Event fired before Timeout expired.\r
391 @retval EFI_TIME_OUT Timout expired before Event fired.\r
392\r
393**/\r
394EFI_STATUS\r
395UiWaitForSingleEvent (\r
396 IN EFI_EVENT Event,\r
397 IN UINT64 Timeout, OPTIONAL\r
398 IN UINT8 RefreshInterval OPTIONAL\r
ed66e1bc 399 );\r
7936fb6a 400\r
401/**\r
402 Draw a pop up windows based on the dimension, number of lines and\r
403 strings specified.\r
404\r
7064c0a5 405 @param ScreenWidth The width of the pop-up.\r
7936fb6a 406 @param NumberOfLines The number of lines.\r
7936fb6a 407 @param ... A series of text strings that displayed in the pop-up.\r
408\r
409**/\r
410VOID\r
3ebb9bdb 411CreateMultiStringPopUp (\r
7936fb6a 412 IN UINTN ScreenWidth,\r
413 IN UINTN NumberOfLines,\r
7936fb6a 414 ...\r
ed66e1bc 415 );\r
7936fb6a 416\r
417/**\r
418 Get string or password input from user.\r
419\r
420 @param MenuOption Pointer to the current input menu.\r
421 @param Prompt The prompt string shown on popup window.\r
422 @param StringPtr Destination for use input string.\r
423\r
424 @retval EFI_SUCCESS If string input is read successfully\r
425 @retval EFI_DEVICE_ERROR If operation fails\r
426\r
427**/\r
428EFI_STATUS\r
429ReadString (\r
430 IN UI_MENU_OPTION *MenuOption,\r
431 IN CHAR16 *Prompt,\r
432 OUT CHAR16 *StringPtr\r
ed66e1bc 433 );\r
7936fb6a 434\r
435/**\r
436 Get selection for OneOf and OrderedList (Left/Right will be ignored).\r
437\r
438 @param Selection Pointer to current selection.\r
439 @param MenuOption Pointer to the current input menu.\r
440\r
441 @retval EFI_SUCCESS If Option input is processed successfully\r
442 @retval EFI_DEVICE_ERROR If operation fails\r
443\r
444**/\r
445EFI_STATUS\r
446GetSelectionInputPopUp (\r
447 IN UI_MENU_SELECTION *Selection,\r
448 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 449 );\r
7936fb6a 450\r
451/**\r
452 This routine reads a numeric value from the user input.\r
453\r
454 @param Selection Pointer to current selection.\r
455 @param MenuOption Pointer to the current input menu.\r
456\r
457 @retval EFI_SUCCESS If numerical input is read successfully\r
458 @retval EFI_DEVICE_ERROR If operation fails\r
459\r
460**/\r
461EFI_STATUS\r
462GetNumericInput (\r
463 IN UI_MENU_SELECTION *Selection,\r
464 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 465 );\r
7936fb6a 466\r
467/**\r
468 Update status bar on the bottom of menu.\r
469\r
470 @param MessageType The type of message to be shown.\r
471 @param Flags The flags in Question header.\r
472 @param State Set or clear.\r
473\r
474**/\r
475VOID\r
476UpdateStatusBar (\r
477 IN UINTN MessageType,\r
478 IN UINT8 Flags,\r
479 IN BOOLEAN State\r
ed66e1bc 480 );\r
7936fb6a 481\r
482/**\r
483 Process Question Config.\r
484\r
485 @param Selection The UI menu selection.\r
486 @param Question The Question to be peocessed.\r
487\r
488 @retval EFI_SUCCESS Question Config process success.\r
489 @retval Other Question Config process fail.\r
490\r
491**/\r
492EFI_STATUS\r
493ProcessQuestionConfig (\r
494 IN UI_MENU_SELECTION *Selection,\r
495 IN FORM_BROWSER_STATEMENT *Question\r
ed66e1bc 496 );\r
7936fb6a 497\r
498/**\r
499 Print Question Value according to it's storage width and display attributes.\r
500\r
501 @param Question The Question to be printed.\r
502 @param FormattedNumber Buffer for output string.\r
503 @param BufferSize The FormattedNumber buffer size in bytes.\r
504\r
505 @retval EFI_SUCCESS Print success.\r
506 @retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.\r
507\r
508**/\r
509EFI_STATUS\r
510PrintFormattedNumber (\r
511 IN FORM_BROWSER_STATEMENT *Question,\r
512 IN OUT CHAR16 *FormattedNumber,\r
513 IN UINTN BufferSize\r
ed66e1bc 514 );\r
7936fb6a 515\r
516/**\r
517 Search an Option of a Question by its value.\r
518\r
519 @param Question The Question\r
520 @param OptionValue Value for Option to be searched.\r
521\r
522 @retval Pointer Pointer to the found Option.\r
523 @retval NULL Option not found.\r
524\r
525**/\r
526QUESTION_OPTION *\r
527ValueToOption (\r
528 IN FORM_BROWSER_STATEMENT *Question,\r
529 IN EFI_HII_VALUE *OptionValue\r
ed66e1bc 530 );\r
7936fb6a 531\r
d02847d3 532/**\r
533 Return data element in an Array by its Index.\r
534\r
535 @param Array The data array.\r
536 @param Type Type of the data in this array.\r
537 @param Index Zero based index for data in this array.\r
538\r
539 @retval Value The data to be returned\r
540\r
541**/\r
542UINT64\r
543GetArrayData (\r
544 IN VOID *Array,\r
545 IN UINT8 Type,\r
546 IN UINTN Index\r
547 );\r
548\r
549/**\r
550 Set value of a data element in an Array by its Index.\r
551\r
552 @param Array The data array.\r
553 @param Type Type of the data in this array.\r
554 @param Index Zero based index for data in this array.\r
555 @param Value The value to be set.\r
556\r
557**/\r
558VOID\r
559SetArrayData (\r
560 IN VOID *Array,\r
561 IN UINT8 Type,\r
562 IN UINTN Index,\r
563 IN UINT64 Value\r
564 );\r
565\r
7936fb6a 566/**\r
567 Process a Question's Option (whether selected or un-selected).\r
568\r
569 @param Selection Pointer to UI_MENU_SELECTION.\r
570 @param MenuOption The MenuOption for this Question.\r
571 @param Selected TRUE: if Question is selected.\r
572 @param OptionString Pointer of the Option String to be displayed.\r
573\r
574 @retval EFI_SUCCESS Question Option process success.\r
575 @retval Other Question Option process fail.\r
576\r
577**/\r
578EFI_STATUS\r
579ProcessOptions (\r
580 IN UI_MENU_SELECTION *Selection,\r
581 IN UI_MENU_OPTION *MenuOption,\r
582 IN BOOLEAN Selected,\r
583 OUT CHAR16 **OptionString\r
ed66e1bc 584 );\r
7936fb6a 585\r
586/**\r
587 Process the help string: Split StringPtr to several lines of strings stored in\r
588 FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.\r
589\r
590 @param StringPtr The entire help string.\r
591 @param FormattedString The oupput formatted string.\r
592 @param RowCount TRUE: if Question is selected.\r
593\r
594**/\r
595VOID\r
596ProcessHelpString (\r
597 IN CHAR16 *StringPtr,\r
598 OUT CHAR16 **FormattedString,\r
599 IN UINTN RowCount\r
ed66e1bc 600 );\r
7936fb6a 601\r
602/**\r
603 Update key's help imformation.\r
604\r
8b0fc5c1 605 @param Selection Tell setup browser the information about the Selection\r
7936fb6a 606 @param MenuOption The Menu option\r
607 @param Selected Whether or not a tag be selected\r
608\r
609**/\r
610VOID\r
611UpdateKeyHelp (\r
8b0fc5c1 612 IN UI_MENU_SELECTION *Selection,\r
7936fb6a 613 IN UI_MENU_OPTION *MenuOption,\r
614 IN BOOLEAN Selected\r
ed66e1bc 615 );\r
7936fb6a 616\r
617/**\r
618 Clear retangle with specified text attribute.\r
619\r
620 @param LeftColumn Left column of retangle.\r
621 @param RightColumn Right column of retangle.\r
622 @param TopRow Start row of retangle.\r
623 @param BottomRow End row of retangle.\r
624 @param TextAttribute The character foreground and background.\r
625\r
626**/\r
627VOID\r
628ClearLines (\r
8b0fc5c1 629 IN UINTN LeftColumn,\r
630 IN UINTN RightColumn,\r
631 IN UINTN TopRow,\r
632 IN UINTN BottomRow,\r
633 IN UINTN TextAttribute\r
ed66e1bc 634 );\r
7936fb6a 635\r
636/**\r
637 Count the storage space of a Unicode string.\r
638\r
639 This function handles the Unicode string with NARROW_CHAR\r
640 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR\r
d66e6c16 641 does not count in the resultant output. If a WIDE_CHAR is\r
7936fb6a 642 hit, then 2 Unicode character will consume an output storage\r
643 space with size of CHAR16 till a NARROW_CHAR is hit.\r
644\r
645 @param String The input string to be counted.\r
646\r
647 @return Storage space for the input string.\r
648\r
649**/\r
650UINTN\r
651GetStringWidth (\r
8b0fc5c1 652 IN CHAR16 *String\r
ed66e1bc 653 );\r
7936fb6a 654\r
655/**\r
656 Will copy LineWidth amount of a string in the OutputString buffer and return the\r
657 number of CHAR16 characters that were copied into the OutputString buffer.\r
658\r
659 @param InputString String description for this option.\r
660 @param LineWidth Width of the desired string to extract in CHAR16\r
661 characters\r
662 @param Index Where in InputString to start the copy process\r
663 @param OutputString Buffer to copy the string into\r
664\r
665 @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
666\r
667**/\r
668UINT16\r
669GetLineByWidth (\r
670 IN CHAR16 *InputString,\r
671 IN UINT16 LineWidth,\r
672 IN OUT UINTN *Index,\r
673 OUT CHAR16 **OutputString\r
ed66e1bc 674 );\r
7936fb6a 675\r
676/**\r
677 Get the supported width for a particular op-code\r
678\r
679 @param Statement The FORM_BROWSER_STATEMENT structure passed in.\r
680 @param Handle The handle in the HII database being used\r
681\r
682 @return Returns the number of CHAR16 characters that is support.\r
683\r
684**/\r
685UINT16\r
686GetWidth (\r
687 IN FORM_BROWSER_STATEMENT *Statement,\r
688 IN EFI_HII_HANDLE Handle\r
ed66e1bc 689 );\r
7936fb6a 690\r
691/**\r
692 Concatenate a narrow string to another string.\r
693\r
694 @param Destination The destination string.\r
695 @param Source The source string. The string to be concatenated.\r
696 to the end of Destination.\r
697\r
698**/\r
699VOID\r
700NewStrCat (\r
8b0fc5c1 701 IN OUT CHAR16 *Destination,\r
702 IN CHAR16 *Source\r
ed66e1bc 703 );\r
7936fb6a 704\r
705/**\r
706 Wait for a key to be pressed by user.\r
707\r
708 @param Key The key which is pressed by user.\r
709\r
710 @retval EFI_SUCCESS The function always completed successfully.\r
711\r
712**/\r
713EFI_STATUS\r
714WaitForKeyStroke (\r
715 OUT EFI_INPUT_KEY *Key\r
ed66e1bc 716 );\r
7936fb6a 717\r
718/**\r
719 Reset stack pointer to begin of the stack.\r
720\r
721**/\r
722VOID\r
723ResetScopeStack (\r
724 VOID\r
ed66e1bc 725 );\r
7936fb6a 726\r
727/**\r
728 Push an Operand onto the Stack\r
729\r
730 @param Operand Operand to push.\r
731\r
732 @retval EFI_SUCCESS The value was pushed onto the stack.\r
733 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
734 stack.\r
735\r
736**/\r
737EFI_STATUS\r
738PushScope (\r
739 IN UINT8 Operand\r
ed66e1bc 740 );\r
7936fb6a 741\r
742/**\r
743 Pop an Operand from the Stack\r
744\r
745 @param Operand Operand to pop.\r
746\r
747 @retval EFI_SUCCESS The value was pushed onto the stack.\r
748 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
749 stack.\r
750\r
751**/\r
752EFI_STATUS\r
753PopScope (\r
754 OUT UINT8 *Operand\r
ed66e1bc 755 );\r
7936fb6a 756\r
757/**\r
758 Get Form given its FormId.\r
759\r
760 @param FormSet The formset which contains this form.\r
761 @param FormId Id of this form.\r
762\r
763 @retval Pointer The form.\r
764 @retval NULL Specified Form is not found in the formset.\r
765\r
766**/\r
767FORM_BROWSER_FORM *\r
768IdToForm (\r
769 IN FORM_BROWSER_FORMSET *FormSet,\r
770 IN UINT16 FormId\r
ed66e1bc 771 );\r
7936fb6a 772\r
773/**\r
774 Search a Question in Formset scope using its QuestionId.\r
775\r
776 @param FormSet The formset which contains this form.\r
777 @param Form The form which contains this Question.\r
778 @param QuestionId Id of this Question.\r
779\r
780 @retval Pointer The Question.\r
781 @retval NULL Specified Question not found in the form.\r
782\r
783**/\r
784FORM_BROWSER_STATEMENT *\r
785IdToQuestion (\r
786 IN FORM_BROWSER_FORMSET *FormSet,\r
787 IN FORM_BROWSER_FORM *Form,\r
788 IN UINT16 QuestionId\r
ed66e1bc 789 );\r
7936fb6a 790\r
791/**\r
792 Zero extend integer/boolean/date/time to UINT64 for comparing.\r
793\r
794 @param Value HII Value to be converted.\r
795\r
796**/\r
797VOID\r
798ExtendValueToU64 (\r
799 IN EFI_HII_VALUE *Value\r
ed66e1bc 800 );\r
7936fb6a 801\r
802/**\r
803 Compare two Hii value.\r
804\r
805 @param Value1 Expression value to compare on left-hand.\r
806 @param Value2 Expression value to compare on right-hand.\r
807 @param HiiHandle Only required for string compare.\r
808\r
809 @retval EFI_INVALID_PARAMETER Could not perform comparation on two values.\r
810 @retval 0 Two operators equeal.\r
811 @return Positive value if Value1 is greater than Value2.\r
812 @retval Negative value if Value1 is less than Value2.\r
813\r
814**/\r
815INTN\r
816CompareHiiValue (\r
817 IN EFI_HII_VALUE *Value1,\r
818 IN EFI_HII_VALUE *Value2,\r
819 IN EFI_HII_HANDLE HiiHandle OPTIONAL\r
ed66e1bc 820 );\r
7936fb6a 821\r
822/**\r
823 Evaluate the result of a HII expression\r
824\r
3018ca2d 825 If Expression is NULL, then ASSERT.\r
826\r
7936fb6a 827 @param FormSet FormSet associated with this expression.\r
828 @param Form Form associated with this expression.\r
829 @param Expression Expression to be evaluated.\r
830\r
831 @retval EFI_SUCCESS The expression evaluated successfuly\r
832 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId\r
833 could not be found.\r
834 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
835 stack.\r
836 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack\r
837 @retval EFI_INVALID_PARAMETER Syntax error with the Expression\r
838\r
839**/\r
840EFI_STATUS\r
841EvaluateExpression (\r
842 IN FORM_BROWSER_FORMSET *FormSet,\r
843 IN FORM_BROWSER_FORM *Form,\r
844 IN OUT FORM_EXPRESSION *Expression\r
ed66e1bc 845 );\r
7936fb6a 846\r
847#endif // _UI_H\r