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