]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Base on the type field to get the width of value field for option opcode.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Ui.h
... / ...
CommitLineData
1/** @file\r
2Private structure, MACRO and function definitions for User Interface related functionalities.\r
3\r
4Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
5This 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//\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
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
34typedef enum {\r
35 UiNoOperation,\r
36 UiSelect,\r
37 UiUp,\r
38 UiDown,\r
39 UiLeft,\r
40 UiRight,\r
41 UiReset,\r
42 UiPrevious,\r
43 UiPageUp,\r
44 UiPageDown,\r
45 UiHotKey,\r
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
58 CfUiSelect,\r
59 CfUiReset,\r
60 CfUiLeft,\r
61 CfUiRight,\r
62 CfUiUp,\r
63 CfUiPageUp,\r
64 CfUiPageDown,\r
65 CfUiDown,\r
66 CfUiDefault,\r
67 CfUiNoOperation,\r
68 CfExit,\r
69 CfUiHotKey,\r
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
78typedef struct _UI_MENU_LIST UI_MENU_LIST;\r
79\r
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
89 UINTN Sequence; // used for time/date only.\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
111\r
112 //\r
113 // Whether the Form is editable\r
114 //\r
115 BOOLEAN FormEditable;\r
116\r
117 UI_MENU_LIST *CurrentMenu;\r
118} UI_MENU_SELECTION;\r
119\r
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
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
150\r
151 //\r
152 // Whether user could change value of this item\r
153 //\r
154 BOOLEAN IsQuestion;\r
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
159struct _UI_MENU_LIST {\r
160 UINTN Signature;\r
161 LIST_ENTRY Link;\r
162\r
163 EFI_HII_HANDLE HiiHandle;\r
164 EFI_GUID FormSetGuid;\r
165 UINT16 FormId;\r
166 UINT16 QuestionId;\r
167 UINTN Sequence; // used for time/date only.\r
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
174\r
175typedef struct _MENU_REFRESH_ENTRY MENU_REFRESH_ENTRY;\r
176struct _MENU_REFRESH_ENTRY {\r
177 MENU_REFRESH_ENTRY *Next;\r
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
183 EFI_EVENT Event;\r
184};\r
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
197extern LIST_ENTRY gMenuOption;\r
198extern MENU_REFRESH_ENTRY *gMenuRefreshHead;\r
199extern UI_MENU_SELECTION *gCurrentSelection;\r
200extern BOOLEAN mHiiPackageListUpdated;\r
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
212 );\r
213\r
214/**\r
215 Initialize Menu option list.\r
216\r
217**/\r
218VOID\r
219UiInitMenuList (\r
220 VOID\r
221 );\r
222\r
223/**\r
224 Free Menu option linked list.\r
225\r
226**/\r
227VOID\r
228UiFreeMenu (\r
229 VOID\r
230 );\r
231\r
232/**\r
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
237 @param HiiHandle Hii handle related to this formset.\r
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
242\r
243**/\r
244UI_MENU_LIST *\r
245UiAddMenuList (\r
246 IN OUT UI_MENU_LIST *Parent,\r
247 IN EFI_HII_HANDLE HiiHandle,\r
248 IN EFI_GUID *FormSetGuid,\r
249 IN UINT16 FormId\r
250 );\r
251\r
252/**\r
253 Search Menu with given FormId in the parent menu and all its child menus.\r
254\r
255 @param Parent The parent of menu to search.\r
256 @param FormSetGuid The Formset GUID of the menu to search. \r
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
260\r
261**/\r
262UI_MENU_LIST *\r
263UiFindChildMenuList (\r
264 IN UI_MENU_LIST *Parent,\r
265 IN EFI_GUID *FormSetGuid, \r
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
282 );\r
283\r
284/**\r
285 Free Menu option linked list.\r
286\r
287**/\r
288VOID\r
289UiFreeRefreshList (\r
290 VOID\r
291 );\r
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 Form The form this statement belong to.\r
299 @param Statement Statement of this Menu Option.\r
300 @param NumberOfLines Display lines for this Menu Option.\r
301 @param MenuItemCount The index for this Option in the Menu.\r
302\r
303 @retval Pointer Pointer to the added Menu Option.\r
304\r
305**/\r
306UI_MENU_OPTION *\r
307UiAddMenuOption (\r
308 IN CHAR16 *String,\r
309 IN EFI_HII_HANDLE Handle,\r
310 IN FORM_BROWSER_FORM *Form,\r
311 IN FORM_BROWSER_STATEMENT *Statement,\r
312 IN UINT16 NumberOfLines,\r
313 IN UINT16 MenuItemCount\r
314 );\r
315\r
316/**\r
317 Display menu and wait for user to select one menu option, then return it.\r
318 If AutoBoot is enabled, then if user doesn't select any option,\r
319 after period of time, it will automatically return the first menu option.\r
320\r
321 @param Selection Menu selection.\r
322\r
323 @return Return the pointer of the menu which selected,\r
324 @return otherwise return NULL.\r
325\r
326**/\r
327EFI_STATUS\r
328UiDisplayMenu (\r
329 IN OUT UI_MENU_SELECTION *Selection\r
330 );\r
331\r
332/**\r
333 Free up the resource allocated for all strings required\r
334 by Setup Browser.\r
335\r
336**/\r
337VOID\r
338FreeBrowserStrings (\r
339 VOID\r
340 );\r
341\r
342/**\r
343 Process the goto op code, update the info in the selection structure.\r
344\r
345 @param Statement The statement belong to goto op code.\r
346 @param Selection The selection info.\r
347 @param Repaint Whether need to repaint the menu.\r
348 @param NewLine Whether need to create new line.\r
349\r
350 @retval EFI_SUCCESS The menu process successfully.\r
351 @return Other value if the process failed.\r
352**/\r
353EFI_STATUS\r
354ProcessGotoOpCode (\r
355 IN OUT FORM_BROWSER_STATEMENT *Statement,\r
356 IN OUT UI_MENU_SELECTION *Selection,\r
357 OUT BOOLEAN *Repaint,\r
358 OUT BOOLEAN *NewLine\r
359 );\r
360\r
361\r
362/**\r
363 The worker function that send the displays to the screen. On output,\r
364 the selection made by user is returned.\r
365\r
366 @param Selection On input, Selection tell setup browser the information\r
367 about the Selection, form and formset to be displayed.\r
368 On output, Selection return the screen item that is selected\r
369 by user.\r
370\r
371 @retval EFI_SUCCESS The page is displayed successfully.\r
372 @return Other value if the page failed to be diplayed.\r
373\r
374**/\r
375EFI_STATUS\r
376SetupBrowser (\r
377 IN OUT UI_MENU_SELECTION *Selection\r
378 );\r
379\r
380/**\r
381 Set Buffer to Value for Size bytes.\r
382\r
383 @param Buffer Memory to set.\r
384 @param Size Number of bytes to set\r
385 @param Value Value of the set operation.\r
386\r
387**/\r
388VOID\r
389SetUnicodeMem (\r
390 IN VOID *Buffer,\r
391 IN UINTN Size,\r
392 IN CHAR16 Value\r
393 );\r
394\r
395/**\r
396 Wait for a given event to fire, or for an optional timeout to expire.\r
397\r
398 @param Event The event to wait for\r
399 @param Timeout An optional timeout value in 100 ns units.\r
400 @param RefreshInterval Menu refresh interval (in seconds).\r
401\r
402 @retval EFI_SUCCESS Event fired before Timeout expired.\r
403 @retval EFI_TIME_OUT Timout expired before Event fired.\r
404\r
405**/\r
406EFI_STATUS\r
407UiWaitForSingleEvent (\r
408 IN EFI_EVENT Event,\r
409 IN UINT64 Timeout, OPTIONAL\r
410 IN UINT8 RefreshInterval OPTIONAL\r
411 );\r
412\r
413/**\r
414 Draw a pop up windows based on the dimension, number of lines and\r
415 strings specified.\r
416\r
417 @param ScreenWidth The width of the pop-up.\r
418 @param NumberOfLines The number of lines.\r
419 @param ... A series of text strings that displayed in the pop-up.\r
420\r
421**/\r
422VOID\r
423EFIAPI\r
424CreateMultiStringPopUp (\r
425 IN UINTN ScreenWidth,\r
426 IN UINTN NumberOfLines,\r
427 ...\r
428 );\r
429\r
430/**\r
431 Get string or password input from user.\r
432\r
433 @param MenuOption Pointer to the current input menu.\r
434 @param Prompt The prompt string shown on popup window.\r
435 @param StringPtr Old user input and destination for use input string.\r
436\r
437 @retval EFI_SUCCESS If string input is read successfully\r
438 @retval EFI_DEVICE_ERROR If operation fails\r
439\r
440**/\r
441EFI_STATUS\r
442ReadString (\r
443 IN UI_MENU_OPTION *MenuOption,\r
444 IN CHAR16 *Prompt,\r
445 IN OUT CHAR16 *StringPtr\r
446 );\r
447\r
448/**\r
449 Get selection for OneOf and OrderedList (Left/Right will be ignored).\r
450\r
451 @param Selection Pointer to current selection.\r
452 @param MenuOption Pointer to the current input menu.\r
453\r
454 @retval EFI_SUCCESS If Option input is processed successfully\r
455 @retval EFI_DEVICE_ERROR If operation fails\r
456\r
457**/\r
458EFI_STATUS\r
459GetSelectionInputPopUp (\r
460 IN UI_MENU_SELECTION *Selection,\r
461 IN UI_MENU_OPTION *MenuOption\r
462 );\r
463\r
464/**\r
465 This routine reads a numeric value from the user input.\r
466\r
467 @param Selection Pointer to current selection.\r
468 @param MenuOption Pointer to the current input menu.\r
469\r
470 @retval EFI_SUCCESS If numerical input is read successfully\r
471 @retval EFI_DEVICE_ERROR If operation fails\r
472\r
473**/\r
474EFI_STATUS\r
475GetNumericInput (\r
476 IN UI_MENU_SELECTION *Selection,\r
477 IN UI_MENU_OPTION *MenuOption\r
478 );\r
479\r
480/**\r
481 Update status bar on the bottom of menu.\r
482\r
483 @param Selection Current selection info.\r
484 @param MessageType The type of message to be shown.\r
485 @param Flags The flags in Question header.\r
486 @param State Set or clear.\r
487\r
488**/\r
489VOID\r
490UpdateStatusBar (\r
491 IN UI_MENU_SELECTION *Selection,\r
492 IN UINTN MessageType,\r
493 IN UINT8 Flags,\r
494 IN BOOLEAN State\r
495 );\r
496\r
497/**\r
498 Process Question Config.\r
499\r
500 @param Selection The UI menu selection.\r
501 @param Question The Question to be peocessed.\r
502\r
503 @retval EFI_SUCCESS Question Config process success.\r
504 @retval Other Question Config process fail.\r
505\r
506**/\r
507EFI_STATUS\r
508ProcessQuestionConfig (\r
509 IN UI_MENU_SELECTION *Selection,\r
510 IN FORM_BROWSER_STATEMENT *Question\r
511 );\r
512\r
513/**\r
514 Print Question Value according to it's storage width and display attributes.\r
515\r
516 @param Question The Question to be printed.\r
517 @param FormattedNumber Buffer for output string.\r
518 @param BufferSize The FormattedNumber buffer size in bytes.\r
519\r
520 @retval EFI_SUCCESS Print success.\r
521 @retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.\r
522\r
523**/\r
524EFI_STATUS\r
525PrintFormattedNumber (\r
526 IN FORM_BROWSER_STATEMENT *Question,\r
527 IN OUT CHAR16 *FormattedNumber,\r
528 IN UINTN BufferSize\r
529 );\r
530\r
531/**\r
532 Search an Option of a Question by its value.\r
533\r
534 @param Question The Question\r
535 @param OptionValue Value for Option to be searched.\r
536\r
537 @retval Pointer Pointer to the found Option.\r
538 @retval NULL Option not found.\r
539\r
540**/\r
541QUESTION_OPTION *\r
542ValueToOption (\r
543 IN FORM_BROWSER_STATEMENT *Question,\r
544 IN EFI_HII_VALUE *OptionValue\r
545 );\r
546\r
547/**\r
548 Return data element in an Array by its Index.\r
549\r
550 @param Array The data array.\r
551 @param Type Type of the data in this array.\r
552 @param Index Zero based index for data in this array.\r
553\r
554 @retval Value The data to be returned\r
555\r
556**/\r
557UINT64\r
558GetArrayData (\r
559 IN VOID *Array,\r
560 IN UINT8 Type,\r
561 IN UINTN Index\r
562 );\r
563\r
564/**\r
565 Set value of a data element in an Array by its Index.\r
566\r
567 @param Array The data array.\r
568 @param Type Type of the data in this array.\r
569 @param Index Zero based index for data in this array.\r
570 @param Value The value to be set.\r
571\r
572**/\r
573VOID\r
574SetArrayData (\r
575 IN VOID *Array,\r
576 IN UINT8 Type,\r
577 IN UINTN Index,\r
578 IN UINT64 Value\r
579 );\r
580\r
581/**\r
582 Check whether this value already in the array, if yes, return the index.\r
583\r
584 @param Array The data array.\r
585 @param Type Type of the data in this array.\r
586 @param Value The value to be find.\r
587 @param Index The index in the array which has same value with Value.\r
588 \r
589 @retval TRUE Found the value in the array.\r
590 @retval FALSE Not found the value.\r
591\r
592**/\r
593BOOLEAN \r
594FindArrayData (\r
595 IN VOID *Array,\r
596 IN UINT8 Type,\r
597 IN UINT64 Value,\r
598 OUT UINTN *Index OPTIONAL\r
599 );\r
600\r
601/**\r
602 Process a Question's Option (whether selected or un-selected).\r
603\r
604 @param Selection Pointer to UI_MENU_SELECTION.\r
605 @param MenuOption The MenuOption for this Question.\r
606 @param Selected TRUE: if Question is selected.\r
607 @param OptionString Pointer of the Option String to be displayed.\r
608\r
609 @retval EFI_SUCCESS Question Option process success.\r
610 @retval Other Question Option process fail.\r
611\r
612**/\r
613EFI_STATUS\r
614ProcessOptions (\r
615 IN UI_MENU_SELECTION *Selection,\r
616 IN UI_MENU_OPTION *MenuOption,\r
617 IN BOOLEAN Selected,\r
618 OUT CHAR16 **OptionString\r
619 );\r
620\r
621/**\r
622 Process the help string: Split StringPtr to several lines of strings stored in\r
623 FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.\r
624\r
625 @param StringPtr The entire help string.\r
626 @param FormattedString The oupput formatted string.\r
627 @param EachLineWidth The string length of each line in the formatted string.\r
628 @param RowCount TRUE: if Question is selected.\r
629\r
630**/\r
631UINTN\r
632ProcessHelpString (\r
633 IN CHAR16 *StringPtr,\r
634 OUT CHAR16 **FormattedString,\r
635 OUT UINT16 *EachLineWidth,\r
636 IN UINTN RowCount\r
637 );\r
638\r
639/**\r
640 Update key's help imformation.\r
641\r
642 @param Selection Tell setup browser the information about the Selection\r
643 @param MenuOption The Menu option\r
644 @param Selected Whether or not a tag be selected\r
645\r
646**/\r
647VOID\r
648UpdateKeyHelp (\r
649 IN UI_MENU_SELECTION *Selection,\r
650 IN UI_MENU_OPTION *MenuOption,\r
651 IN BOOLEAN Selected\r
652 );\r
653\r
654/**\r
655 Clear retangle with specified text attribute.\r
656\r
657 @param LeftColumn Left column of retangle.\r
658 @param RightColumn Right column of retangle.\r
659 @param TopRow Start row of retangle.\r
660 @param BottomRow End row of retangle.\r
661 @param TextAttribute The character foreground and background.\r
662\r
663**/\r
664VOID\r
665ClearLines (\r
666 IN UINTN LeftColumn,\r
667 IN UINTN RightColumn,\r
668 IN UINTN TopRow,\r
669 IN UINTN BottomRow,\r
670 IN UINTN TextAttribute\r
671 );\r
672\r
673/**\r
674 Count the storage space of a Unicode string.\r
675\r
676 This function handles the Unicode string with NARROW_CHAR\r
677 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR\r
678 does not count in the resultant output. If a WIDE_CHAR is\r
679 hit, then 2 Unicode character will consume an output storage\r
680 space with size of CHAR16 till a NARROW_CHAR is hit.\r
681\r
682 If String is NULL, then ASSERT ().\r
683\r
684 @param String The input string to be counted.\r
685\r
686 @return Storage space for the input string.\r
687\r
688**/\r
689UINTN\r
690GetStringWidth (\r
691 IN CHAR16 *String\r
692 );\r
693\r
694/**\r
695 Will copy LineWidth amount of a string in the OutputString buffer and return the\r
696 number of CHAR16 characters that were copied into the OutputString buffer.\r
697 In the code, it deals \r,\n,\r\n same as \n\r, also it not process the \r or \g.\r
698\r
699 @param InputString String description for this option.\r
700 @param LineWidth Width of the desired string to extract in CHAR16\r
701 characters\r
702 @param GlyphWidth The glyph width of the beging char in the string.\r
703 @param Index Where in InputString to start the copy process\r
704 @param OutputString Buffer to copy the string into\r
705\r
706 @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
707\r
708**/\r
709UINT16\r
710GetLineByWidth (\r
711 IN CHAR16 *InputString,\r
712 IN UINT16 LineWidth,\r
713 IN OUT UINT16 *GlyphWidth,\r
714 IN OUT UINTN *Index,\r
715 OUT CHAR16 **OutputString\r
716 );\r
717\r
718/**\r
719 Get the supported width for a particular op-code\r
720\r
721 @param Statement The FORM_BROWSER_STATEMENT structure passed in.\r
722 @param Handle The handle in the HII database being used\r
723\r
724 @return Returns the number of CHAR16 characters that is support.\r
725\r
726**/\r
727UINT16\r
728GetWidth (\r
729 IN FORM_BROWSER_STATEMENT *Statement,\r
730 IN EFI_HII_HANDLE Handle\r
731 );\r
732\r
733/**\r
734 Concatenate a narrow string to another string.\r
735\r
736 @param Destination The destination string.\r
737 @param Source The source string. The string to be concatenated.\r
738 to the end of Destination.\r
739\r
740**/\r
741VOID\r
742NewStrCat (\r
743 IN OUT CHAR16 *Destination,\r
744 IN CHAR16 *Source\r
745 );\r
746\r
747/**\r
748 Wait for a key to be pressed by user.\r
749\r
750 @param Key The key which is pressed by user.\r
751\r
752 @retval EFI_SUCCESS The function always completed successfully.\r
753\r
754**/\r
755EFI_STATUS\r
756WaitForKeyStroke (\r
757 OUT EFI_INPUT_KEY *Key\r
758 );\r
759\r
760/**\r
761 Reset stack pointer to begin of the stack.\r
762\r
763**/\r
764VOID\r
765ResetScopeStack (\r
766 VOID\r
767 );\r
768\r
769/**\r
770 Push the expression options onto the Stack.\r
771\r
772 @param Pointer Pointer to the current expression.\r
773 @param Level Which type this expression belong to. Form, \r
774 statement or option?\r
775\r
776 @retval EFI_SUCCESS The value was pushed onto the stack.\r
777 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
778\r
779**/\r
780EFI_STATUS\r
781PushConditionalExpression (\r
782 IN FORM_EXPRESSION *Pointer,\r
783 IN EXPRESS_LEVEL Level\r
784 );\r
785\r
786/**\r
787 Pop the expression options from the Stack\r
788\r
789 @param Level Which type this expression belong to. Form, \r
790 statement or option?\r
791\r
792 @retval EFI_SUCCESS The value was pushed onto the stack.\r
793 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
794\r
795**/\r
796EFI_STATUS\r
797PopConditionalExpression (\r
798 IN EXPRESS_LEVEL Level\r
799 );\r
800 \r
801/**\r
802 Get the expression Buffer pointer.\r
803 \r
804 @param Level Which type this expression belong to. Form, \r
805 statement or option?\r
806\r
807 @retval The start pointer of the expression buffer or NULL.\r
808\r
809**/\r
810FORM_EXPRESSION **\r
811GetConditionalExpressionList (\r
812 IN EXPRESS_LEVEL Level\r
813 );\r
814\r
815/**\r
816 Get the expression list count.\r
817 \r
818 @param Level Which type this expression belong to. Form, \r
819 statement or option?\r
820\r
821 @retval >=0 The expression count\r
822 @retval -1 Input parameter error.\r
823\r
824**/\r
825INTN \r
826GetConditionalExpressionCount (\r
827 IN EXPRESS_LEVEL Level\r
828 );\r
829\r
830/**\r
831 Push an Operand onto the Stack\r
832\r
833 @param Operand Operand to push.\r
834\r
835 @retval EFI_SUCCESS The value was pushed onto the stack.\r
836 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
837 stack.\r
838\r
839**/\r
840EFI_STATUS\r
841PushScope (\r
842 IN UINT8 Operand\r
843 );\r
844\r
845/**\r
846 Pop an Operand from the Stack\r
847\r
848 @param Operand Operand to pop.\r
849\r
850 @retval EFI_SUCCESS The value was pushed onto the stack.\r
851 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
852 stack.\r
853\r
854**/\r
855EFI_STATUS\r
856PopScope (\r
857 OUT UINT8 *Operand\r
858 );\r
859\r
860/**\r
861 Reset stack pointer to begin of the stack.\r
862\r
863**/\r
864VOID\r
865ResetCurrentExpressionStack (\r
866 VOID\r
867 );\r
868\r
869/**\r
870 Push current expression onto the Stack\r
871\r
872 @param Pointer Pointer to current expression.\r
873\r
874 @retval EFI_SUCCESS The value was pushed onto the stack.\r
875 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
876\r
877**/\r
878EFI_STATUS\r
879PushCurrentExpression (\r
880 IN VOID *Pointer\r
881 );\r
882\r
883/**\r
884 Pop current expression from the Stack\r
885\r
886 @param Pointer Pointer to current expression to be pop.\r
887\r
888 @retval EFI_SUCCESS The value was pushed onto the stack.\r
889 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
890\r
891**/\r
892EFI_STATUS\r
893PopCurrentExpression (\r
894 OUT VOID **Pointer\r
895 );\r
896\r
897/**\r
898 Reset stack pointer to begin of the stack.\r
899\r
900**/\r
901VOID\r
902ResetMapExpressionListStack (\r
903 VOID\r
904 );\r
905\r
906/**\r
907 Push the list of map expression onto the Stack\r
908\r
909 @param Pointer Pointer to the list of map expression to be pushed.\r
910\r
911 @retval EFI_SUCCESS The value was pushed onto the stack.\r
912 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
913\r
914**/\r
915EFI_STATUS\r
916PushMapExpressionList (\r
917 IN VOID *Pointer\r
918 );\r
919\r
920/**\r
921 Pop the list of map expression from the Stack\r
922\r
923 @param Pointer Pointer to the list of map expression to be pop.\r
924\r
925 @retval EFI_SUCCESS The value was pushed onto the stack.\r
926 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
927\r
928**/\r
929EFI_STATUS\r
930PopMapExpressionList (\r
931 OUT VOID **Pointer\r
932 );\r
933\r
934/**\r
935 Get Form given its FormId.\r
936\r
937 @param FormSet The formset which contains this form.\r
938 @param FormId Id of this form.\r
939\r
940 @retval Pointer The form.\r
941 @retval NULL Specified Form is not found in the formset.\r
942\r
943**/\r
944FORM_BROWSER_FORM *\r
945IdToForm (\r
946 IN FORM_BROWSER_FORMSET *FormSet,\r
947 IN UINT16 FormId\r
948 );\r
949\r
950/**\r
951 Search a Question in Formset scope using its QuestionId.\r
952\r
953 @param FormSet The formset which contains this form.\r
954 @param Form The form which contains this Question.\r
955 @param QuestionId Id of this Question.\r
956\r
957 @retval Pointer The Question.\r
958 @retval NULL Specified Question not found in the form.\r
959\r
960**/\r
961FORM_BROWSER_STATEMENT *\r
962IdToQuestion (\r
963 IN FORM_BROWSER_FORMSET *FormSet,\r
964 IN FORM_BROWSER_FORM *Form,\r
965 IN UINT16 QuestionId\r
966 );\r
967\r
968/**\r
969 Zero extend integer/boolean/date/time to UINT64 for comparing.\r
970\r
971 @param Value HII Value to be converted.\r
972\r
973**/\r
974VOID\r
975ExtendValueToU64 (\r
976 IN EFI_HII_VALUE *Value\r
977 );\r
978\r
979/**\r
980 Compare two Hii value.\r
981\r
982 @param Value1 Expression value to compare on left-hand.\r
983 @param Value2 Expression value to compare on right-hand.\r
984 @param Result Return value after compare.\r
985 retval 0 Two operators equal.\r
986 return Positive value if Value1 is greater than Value2.\r
987 retval Negative value if Value1 is less than Value2.\r
988 @param HiiHandle Only required for string compare.\r
989\r
990 @retval other Could not perform compare on two values.\r
991 @retval EFI_SUCCESS Compare the value success.\r
992\r
993**/\r
994EFI_STATUS\r
995CompareHiiValue (\r
996 IN EFI_HII_VALUE *Value1,\r
997 IN EFI_HII_VALUE *Value2,\r
998 OUT INTN *Result,\r
999 IN EFI_HII_HANDLE HiiHandle OPTIONAL\r
1000 );\r
1001\r
1002/**\r
1003 Evaluate the result of a HII expression\r
1004\r
1005 If Expression is NULL, then ASSERT.\r
1006\r
1007 @param FormSet FormSet associated with this expression.\r
1008 @param Form Form associated with this expression.\r
1009 @param Expression Expression to be evaluated.\r
1010\r
1011 @retval EFI_SUCCESS The expression evaluated successfuly\r
1012 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId\r
1013 could not be found.\r
1014 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
1015 stack.\r
1016 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack\r
1017 @retval EFI_INVALID_PARAMETER Syntax error with the Expression\r
1018\r
1019**/\r
1020EFI_STATUS\r
1021EvaluateExpression (\r
1022 IN FORM_BROWSER_FORMSET *FormSet,\r
1023 IN FORM_BROWSER_FORM *Form,\r
1024 IN OUT FORM_EXPRESSION *Expression\r
1025 );\r
1026\r
1027/**\r
1028 Return the result of the expression list. Check the expression list and \r
1029 return the highest priority express result. \r
1030 Priority: DisableIf > SuppressIf > GrayOutIf > FALSE\r
1031\r
1032 @param ExpList The input expression list.\r
1033 @param Evaluate Whether need to evaluate the expression first.\r
1034 @param FormSet FormSet associated with this expression. Only \r
1035 needed when Evaluate is TRUE\r
1036 @param Form Form associated with this expression. Only \r
1037 needed when Evaluate is TRUE \r
1038\r
1039 @retval EXPRESS_RESULT Return the higher priority express result. \r
1040 DisableIf > SuppressIf > GrayOutIf > FALSE\r
1041\r
1042**/\r
1043EXPRESS_RESULT \r
1044EvaluateExpressionList (\r
1045 IN FORM_EXPRESSION_LIST *ExpList,\r
1046 IN BOOLEAN Evaluate,\r
1047 IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL\r
1048 IN FORM_BROWSER_FORM *Form OPTIONAL\r
1049 );\r
1050\r
1051/**\r
1052 Transfer the device path string to binary format.\r
1053\r
1054 @param StringPtr The device path string info.\r
1055\r
1056 @retval Device path binary info.\r
1057\r
1058**/\r
1059EFI_DEVICE_PATH_PROTOCOL *\r
1060ConvertDevicePathFromText (\r
1061 IN CHAR16 *StringPtr\r
1062 );\r
1063\r
1064#endif // _UI_H\r