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