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