]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Update select highlight menu logic when opcode is date/time
[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
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
298 @param Statement Statement of this Menu Option.\r
299 @param NumberOfLines Display lines for this Menu Option.\r
300 @param MenuItemCount The index for this Option in the Menu.\r
301\r
8b0fc5c1 302 @retval Pointer Pointer to the added Menu Option.\r
303\r
7936fb6a 304**/\r
8b0fc5c1 305UI_MENU_OPTION *\r
7936fb6a 306UiAddMenuOption (\r
307 IN CHAR16 *String,\r
308 IN EFI_HII_HANDLE Handle,\r
309 IN FORM_BROWSER_STATEMENT *Statement,\r
310 IN UINT16 NumberOfLines,\r
311 IN UINT16 MenuItemCount\r
ed66e1bc 312 );\r
7936fb6a 313\r
314/**\r
315 Display menu and wait for user to select one menu option, then return it.\r
316 If AutoBoot is enabled, then if user doesn't select any option,\r
317 after period of time, it will automatically return the first menu option.\r
318\r
319 @param Selection Menu selection.\r
320\r
321 @return Return the pointer of the menu which selected,\r
322 @return otherwise return NULL.\r
323\r
324**/\r
325EFI_STATUS\r
326UiDisplayMenu (\r
327 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 328 );\r
7936fb6a 329\r
330/**\r
331 Free up the resource allocated for all strings required\r
332 by Setup Browser.\r
333\r
334**/\r
335VOID\r
336FreeBrowserStrings (\r
337 VOID\r
ed66e1bc 338 );\r
7936fb6a 339\r
8ca6180f
ED
340/**\r
341 Process the goto op code, update the info in the selection structure.\r
342\r
343 @param Statement The statement belong to goto op code.\r
344 @param Selection The selection info.\r
345 @param Repaint Whether need to repaint the menu.\r
346 @param NewLine Whether need to create new line.\r
347\r
348 @retval EFI_SUCCESS The menu process successfully.\r
349 @return Other value if the process failed.\r
350**/\r
351EFI_STATUS\r
352ProcessGotoOpCode (\r
353 IN OUT FORM_BROWSER_STATEMENT *Statement,\r
354 IN OUT UI_MENU_SELECTION *Selection,\r
355 OUT BOOLEAN *Repaint,\r
356 OUT BOOLEAN *NewLine\r
357 );\r
358\r
359\r
7936fb6a 360/**\r
361 The worker function that send the displays to the screen. On output,\r
362 the selection made by user is returned.\r
363\r
364 @param Selection On input, Selection tell setup browser the information\r
365 about the Selection, form and formset to be displayed.\r
366 On output, Selection return the screen item that is selected\r
367 by user.\r
368\r
369 @retval EFI_SUCCESS The page is displayed successfully.\r
370 @return Other value if the page failed to be diplayed.\r
371\r
372**/\r
373EFI_STATUS\r
374SetupBrowser (\r
375 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 376 );\r
7936fb6a 377\r
7936fb6a 378/**\r
379 Set Buffer to Value for Size bytes.\r
380\r
381 @param Buffer Memory to set.\r
382 @param Size Number of bytes to set\r
383 @param Value Value of the set operation.\r
384\r
385**/\r
386VOID\r
387SetUnicodeMem (\r
388 IN VOID *Buffer,\r
389 IN UINTN Size,\r
390 IN CHAR16 Value\r
ed66e1bc 391 );\r
7936fb6a 392\r
393/**\r
394 Wait for a given event to fire, or for an optional timeout to expire.\r
395\r
396 @param Event The event to wait for\r
397 @param Timeout An optional timeout value in 100 ns units.\r
398 @param RefreshInterval Menu refresh interval (in seconds).\r
399\r
400 @retval EFI_SUCCESS Event fired before Timeout expired.\r
401 @retval EFI_TIME_OUT Timout expired before Event fired.\r
402\r
403**/\r
404EFI_STATUS\r
405UiWaitForSingleEvent (\r
406 IN EFI_EVENT Event,\r
407 IN UINT64 Timeout, OPTIONAL\r
408 IN UINT8 RefreshInterval OPTIONAL\r
ed66e1bc 409 );\r
7936fb6a 410\r
411/**\r
412 Draw a pop up windows based on the dimension, number of lines and\r
413 strings specified.\r
414\r
7064c0a5 415 @param ScreenWidth The width of the pop-up.\r
7936fb6a 416 @param NumberOfLines The number of lines.\r
7936fb6a 417 @param ... A series of text strings that displayed in the pop-up.\r
418\r
419**/\r
420VOID\r
8091267c 421EFIAPI\r
3ebb9bdb 422CreateMultiStringPopUp (\r
7936fb6a 423 IN UINTN ScreenWidth,\r
424 IN UINTN NumberOfLines,\r
7936fb6a 425 ...\r
ed66e1bc 426 );\r
7936fb6a 427\r
428/**\r
429 Get string or password input from user.\r
430\r
431 @param MenuOption Pointer to the current input menu.\r
432 @param Prompt The prompt string shown on popup window.\r
da588638 433 @param StringPtr Old user input and destination for use input string.\r
7936fb6a 434\r
435 @retval EFI_SUCCESS If string input is read successfully\r
436 @retval EFI_DEVICE_ERROR If operation fails\r
437\r
438**/\r
439EFI_STATUS\r
440ReadString (\r
da588638
ED
441 IN UI_MENU_OPTION *MenuOption,\r
442 IN CHAR16 *Prompt,\r
443 IN OUT CHAR16 *StringPtr\r
ed66e1bc 444 );\r
7936fb6a 445\r
446/**\r
447 Get selection for OneOf and OrderedList (Left/Right will be ignored).\r
448\r
449 @param Selection Pointer to current selection.\r
450 @param MenuOption Pointer to the current input menu.\r
451\r
452 @retval EFI_SUCCESS If Option input is processed successfully\r
453 @retval EFI_DEVICE_ERROR If operation fails\r
454\r
455**/\r
456EFI_STATUS\r
457GetSelectionInputPopUp (\r
458 IN UI_MENU_SELECTION *Selection,\r
459 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 460 );\r
7936fb6a 461\r
462/**\r
463 This routine reads a numeric value from the user input.\r
464\r
465 @param Selection Pointer to current selection.\r
466 @param MenuOption Pointer to the current input menu.\r
467\r
468 @retval EFI_SUCCESS If numerical input is read successfully\r
469 @retval EFI_DEVICE_ERROR If operation fails\r
470\r
471**/\r
472EFI_STATUS\r
473GetNumericInput (\r
474 IN UI_MENU_SELECTION *Selection,\r
475 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 476 );\r
7936fb6a 477\r
478/**\r
479 Update status bar on the bottom of menu.\r
480\r
b18e7050 481 @param Selection Current selection info.\r
7936fb6a 482 @param MessageType The type of message to be shown.\r
483 @param Flags The flags in Question header.\r
484 @param State Set or clear.\r
485\r
486**/\r
487VOID\r
488UpdateStatusBar (\r
b18e7050 489 IN UI_MENU_SELECTION *Selection,\r
7936fb6a 490 IN UINTN MessageType,\r
491 IN UINT8 Flags,\r
492 IN BOOLEAN State\r
ed66e1bc 493 );\r
7936fb6a 494\r
495/**\r
496 Process Question Config.\r
497\r
498 @param Selection The UI menu selection.\r
499 @param Question The Question to be peocessed.\r
500\r
501 @retval EFI_SUCCESS Question Config process success.\r
502 @retval Other Question Config process fail.\r
503\r
504**/\r
505EFI_STATUS\r
506ProcessQuestionConfig (\r
507 IN UI_MENU_SELECTION *Selection,\r
508 IN FORM_BROWSER_STATEMENT *Question\r
ed66e1bc 509 );\r
7936fb6a 510\r
511/**\r
512 Print Question Value according to it's storage width and display attributes.\r
513\r
514 @param Question The Question to be printed.\r
515 @param FormattedNumber Buffer for output string.\r
516 @param BufferSize The FormattedNumber buffer size in bytes.\r
517\r
518 @retval EFI_SUCCESS Print success.\r
519 @retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.\r
520\r
521**/\r
522EFI_STATUS\r
523PrintFormattedNumber (\r
524 IN FORM_BROWSER_STATEMENT *Question,\r
525 IN OUT CHAR16 *FormattedNumber,\r
526 IN UINTN BufferSize\r
ed66e1bc 527 );\r
7936fb6a 528\r
529/**\r
530 Search an Option of a Question by its value.\r
531\r
532 @param Question The Question\r
533 @param OptionValue Value for Option to be searched.\r
534\r
535 @retval Pointer Pointer to the found Option.\r
536 @retval NULL Option not found.\r
537\r
538**/\r
539QUESTION_OPTION *\r
540ValueToOption (\r
541 IN FORM_BROWSER_STATEMENT *Question,\r
542 IN EFI_HII_VALUE *OptionValue\r
ed66e1bc 543 );\r
7936fb6a 544\r
d02847d3 545/**\r
546 Return data element in an Array by its Index.\r
547\r
548 @param Array The data array.\r
549 @param Type Type of the data in this array.\r
550 @param Index Zero based index for data in this array.\r
551\r
552 @retval Value The data to be returned\r
553\r
554**/\r
555UINT64\r
556GetArrayData (\r
557 IN VOID *Array,\r
558 IN UINT8 Type,\r
559 IN UINTN Index\r
560 );\r
561\r
562/**\r
563 Set value of a data element in an Array by its Index.\r
564\r
565 @param Array The data array.\r
566 @param Type Type of the data in this array.\r
567 @param Index Zero based index for data in this array.\r
568 @param Value The value to be set.\r
569\r
570**/\r
571VOID\r
572SetArrayData (\r
573 IN VOID *Array,\r
574 IN UINT8 Type,\r
575 IN UINTN Index,\r
576 IN UINT64 Value\r
577 );\r
578\r
7936fb6a 579/**\r
580 Process a Question's Option (whether selected or un-selected).\r
581\r
582 @param Selection Pointer to UI_MENU_SELECTION.\r
583 @param MenuOption The MenuOption for this Question.\r
584 @param Selected TRUE: if Question is selected.\r
585 @param OptionString Pointer of the Option String to be displayed.\r
586\r
587 @retval EFI_SUCCESS Question Option process success.\r
588 @retval Other Question Option process fail.\r
589\r
590**/\r
591EFI_STATUS\r
592ProcessOptions (\r
593 IN UI_MENU_SELECTION *Selection,\r
594 IN UI_MENU_OPTION *MenuOption,\r
595 IN BOOLEAN Selected,\r
596 OUT CHAR16 **OptionString\r
ed66e1bc 597 );\r
7936fb6a 598\r
599/**\r
600 Process the help string: Split StringPtr to several lines of strings stored in\r
601 FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.\r
602\r
603 @param StringPtr The entire help string.\r
604 @param FormattedString The oupput formatted string.\r
605 @param RowCount TRUE: if Question is selected.\r
606\r
607**/\r
608VOID\r
609ProcessHelpString (\r
610 IN CHAR16 *StringPtr,\r
611 OUT CHAR16 **FormattedString,\r
612 IN UINTN RowCount\r
ed66e1bc 613 );\r
7936fb6a 614\r
615/**\r
616 Update key's help imformation.\r
617\r
8b0fc5c1 618 @param Selection Tell setup browser the information about the Selection\r
7936fb6a 619 @param MenuOption The Menu option\r
620 @param Selected Whether or not a tag be selected\r
621\r
622**/\r
623VOID\r
624UpdateKeyHelp (\r
8b0fc5c1 625 IN UI_MENU_SELECTION *Selection,\r
7936fb6a 626 IN UI_MENU_OPTION *MenuOption,\r
627 IN BOOLEAN Selected\r
ed66e1bc 628 );\r
7936fb6a 629\r
630/**\r
631 Clear retangle with specified text attribute.\r
632\r
633 @param LeftColumn Left column of retangle.\r
634 @param RightColumn Right column of retangle.\r
635 @param TopRow Start row of retangle.\r
636 @param BottomRow End row of retangle.\r
637 @param TextAttribute The character foreground and background.\r
638\r
639**/\r
640VOID\r
641ClearLines (\r
8b0fc5c1 642 IN UINTN LeftColumn,\r
643 IN UINTN RightColumn,\r
644 IN UINTN TopRow,\r
645 IN UINTN BottomRow,\r
646 IN UINTN TextAttribute\r
ed66e1bc 647 );\r
7936fb6a 648\r
649/**\r
650 Count the storage space of a Unicode string.\r
651\r
652 This function handles the Unicode string with NARROW_CHAR\r
653 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR\r
d66e6c16 654 does not count in the resultant output. If a WIDE_CHAR is\r
7936fb6a 655 hit, then 2 Unicode character will consume an output storage\r
656 space with size of CHAR16 till a NARROW_CHAR is hit.\r
657\r
771ececd
LG
658 If String is NULL, then ASSERT ().\r
659\r
7936fb6a 660 @param String The input string to be counted.\r
661\r
662 @return Storage space for the input string.\r
663\r
664**/\r
665UINTN\r
666GetStringWidth (\r
8b0fc5c1 667 IN CHAR16 *String\r
ed66e1bc 668 );\r
7936fb6a 669\r
670/**\r
671 Will copy LineWidth amount of a string in the OutputString buffer and return the\r
672 number of CHAR16 characters that were copied into the OutputString buffer.\r
673\r
674 @param InputString String description for this option.\r
675 @param LineWidth Width of the desired string to extract in CHAR16\r
676 characters\r
677 @param Index Where in InputString to start the copy process\r
678 @param OutputString Buffer to copy the string into\r
679\r
680 @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
681\r
682**/\r
683UINT16\r
684GetLineByWidth (\r
685 IN CHAR16 *InputString,\r
686 IN UINT16 LineWidth,\r
687 IN OUT UINTN *Index,\r
688 OUT CHAR16 **OutputString\r
ed66e1bc 689 );\r
7936fb6a 690\r
691/**\r
692 Get the supported width for a particular op-code\r
693\r
694 @param Statement The FORM_BROWSER_STATEMENT structure passed in.\r
695 @param Handle The handle in the HII database being used\r
696\r
697 @return Returns the number of CHAR16 characters that is support.\r
698\r
699**/\r
700UINT16\r
701GetWidth (\r
702 IN FORM_BROWSER_STATEMENT *Statement,\r
703 IN EFI_HII_HANDLE Handle\r
ed66e1bc 704 );\r
7936fb6a 705\r
706/**\r
707 Concatenate a narrow string to another string.\r
708\r
709 @param Destination The destination string.\r
710 @param Source The source string. The string to be concatenated.\r
711 to the end of Destination.\r
712\r
713**/\r
714VOID\r
715NewStrCat (\r
8b0fc5c1 716 IN OUT CHAR16 *Destination,\r
717 IN CHAR16 *Source\r
ed66e1bc 718 );\r
7936fb6a 719\r
720/**\r
721 Wait for a key to be pressed by user.\r
722\r
723 @param Key The key which is pressed by user.\r
724\r
725 @retval EFI_SUCCESS The function always completed successfully.\r
726\r
727**/\r
728EFI_STATUS\r
729WaitForKeyStroke (\r
730 OUT EFI_INPUT_KEY *Key\r
ed66e1bc 731 );\r
7936fb6a 732\r
733/**\r
734 Reset stack pointer to begin of the stack.\r
735\r
736**/\r
737VOID\r
738ResetScopeStack (\r
739 VOID\r
ed66e1bc 740 );\r
7936fb6a 741\r
742/**\r
743 Push an Operand onto the Stack\r
744\r
745 @param Operand Operand to push.\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
753PushScope (\r
754 IN UINT8 Operand\r
ed66e1bc 755 );\r
7936fb6a 756\r
757/**\r
758 Pop an Operand from the Stack\r
759\r
760 @param Operand Operand to pop.\r
761\r
762 @retval EFI_SUCCESS The value was pushed onto the stack.\r
763 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
764 stack.\r
765\r
766**/\r
767EFI_STATUS\r
768PopScope (\r
769 OUT UINT8 *Operand\r
ed66e1bc 770 );\r
7936fb6a 771\r
2573712e
LG
772/**\r
773 Reset stack pointer to begin of the stack.\r
774\r
775**/\r
776VOID\r
777ResetCurrentExpressionStack (\r
778 VOID\r
779 );\r
780\r
781/**\r
782 Push current expression onto the Stack\r
783\r
784 @param Pointer Pointer to current expression.\r
785\r
786 @retval EFI_SUCCESS The value was pushed onto the stack.\r
787 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
788\r
789**/\r
790EFI_STATUS\r
791PushCurrentExpression (\r
792 IN VOID *Pointer\r
793 );\r
794\r
795/**\r
796 Pop current expression from the Stack\r
797\r
798 @param Pointer Pointer to current expression to be pop.\r
799\r
800 @retval EFI_SUCCESS The value was pushed onto the stack.\r
801 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
802\r
803**/\r
804EFI_STATUS\r
805PopCurrentExpression (\r
806 OUT VOID **Pointer\r
807 );\r
808\r
809/**\r
810 Reset stack pointer to begin of the stack.\r
811\r
812**/\r
813VOID\r
814ResetMapExpressionListStack (\r
815 VOID\r
816 );\r
817\r
818/**\r
819 Push the list of map expression onto the Stack\r
820\r
821 @param Pointer Pointer to the list of map expression to be pushed.\r
822\r
823 @retval EFI_SUCCESS The value was pushed onto the stack.\r
824 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
825\r
826**/\r
827EFI_STATUS\r
828PushMapExpressionList (\r
829 IN VOID *Pointer\r
830 );\r
831\r
832/**\r
833 Pop the list of map expression from the Stack\r
834\r
835 @param Pointer Pointer to the list of map expression to be pop.\r
836\r
837 @retval EFI_SUCCESS The value was pushed onto the stack.\r
838 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
839\r
840**/\r
841EFI_STATUS\r
842PopMapExpressionList (\r
843 OUT VOID **Pointer\r
844 );\r
845\r
7936fb6a 846/**\r
847 Get Form given its FormId.\r
848\r
849 @param FormSet The formset which contains this form.\r
850 @param FormId Id of this form.\r
851\r
852 @retval Pointer The form.\r
853 @retval NULL Specified Form is not found in the formset.\r
854\r
855**/\r
856FORM_BROWSER_FORM *\r
857IdToForm (\r
858 IN FORM_BROWSER_FORMSET *FormSet,\r
859 IN UINT16 FormId\r
ed66e1bc 860 );\r
7936fb6a 861\r
862/**\r
863 Search a Question in Formset scope using its QuestionId.\r
864\r
865 @param FormSet The formset which contains this form.\r
866 @param Form The form which contains this Question.\r
867 @param QuestionId Id of this Question.\r
868\r
869 @retval Pointer The Question.\r
870 @retval NULL Specified Question not found in the form.\r
871\r
872**/\r
873FORM_BROWSER_STATEMENT *\r
874IdToQuestion (\r
875 IN FORM_BROWSER_FORMSET *FormSet,\r
876 IN FORM_BROWSER_FORM *Form,\r
877 IN UINT16 QuestionId\r
ed66e1bc 878 );\r
7936fb6a 879\r
880/**\r
881 Zero extend integer/boolean/date/time to UINT64 for comparing.\r
882\r
883 @param Value HII Value to be converted.\r
884\r
885**/\r
886VOID\r
887ExtendValueToU64 (\r
888 IN EFI_HII_VALUE *Value\r
ed66e1bc 889 );\r
7936fb6a 890\r
891/**\r
892 Compare two Hii value.\r
893\r
894 @param Value1 Expression value to compare on left-hand.\r
895 @param Value2 Expression value to compare on right-hand.\r
896 @param HiiHandle Only required for string compare.\r
897\r
898 @retval EFI_INVALID_PARAMETER Could not perform comparation on two values.\r
899 @retval 0 Two operators equeal.\r
900 @return Positive value if Value1 is greater than Value2.\r
901 @retval Negative value if Value1 is less than Value2.\r
902\r
903**/\r
904INTN\r
905CompareHiiValue (\r
906 IN EFI_HII_VALUE *Value1,\r
907 IN EFI_HII_VALUE *Value2,\r
908 IN EFI_HII_HANDLE HiiHandle OPTIONAL\r
ed66e1bc 909 );\r
7936fb6a 910\r
911/**\r
912 Evaluate the result of a HII expression\r
913\r
3018ca2d 914 If Expression is NULL, then ASSERT.\r
915\r
7936fb6a 916 @param FormSet FormSet associated with this expression.\r
917 @param Form Form associated with this expression.\r
918 @param Expression Expression to be evaluated.\r
919\r
920 @retval EFI_SUCCESS The expression evaluated successfuly\r
921 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId\r
922 could not be found.\r
923 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
924 stack.\r
925 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack\r
926 @retval EFI_INVALID_PARAMETER Syntax error with the Expression\r
927\r
928**/\r
929EFI_STATUS\r
930EvaluateExpression (\r
931 IN FORM_BROWSER_FORMSET *FormSet,\r
932 IN FORM_BROWSER_FORM *Form,\r
933 IN OUT FORM_EXPRESSION *Expression\r
ed66e1bc 934 );\r
7936fb6a 935\r
936#endif // _UI_H\r