2 Entry and initialization module for the browser.
4 Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "FormDisplay.h"
18 // Search table for UiDisplayMenu()
20 SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation
[] = {
51 UINTN mScanCodeNumber
= sizeof (gScanCodeToOperation
) / sizeof (gScanCodeToOperation
[0]);
53 SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag
[] = {
96 EFI_GUID gDisplayEngineGuid
= {
97 0xE38C1029, 0xE38F, 0x45b9, {0x8F, 0x0D, 0xE2, 0xE6, 0x0B, 0xC9, 0xB2, 0x62}
100 FORM_ENTRY_INFO gFormEntryInfo
;
102 EFI_SCREEN_DESCRIPTOR gStatementDimensions
;
103 BOOLEAN mStatementLayoutIsChanged
= TRUE
;
104 USER_INPUT
*gUserInput
;
105 FORM_DISPLAY_ENGINE_FORM
*gFormData
;
106 EFI_HII_HANDLE gHiiHandle
;
108 LIST_ENTRY gMenuOption
;
109 DISPLAY_HIGHLIGHT_MENU_INFO gHighligthMenuInfo
= {0};
110 BOOLEAN mIsFirstForm
= TRUE
;
111 FORM_ENTRY_INFO gOldFormEntry
= {0};
114 // Browser Global Strings
116 CHAR16
*gFormNotFound
;
118 CHAR16
*gBrwoserError
;
120 CHAR16
*gPromptForData
;
121 CHAR16
*gPromptForPassword
;
122 CHAR16
*gPromptForNewPassword
;
123 CHAR16
*gConfirmPassword
;
124 CHAR16
*gConfirmError
;
125 CHAR16
*gPassowordInvalid
;
127 CHAR16
*gEmptyString
;
129 CHAR16
*gOptionMismatch
;
130 CHAR16
*gFormSuppress
;
131 CHAR16
*gProtocolNotFound
;
133 CHAR16 gModalSkipColumn
;
134 CHAR16 gPromptBlockWidth
;
135 CHAR16 gOptionBlockWidth
;
136 CHAR16 gHelpBlockWidth
;
137 CHAR16
*mUnknownString
;
139 FORM_DISPLAY_DRIVER_PRIVATE_DATA mPrivateData
= {
140 FORM_DISPLAY_DRIVER_SIGNATURE
,
144 DriverClearDisplayPage
,
151 Get the string based on the StringId and HII Package List Handle.
153 @param Token The String's ID.
154 @param HiiHandle The package list in the HII database to search for
155 the specified string.
157 @return The output string.
162 IN EFI_STRING_ID Token
,
163 IN EFI_HII_HANDLE HiiHandle
168 String
= HiiGetString (HiiHandle
, Token
, NULL
);
169 if (String
== NULL
) {
170 String
= AllocateCopyPool (StrSize (mUnknownString
), mUnknownString
);
171 ASSERT (String
!= NULL
);
174 return (CHAR16
*) String
;
179 Initialize the HII String Token to the correct values.
183 InitializeDisplayStrings (
187 mUnknownString
= GetToken (STRING_TOKEN (UNKNOWN_STRING
), gHiiHandle
);
188 gSaveFailed
= GetToken (STRING_TOKEN (SAVE_FAILED
), gHiiHandle
);
189 gPromptForData
= GetToken (STRING_TOKEN (PROMPT_FOR_DATA
), gHiiHandle
);
190 gPromptForPassword
= GetToken (STRING_TOKEN (PROMPT_FOR_PASSWORD
), gHiiHandle
);
191 gPromptForNewPassword
= GetToken (STRING_TOKEN (PROMPT_FOR_NEW_PASSWORD
), gHiiHandle
);
192 gConfirmPassword
= GetToken (STRING_TOKEN (CONFIRM_PASSWORD
), gHiiHandle
);
193 gConfirmError
= GetToken (STRING_TOKEN (CONFIRM_ERROR
), gHiiHandle
);
194 gPassowordInvalid
= GetToken (STRING_TOKEN (PASSWORD_INVALID
), gHiiHandle
);
195 gPressEnter
= GetToken (STRING_TOKEN (PRESS_ENTER
), gHiiHandle
);
196 gEmptyString
= GetToken (STRING_TOKEN (EMPTY_STRING
), gHiiHandle
);
197 gMiniString
= GetToken (STRING_TOKEN (MINI_STRING
), gHiiHandle
);
198 gOptionMismatch
= GetToken (STRING_TOKEN (OPTION_MISMATCH
), gHiiHandle
);
199 gFormSuppress
= GetToken (STRING_TOKEN (FORM_SUPPRESSED
), gHiiHandle
);
200 gProtocolNotFound
= GetToken (STRING_TOKEN (PROTOCOL_NOT_FOUND
), gHiiHandle
);
201 gFormNotFound
= GetToken (STRING_TOKEN (STATUS_BROWSER_FORM_NOT_FOUND
), gHiiHandle
);
202 gNoSubmitIf
= GetToken (STRING_TOKEN (STATUS_BROWSER_NO_SUBMIT_IF
), gHiiHandle
);
203 gBrwoserError
= GetToken (STRING_TOKEN (STATUS_BROWSER_ERROR
), gHiiHandle
);
207 Free up the resource allocated for all strings required
216 FreePool (mUnknownString
);
217 FreePool (gEmptyString
);
218 FreePool (gSaveFailed
);
219 FreePool (gPromptForData
);
220 FreePool (gPromptForPassword
);
221 FreePool (gPromptForNewPassword
);
222 FreePool (gConfirmPassword
);
223 FreePool (gConfirmError
);
224 FreePool (gPassowordInvalid
);
225 FreePool (gPressEnter
);
226 FreePool (gMiniString
);
227 FreePool (gOptionMismatch
);
228 FreePool (gFormSuppress
);
229 FreePool (gProtocolNotFound
);
230 FreePool (gBrwoserError
);
231 FreePool (gNoSubmitIf
);
232 FreePool (gFormNotFound
);
236 Get prompt string id from the opcode data buffer.
238 @param OpCode The input opcode buffer.
240 @return The prompt string id.
245 IN EFI_IFR_OP_HEADER
*OpCode
248 EFI_IFR_STATEMENT_HEADER
*Header
;
250 if (OpCode
->Length
<= sizeof (EFI_IFR_OP_HEADER
)) {
254 Header
= (EFI_IFR_STATEMENT_HEADER
*) (OpCode
+ 1);
256 return Header
->Prompt
;
260 Get the supported width for a particular op-code
262 @param MenuOption The menu option.
263 @param AdjustWidth The width which is saved for the space.
265 @return Returns the number of CHAR16 characters that is support.
270 IN UI_MENU_OPTION
*MenuOption
,
271 OUT UINT16
*AdjustWidth
276 EFI_IFR_TEXT
*TestOp
;
278 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
280 Statement
= MenuOption
->ThisTag
;
283 // For modal form, clean the entire row.
285 if ((gFormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
286 if (AdjustWidth
!= NULL
) {
287 *AdjustWidth
= LEFT_SKIPPED_COLUMNS
;
289 return (UINT16
)(gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
- 2 * (gModalSkipColumn
+ LEFT_SKIPPED_COLUMNS
));
295 // See if the second text parameter is really NULL
297 if (Statement
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) {
298 TestOp
= (EFI_IFR_TEXT
*) Statement
->OpCode
;
299 if (TestOp
->TextTwo
!= 0) {
300 String
= GetToken (TestOp
->TextTwo
, gFormData
->HiiHandle
);
301 Size
= StrLen (String
);
306 if ((Statement
->OpCode
->OpCode
== EFI_IFR_SUBTITLE_OP
) ||
307 (Statement
->OpCode
->OpCode
== EFI_IFR_REF_OP
) ||
308 (Statement
->OpCode
->OpCode
== EFI_IFR_PASSWORD_OP
) ||
309 (Statement
->OpCode
->OpCode
== EFI_IFR_ACTION_OP
) ||
310 (Statement
->OpCode
->OpCode
== EFI_IFR_RESET_BUTTON_OP
) ||
312 // Allow a wide display if text op-code and no secondary text op-code
314 ((Statement
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) && (Size
== 0))
318 // Return the space width.
320 if (AdjustWidth
!= NULL
) {
324 // Keep consistent with current behavior.
326 ReturnWidth
= (UINT16
) (gPromptBlockWidth
+ gOptionBlockWidth
- 2);
328 if (AdjustWidth
!= NULL
) {
332 ReturnWidth
= (UINT16
) (gPromptBlockWidth
- 1);
336 // For nest in statement, should the subtitle indent.
338 if (MenuOption
->NestInStatement
) {
339 ReturnWidth
-= SUBTITLE_INDENT
;
346 Will copy LineWidth amount of a string in the OutputString buffer and return the
347 number of CHAR16 characters that were copied into the OutputString buffer.
348 The output string format is:
349 Glyph Info + String info + '\0'.
351 In the code, it deals \r,\n,\r\n same as \n\r, also it not process the \r or \g.
353 @param InputString String description for this option.
354 @param LineWidth Width of the desired string to extract in CHAR16
356 @param GlyphWidth The glyph width of the begin of the char in the string.
357 @param Index Where in InputString to start the copy process
358 @param OutputString Buffer to copy the string into
360 @return Returns the number of CHAR16 characters that were copied into the OutputString
361 buffer, include extra glyph info and '\0' info.
366 IN CHAR16
*InputString
,
368 IN OUT UINT16
*GlyphWidth
,
370 OUT CHAR16
**OutputString
375 UINT16 OriginalGlyphWidth
;
377 UINT16 LastSpaceOffset
;
378 UINT16 LastGlyphWidth
;
380 if (InputString
== NULL
|| Index
== NULL
|| OutputString
== NULL
) {
384 if (LineWidth
== 0 || *GlyphWidth
== 0) {
389 // Save original glyph width.
391 OriginalGlyphWidth
= *GlyphWidth
;
392 LastGlyphWidth
= OriginalGlyphWidth
;
397 // NARROW_CHAR can not be printed in screen, so if a line only contain the two CHARs: 'NARROW_CHAR + CHAR_CARRIAGE_RETURN' , it is a empty line in Screen.
398 // To avoid displaying this empty line in screen, just skip the two CHARs here.
400 if ((InputString
[*Index
] == NARROW_CHAR
) && (InputString
[*Index
+ 1] == CHAR_CARRIAGE_RETURN
)) {
405 // Fast-forward the string and see if there is a carriage-return in the string
407 for (StrOffset
= 0, GlyphOffset
= 0; GlyphOffset
<= LineWidth
; StrOffset
++) {
408 switch (InputString
[*Index
+ StrOffset
]) {
417 case CHAR_CARRIAGE_RETURN
:
424 GlyphOffset
= GlyphOffset
+ *GlyphWidth
;
427 // Record the last space info in this line. Will be used in rewind.
429 if ((InputString
[*Index
+ StrOffset
] == CHAR_SPACE
) && (GlyphOffset
<= LineWidth
)) {
430 LastSpaceOffset
= StrOffset
;
431 LastGlyphWidth
= *GlyphWidth
;
442 // Rewind the string from the maximum size until we see a space to break the line
444 if (GlyphOffset
> LineWidth
) {
446 // Rewind the string to last space char in this line.
448 if (LastSpaceOffset
!= 0) {
449 StrOffset
= LastSpaceOffset
;
450 *GlyphWidth
= LastGlyphWidth
;
453 // Roll back to last char in the line width.
460 // The CHAR_NULL has process last time, this time just return 0 to stand for the end.
462 if (StrOffset
== 0 && (InputString
[*Index
+ StrOffset
] == CHAR_NULL
)) {
467 // Need extra glyph info and '\0' info, so +2.
469 *OutputString
= AllocateZeroPool (((UINTN
) (StrOffset
+ 2) * sizeof(CHAR16
)));
470 if (*OutputString
== NULL
) {
475 // Save the glyph info at the begin of the string, will used by Print function.
477 if (OriginalGlyphWidth
== 1) {
478 *(*OutputString
) = NARROW_CHAR
;
480 *(*OutputString
) = WIDE_CHAR
;
483 CopyMem ((*OutputString
) + 1, &InputString
[*Index
], StrOffset
* sizeof(CHAR16
));
485 if (InputString
[*Index
+ StrOffset
] == CHAR_SPACE
) {
487 // Skip the space info at the begin of next line.
489 *Index
= (UINT16
) (*Index
+ StrOffset
+ 1);
490 } else if (InputString
[*Index
+ StrOffset
] == CHAR_LINEFEED
) {
492 // Skip the /n or /n/r info.
494 if (InputString
[*Index
+ StrOffset
+ 1] == CHAR_CARRIAGE_RETURN
) {
495 *Index
= (UINT16
) (*Index
+ StrOffset
+ 2);
497 *Index
= (UINT16
) (*Index
+ StrOffset
+ 1);
499 } else if (InputString
[*Index
+ StrOffset
] == CHAR_CARRIAGE_RETURN
) {
501 // Skip the /r or /r/n info.
503 if (InputString
[*Index
+ StrOffset
+ 1] == CHAR_LINEFEED
) {
504 *Index
= (UINT16
) (*Index
+ StrOffset
+ 2);
506 *Index
= (UINT16
) (*Index
+ StrOffset
+ 1);
509 *Index
= (UINT16
) (*Index
+ StrOffset
);
513 // Include extra glyph info and '\0' info, so +2.
515 return StrOffset
+ 2;
519 Add one menu option by specified description and context.
521 @param Statement Statement of this Menu Option.
522 @param MenuItemCount The index for this Option in the Menu.
523 @param NestIn Whether this statement is nest in another statement.
528 IN FORM_DISPLAY_ENGINE_STATEMENT
*Statement
,
529 IN UINT16
*MenuItemCount
,
533 UI_MENU_OPTION
*MenuOption
;
537 UINT16 NumberOfLines
;
541 CHAR16
*OutputString
;
542 EFI_STRING_ID PromptId
;
550 PromptId
= GetPrompt (Statement
->OpCode
);
551 ASSERT (PromptId
!= 0);
553 String
= GetToken (PromptId
, gFormData
->HiiHandle
);
554 ASSERT (String
!= NULL
);
556 if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
|| Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
560 for (Index
= 0; Index
< Count
; Index
++) {
561 MenuOption
= AllocateZeroPool (sizeof (UI_MENU_OPTION
));
564 MenuOption
->Signature
= UI_MENU_OPTION_SIGNATURE
;
565 MenuOption
->Description
= String
;
566 MenuOption
->Handle
= gFormData
->HiiHandle
;
567 MenuOption
->ThisTag
= Statement
;
568 MenuOption
->NestInStatement
= NestIn
;
569 MenuOption
->EntryNumber
= *MenuItemCount
;
571 MenuOption
->Sequence
= Index
;
573 if ((Statement
->Attribute
& HII_DISPLAY_GRAYOUT
) != 0) {
574 MenuOption
->GrayOut
= TRUE
;
576 MenuOption
->GrayOut
= FALSE
;
579 if ((Statement
->Attribute
& HII_DISPLAY_LOCK
) != 0 || (gFormData
->Attribute
& HII_DISPLAY_LOCK
) != 0) {
580 MenuOption
->GrayOut
= TRUE
;
584 // If the form or the question has the lock attribute, deal same as grayout.
586 if ((gFormData
->Attribute
& HII_DISPLAY_LOCK
) != 0 || (Statement
->Attribute
& HII_DISPLAY_LOCK
) != 0) {
587 MenuOption
->GrayOut
= TRUE
;
590 switch (Statement
->OpCode
->OpCode
) {
591 case EFI_IFR_ORDERED_LIST_OP
:
592 case EFI_IFR_ONE_OF_OP
:
593 case EFI_IFR_NUMERIC_OP
:
594 case EFI_IFR_TIME_OP
:
595 case EFI_IFR_DATE_OP
:
596 case EFI_IFR_CHECKBOX_OP
:
597 case EFI_IFR_PASSWORD_OP
:
598 case EFI_IFR_STRING_OP
:
600 // User could change the value of these items
602 MenuOption
->IsQuestion
= TRUE
;
604 case EFI_IFR_TEXT_OP
:
605 if (FeaturePcdGet (PcdBrowserGrayOutTextStatement
)) {
607 // Initializing GrayOut option as TRUE for Text setup options
608 // so that those options will be Gray in colour and un selectable.
610 MenuOption
->GrayOut
= TRUE
;
614 MenuOption
->IsQuestion
= FALSE
;
618 if ((Statement
->Attribute
& HII_DISPLAY_READONLY
) != 0) {
619 MenuOption
->ReadOnly
= TRUE
;
620 if (FeaturePcdGet (PcdBrowerGrayOutReadOnlyMenu
)) {
621 MenuOption
->GrayOut
= TRUE
;
626 (Statement
->OpCode
->OpCode
!= EFI_IFR_DATE_OP
) &&
627 (Statement
->OpCode
->OpCode
!= EFI_IFR_TIME_OP
)) {
628 Width
= GetWidth (MenuOption
, NULL
);
629 for (; GetLineByWidth (String
, Width
, &GlyphWidth
,&ArrayEntry
, &OutputString
) != 0x0000;) {
631 // If there is more string to process print on the next row and increment the Skip value
633 if (StrLen (&String
[ArrayEntry
]) != 0) {
636 FreePool (OutputString
);
640 // Add three MenuOptions for Date/Time
641 // Data format : [01/02/2004] [11:22:33]
642 // Line number : 0 0 1 0 0 1
649 // Override LineNumber for the MenuOption in Date/Time sequence
651 MenuOption
->Skip
= 1;
653 MenuOption
->Skip
= NumberOfLines
;
656 InsertTailList (&gMenuOption
, &MenuOption
->Link
);
663 Create the menu list base on the form data info.
667 ConvertStatementToMenu (
671 UINT16 MenuItemCount
;
673 LIST_ENTRY
*NestLink
;
674 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
675 FORM_DISPLAY_ENGINE_STATEMENT
*NestStatement
;
678 InitializeListHead (&gMenuOption
);
680 Link
= GetFirstNode (&gFormData
->StatementListHead
);
681 while (!IsNull (&gFormData
->StatementListHead
, Link
)) {
682 Statement
= FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (Link
);
683 Link
= GetNextNode (&gFormData
->StatementListHead
, Link
);
686 // Skip the opcode not recognized by Display core.
688 if (Statement
->OpCode
->OpCode
== EFI_IFR_GUID_OP
) {
692 UiAddMenuOption (Statement
, &MenuItemCount
, FALSE
);
695 // Check the statement nest in this host statement.
697 NestLink
= GetFirstNode (&Statement
->NestStatementList
);
698 while (!IsNull (&Statement
->NestStatementList
, NestLink
)) {
699 NestStatement
= FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (NestLink
);
700 NestLink
= GetNextNode (&Statement
->NestStatementList
, NestLink
);
702 UiAddMenuOption (NestStatement
, &MenuItemCount
, TRUE
);
708 Count the storage space of a Unicode string.
710 This function handles the Unicode string with NARROW_CHAR
711 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
712 does not count in the resultant output. If a WIDE_CHAR is
713 hit, then 2 Unicode character will consume an output storage
714 space with size of CHAR16 till a NARROW_CHAR is hit.
716 If String is NULL, then ASSERT ().
718 @param String The input string to be counted.
720 @return Storage space for the input string.
730 UINTN IncrementValue
;
732 ASSERT (String
!= NULL
);
733 if (String
== NULL
) {
743 // Advance to the null-terminator or to the first width directive
746 (String
[Index
] != NARROW_CHAR
) && (String
[Index
] != WIDE_CHAR
) && (String
[Index
] != 0);
747 Index
++, Count
= Count
+ IncrementValue
752 // We hit the null-terminator, we now have a count
754 if (String
[Index
] == 0) {
758 // We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
759 // and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
761 if (String
[Index
] == NARROW_CHAR
) {
763 // Skip to the next character
769 // Skip to the next character
774 } while (String
[Index
] != 0);
777 // Increment by one to include the null-terminator in the size
781 return Count
* sizeof (CHAR16
);
785 Base on the input option string to update the skip value for a menu option.
787 @param MenuOption The MenuOption to be checked.
788 @param OptionString The input option string.
792 UpdateSkipInfoForMenu (
793 IN UI_MENU_OPTION
*MenuOption
,
794 IN CHAR16
*OptionString
800 CHAR16
*OutputString
;
803 Width
= (UINT16
) gOptionBlockWidth
;
807 for (Index
= 0; GetLineByWidth (OptionString
, Width
, &GlyphWidth
, &Index
, &OutputString
) != 0x0000;) {
808 if (StrLen (&OptionString
[Index
]) != 0) {
812 FreePool (OutputString
);
815 if ((Row
> MenuOption
->Skip
) &&
816 (MenuOption
->ThisTag
->OpCode
->OpCode
!= EFI_IFR_DATE_OP
) &&
817 (MenuOption
->ThisTag
->OpCode
->OpCode
!= EFI_IFR_TIME_OP
)) {
818 MenuOption
->Skip
= Row
;
823 Update display lines for a Menu Option.
825 @param MenuOption The MenuOption to be checked.
829 UpdateOptionSkipLines (
830 IN UI_MENU_OPTION
*MenuOption
833 CHAR16
*OptionString
;
837 ProcessOptions (MenuOption
, FALSE
, &OptionString
, TRUE
);
838 if (OptionString
!= NULL
) {
839 UpdateSkipInfoForMenu (MenuOption
, OptionString
);
841 FreePool (OptionString
);
844 if ((MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) && (((EFI_IFR_TEXT
*)MenuOption
->ThisTag
->OpCode
)->TextTwo
!= 0)) {
845 OptionString
= GetToken (((EFI_IFR_TEXT
*)MenuOption
->ThisTag
->OpCode
)->TextTwo
, gFormData
->HiiHandle
);
847 if (OptionString
!= NULL
) {
848 UpdateSkipInfoForMenu (MenuOption
, OptionString
);
850 FreePool (OptionString
);
856 Check whether this Menu Option could be print.
858 Check Prompt string, option string or text two string not NULL.
860 This is an internal function.
862 @param MenuOption The MenuOption to be checked.
864 @retval TRUE This Menu Option is printable.
865 @retval FALSE This Menu Option could not be printable.
870 UI_MENU_OPTION
*MenuOption
874 EFI_STRING OptionString
;
878 if (MenuOption
->Description
[0] != '\0') {
882 Status
= ProcessOptions (MenuOption
, FALSE
, &OptionString
, FALSE
);
883 if (EFI_ERROR (Status
)) {
886 if (OptionString
!= NULL
&& OptionString
[0] != '\0') {
887 FreePool (OptionString
);
891 if ((MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) && (((EFI_IFR_TEXT
*)MenuOption
->ThisTag
->OpCode
)->TextTwo
!= 0)) {
892 OptionString
= GetToken (((EFI_IFR_TEXT
*)MenuOption
->ThisTag
->OpCode
)->TextTwo
, gFormData
->HiiHandle
);
893 ASSERT (OptionString
!= NULL
);
894 if (OptionString
[0] != '\0'){
895 FreePool (OptionString
);
904 Check whether this Menu Option could be highlighted.
906 This is an internal function.
908 @param MenuOption The MenuOption to be checked.
910 @retval TRUE This Menu Option is selectable.
911 @retval FALSE This Menu Option could not be selected.
916 UI_MENU_OPTION
*MenuOption
919 if ((MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_SUBTITLE_OP
) ||
920 MenuOption
->GrayOut
|| MenuOption
->ReadOnly
|| !PrintableMenu (MenuOption
)) {
928 Move to next selectable statement.
930 This is an internal function.
932 @param GoUp The navigation direction. TRUE: up, FALSE: down.
933 @param CurrentPosition Current position.
934 @param GapToTop Gap position to top or bottom.
935 @param FindInForm Whether find menu in current form or beyond.
937 @return The row distance from current MenuOption to next selectable MenuOption.
939 @retval -1 Reach the begin of the menu, still can't find the selectable menu.
940 @retval Value Find the selectable menu, maybe the truly selectable, maybe the
941 first menu showing beyond current form or last menu showing in
943 The value is the line number between the new selected menu and the
944 current select menu, not include the new selected menu.
948 MoveToNextStatement (
950 IN OUT LIST_ENTRY
**CurrentPosition
,
952 IN BOOLEAN FindInForm
957 UI_MENU_OPTION
*NextMenuOption
;
958 UI_MENU_OPTION
*PreMenuOption
;
961 Pos
= *CurrentPosition
;
963 if (Pos
== &gMenuOption
) {
967 PreMenuOption
= MENU_OPTION_FROM_LINK (Pos
);
970 NextMenuOption
= MENU_OPTION_FROM_LINK (Pos
);
972 // NextMenuOption->Row == 0 means this menu has not calculate
973 // the NextMenuOption->Skip value yet, just calculate here.
975 if (NextMenuOption
->Row
== 0) {
976 UpdateOptionSkipLines (NextMenuOption
);
979 if (IsSelectable (NextMenuOption
)) {
984 // In this case, still can't find the selectable menu,
985 // return the first one beyond the showing form.
987 if ((UINTN
) Distance
+ NextMenuOption
->Skip
> GapToTop
) {
989 NextMenuOption
= PreMenuOption
;
994 Distance
+= NextMenuOption
->Skip
;
997 // Arrive at begin of the menu list.
999 if ((GoUp
? Pos
->BackLink
: Pos
->ForwardLink
) == &gMenuOption
) {
1004 Pos
= (GoUp
? Pos
->BackLink
: Pos
->ForwardLink
);
1005 PreMenuOption
= NextMenuOption
;
1008 *CurrentPosition
= &NextMenuOption
->Link
;
1014 Process option string for date/time opcode.
1016 @param MenuOption Menu option point to date/time.
1017 @param OptionString Option string input for process.
1018 @param AddOptCol Whether need to update MenuOption->OptCol.
1022 ProcessStringForDateTime (
1023 UI_MENU_OPTION
*MenuOption
,
1024 CHAR16
*OptionString
,
1030 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
1034 ASSERT (MenuOption
!= NULL
&& OptionString
!= NULL
);
1036 Statement
= MenuOption
->ThisTag
;
1039 if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
1040 Date
= (EFI_IFR_DATE
*) Statement
->OpCode
;
1041 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
1042 Time
= (EFI_IFR_TIME
*) Statement
->OpCode
;
1046 // If leading spaces on OptionString - remove the spaces
1048 for (Index
= 0; OptionString
[Index
] == L
' '; Index
++) {
1050 // Base on the blockspace to get the option column info.
1053 MenuOption
->OptCol
++;
1057 for (Count
= 0; OptionString
[Index
] != CHAR_NULL
; Index
++) {
1058 OptionString
[Count
] = OptionString
[Index
];
1061 OptionString
[Count
] = CHAR_NULL
;
1064 // Enable to suppress field in the opcode base on the flag.
1066 if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
1068 // OptionString format is: <**: **: ****>
1072 if ((Date
->Flags
& EFI_QF_DATE_MONTH_SUPPRESS
) && (MenuOption
->Sequence
== 0)) {
1074 // At this point, only "<**:" in the optionstring.
1075 // Clean the day's ** field, after clean, the format is "< :"
1077 SetUnicodeMem (&OptionString
[1], 2, L
' ');
1078 } else if ((Date
->Flags
& EFI_QF_DATE_DAY_SUPPRESS
) && (MenuOption
->Sequence
== 1)) {
1080 // At this point, only "**:" in the optionstring.
1081 // Clean the month's "**" field, after clean, the format is " :"
1083 SetUnicodeMem (&OptionString
[0], 2, L
' ');
1084 } else if ((Date
->Flags
& EFI_QF_DATE_YEAR_SUPPRESS
) && (MenuOption
->Sequence
== 2)) {
1086 // At this point, only "****>" in the optionstring.
1087 // Clean the year's "****" field, after clean, the format is " >"
1089 SetUnicodeMem (&OptionString
[0], 4, L
' ');
1091 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
1093 // OptionString format is: <**: **: **>
1094 // |hour|minute|second|
1097 if ((Time
->Flags
& QF_TIME_HOUR_SUPPRESS
) && (MenuOption
->Sequence
== 0)) {
1099 // At this point, only "<**:" in the optionstring.
1100 // Clean the hour's ** field, after clean, the format is "< :"
1102 SetUnicodeMem (&OptionString
[1], 2, L
' ');
1103 } else if ((Time
->Flags
& QF_TIME_MINUTE_SUPPRESS
) && (MenuOption
->Sequence
== 1)) {
1105 // At this point, only "**:" in the optionstring.
1106 // Clean the minute's "**" field, after clean, the format is " :"
1108 SetUnicodeMem (&OptionString
[0], 2, L
' ');
1109 } else if ((Time
->Flags
& QF_TIME_SECOND_SUPPRESS
) && (MenuOption
->Sequence
== 2)) {
1111 // At this point, only "**>" in the optionstring.
1112 // Clean the second's "**" field, after clean, the format is " >"
1114 SetUnicodeMem (&OptionString
[0], 2, L
' ');
1121 Adjust Data and Time position accordingly.
1122 Data format : [01/02/2004] [11:22:33]
1123 Line number : 0 0 1 0 0 1
1125 This is an internal function.
1127 @param DirectionUp the up or down direction. False is down. True is
1129 @param CurrentPosition Current position. On return: Point to the last
1130 Option (Year or Second) if up; Point to the first
1131 Option (Month or Hour) if down.
1133 @return Return line number to pad. It is possible that we stand on a zero-advance
1134 @return data or time opcode, so pad one line when we judge if we are going to scroll outside.
1138 AdjustDateAndTimePosition (
1139 IN BOOLEAN DirectionUp
,
1140 IN OUT LIST_ENTRY
**CurrentPosition
1144 LIST_ENTRY
*NewPosition
;
1145 UI_MENU_OPTION
*MenuOption
;
1146 UINTN PadLineNumber
;
1149 NewPosition
= *CurrentPosition
;
1150 MenuOption
= MENU_OPTION_FROM_LINK (NewPosition
);
1152 if ((MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) ||
1153 (MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
1155 // Calculate the distance from current position to the last Date/Time MenuOption
1158 while (MenuOption
->Skip
== 0) {
1160 NewPosition
= NewPosition
->ForwardLink
;
1161 MenuOption
= MENU_OPTION_FROM_LINK (NewPosition
);
1165 NewPosition
= *CurrentPosition
;
1168 // Since the behavior of hitting the up arrow on a Date/Time MenuOption is intended
1169 // to be one that back to the previous set of MenuOptions, we need to advance to the first
1170 // Date/Time MenuOption and leave the remaining logic in CfUiUp intact so the appropriate
1171 // checking can be done.
1173 while (Count
++ < 2) {
1174 NewPosition
= NewPosition
->BackLink
;
1178 // Since the behavior of hitting the down arrow on a Date/Time MenuOption is intended
1179 // to be one that progresses to the next set of MenuOptions, we need to advance to the last
1180 // Date/Time MenuOption and leave the remaining logic in CfUiDown intact so the appropriate
1181 // checking can be done.
1183 while (Count
-- > 0) {
1184 NewPosition
= NewPosition
->ForwardLink
;
1188 *CurrentPosition
= NewPosition
;
1191 return PadLineNumber
;
1195 Get step info from numeric opcode.
1197 @param[in] OpCode The input numeric op code.
1199 @return step info for this opcode.
1203 IN EFI_IFR_OP_HEADER
*OpCode
1206 EFI_IFR_NUMERIC
*NumericOp
;
1209 NumericOp
= (EFI_IFR_NUMERIC
*) OpCode
;
1211 switch (NumericOp
->Flags
& EFI_IFR_NUMERIC_SIZE
) {
1212 case EFI_IFR_NUMERIC_SIZE_1
:
1213 Step
= NumericOp
->data
.u8
.Step
;
1216 case EFI_IFR_NUMERIC_SIZE_2
:
1217 Step
= NumericOp
->data
.u16
.Step
;
1220 case EFI_IFR_NUMERIC_SIZE_4
:
1221 Step
= NumericOp
->data
.u32
.Step
;
1224 case EFI_IFR_NUMERIC_SIZE_8
:
1225 Step
= NumericOp
->data
.u64
.Step
;
1237 Find the registered HotKey based on KeyData.
1239 @param[in] KeyData A pointer to a buffer that describes the keystroke
1240 information for the hot key.
1242 @return The registered HotKey context. If no found, NULL will return.
1245 GetHotKeyFromRegisterList (
1246 IN EFI_INPUT_KEY
*KeyData
1250 BROWSER_HOT_KEY
*HotKey
;
1252 Link
= GetFirstNode (&gFormData
->HotKeyListHead
);
1253 while (!IsNull (&gFormData
->HotKeyListHead
, Link
)) {
1254 HotKey
= BROWSER_HOT_KEY_FROM_LINK (Link
);
1256 if (HotKey
->KeyData
->ScanCode
== KeyData
->ScanCode
) {
1260 Link
= GetNextNode (&gFormData
->HotKeyListHead
, Link
);
1268 Determine if the menu is the last menu that can be selected.
1270 This is an internal function.
1272 @param Direction The scroll direction. False is down. True is up.
1273 @param CurrentPos The current focus.
1275 @return FALSE -- the menu isn't the last menu that can be selected.
1276 @return TRUE -- the menu is the last menu that can be selected.
1281 IN BOOLEAN Direction
,
1282 IN LIST_ENTRY
*CurrentPos
1287 Temp
= Direction
? CurrentPos
->BackLink
: CurrentPos
->ForwardLink
;
1289 if (Temp
== &gMenuOption
) {
1297 Wait for a given event to fire, or for an optional timeout to expire.
1299 @param Event The event to wait for
1301 @retval UI_EVENT_TYPE The type of the event which is trigged.
1313 EFI_EVENT TimerEvent
;
1314 EFI_EVENT WaitList
[3];
1315 UI_EVENT_TYPE EventType
;
1318 Timeout
= FormExitTimeout(gFormData
);
1321 Status
= gBS
->CreateEvent (EVT_TIMER
, 0, NULL
, NULL
, &TimerEvent
);
1324 // Set the timer event
1333 WaitList
[0] = Event
;
1335 if (gFormData
->FormRefreshEvent
!= NULL
) {
1336 WaitList
[EventNum
] = gFormData
->FormRefreshEvent
;
1341 WaitList
[EventNum
] = TimerEvent
;
1345 Status
= gBS
->WaitForEvent (EventNum
, WaitList
, &Index
);
1346 ASSERT_EFI_ERROR (Status
);
1350 EventType
= UIEventKey
;
1354 if (gFormData
->FormRefreshEvent
!= NULL
) {
1355 EventType
= UIEventDriver
;
1357 ASSERT (Timeout
!= 0 && EventNum
== 2);
1358 EventType
= UIEventTimeOut
;
1363 ASSERT (Index
== 2 && EventNum
== 3);
1364 EventType
= UIEventTimeOut
;
1369 gBS
->CloseEvent (TimerEvent
);
1376 Get question id info from the input opcode header.
1378 @param OpCode The input opcode header pointer.
1380 @retval The question id for this opcode.
1385 IN EFI_IFR_OP_HEADER
*OpCode
1388 EFI_IFR_QUESTION_HEADER
*QuestionHeader
;
1390 if (OpCode
->Length
< sizeof (EFI_IFR_OP_HEADER
) + sizeof (EFI_IFR_QUESTION_HEADER
)) {
1394 QuestionHeader
= (EFI_IFR_QUESTION_HEADER
*)((UINT8
*) OpCode
+ sizeof(EFI_IFR_OP_HEADER
));
1396 return QuestionHeader
->QuestionId
;
1401 Find the top of screen menu base on the current menu.
1403 @param CurPos Current input menu.
1404 @param Rows Totol screen rows.
1405 @param SkipValue SkipValue for this new form.
1407 @retval TopOfScreen Top of screen menu for the new form.
1411 FindTopOfScreenMenu (
1412 IN LIST_ENTRY
*CurPos
,
1414 OUT UINTN
*SkipValue
1418 LIST_ENTRY
*TopOfScreen
;
1419 UI_MENU_OPTION
*PreviousMenuOption
;
1422 PreviousMenuOption
= NULL
;
1424 while (Link
->BackLink
!= &gMenuOption
) {
1425 Link
= Link
->BackLink
;
1426 PreviousMenuOption
= MENU_OPTION_FROM_LINK (Link
);
1427 if (PreviousMenuOption
->Row
== 0) {
1428 UpdateOptionSkipLines (PreviousMenuOption
);
1430 if (Rows
<= PreviousMenuOption
->Skip
) {
1433 Rows
= Rows
- PreviousMenuOption
->Skip
;
1436 if (Link
->BackLink
== &gMenuOption
) {
1437 TopOfScreen
= gMenuOption
.ForwardLink
;
1438 if (PreviousMenuOption
!= NULL
&& Rows
< PreviousMenuOption
->Skip
) {
1439 *SkipValue
= PreviousMenuOption
->Skip
- Rows
;
1445 *SkipValue
= PreviousMenuOption
->Skip
- Rows
;
1452 Find the first menu which will be show at the top.
1454 @param FormData The data info for this form.
1455 @param TopOfScreen The link_entry pointer to top menu.
1456 @param HighlightMenu The menu which will be highlight.
1457 @param SkipValue The skip value for the top menu.
1462 IN FORM_DISPLAY_ENGINE_FORM
*FormData
,
1463 OUT LIST_ENTRY
**TopOfScreen
,
1464 OUT LIST_ENTRY
**HighlightMenu
,
1465 OUT UINTN
*SkipValue
1471 UI_MENU_OPTION
*SavedMenuOption
;
1474 TopRow
= gStatementDimensions
.TopRow
+ SCROLL_ARROW_HEIGHT
;
1475 BottomRow
= gStatementDimensions
.BottomRow
- SCROLL_ARROW_HEIGHT
;
1478 // If not has input highlight statement, just return the first one in this form.
1480 if (FormData
->HighLightedStatement
== NULL
) {
1481 *TopOfScreen
= gMenuOption
.ForwardLink
;
1482 *HighlightMenu
= gMenuOption
.ForwardLink
;
1483 if (!IsListEmpty (&gMenuOption
)) {
1484 MoveToNextStatement (FALSE
, HighlightMenu
, BottomRow
- TopRow
, TRUE
);
1491 // Now base on the input highlight menu to find the top menu in this page.
1492 // Will base on the highlight menu show at the bottom to find the top menu.
1494 NewPos
= gMenuOption
.ForwardLink
;
1495 SavedMenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
1497 while ((SavedMenuOption
->ThisTag
!= FormData
->HighLightedStatement
) ||
1498 (SavedMenuOption
->Sequence
!= gSequence
)) {
1499 NewPos
= NewPos
->ForwardLink
;
1500 if (NewPos
== &gMenuOption
) {
1502 // Not Found it, break
1506 SavedMenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
1508 ASSERT (SavedMenuOption
->ThisTag
== FormData
->HighLightedStatement
);
1510 *HighlightMenu
= NewPos
;
1512 AdjustDateAndTimePosition(FALSE
, &NewPos
);
1513 SavedMenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
1514 UpdateOptionSkipLines (SavedMenuOption
);
1517 // If highlight opcode is date/time, keep the highlight row info not change.
1519 if ((SavedMenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_DATE_OP
|| SavedMenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) &&
1520 (gHighligthMenuInfo
.QuestionId
!= 0) &&
1521 (gHighligthMenuInfo
.QuestionId
== GetQuestionIdInfo(SavedMenuOption
->ThisTag
->OpCode
))) {
1523 // Still show the highlight menu before exit from display engine.
1525 BottomRow
= gHighligthMenuInfo
.DisplayRow
+ SavedMenuOption
->Skip
;
1528 if (SavedMenuOption
->Skip
>= BottomRow
- TopRow
) {
1530 *TopOfScreen
= NewPos
;
1532 *TopOfScreen
= FindTopOfScreenMenu(NewPos
, BottomRow
- TopRow
- SavedMenuOption
->Skip
, &TmpValue
);
1535 *SkipValue
= TmpValue
;
1539 Update highlight menu info.
1541 @param MenuOption The menu opton which is highlight.
1545 UpdateHighlightMenuInfo (
1546 IN UI_MENU_OPTION
*MenuOption
1549 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
1552 // This is the current selected statement
1554 Statement
= MenuOption
->ThisTag
;
1557 // Get the highlight statement.
1559 gUserInput
->SelectedStatement
= Statement
;
1560 gSequence
= (UINT16
) MenuOption
->Sequence
;
1563 // Record highlight row info for date/time opcode.
1565 if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
|| Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
1566 gHighligthMenuInfo
.QuestionId
= GetQuestionIdInfo(Statement
->OpCode
);
1567 gHighligthMenuInfo
.DisplayRow
= (UINT16
) MenuOption
->Row
;
1569 gHighligthMenuInfo
.QuestionId
= 0;
1570 gHighligthMenuInfo
.DisplayRow
= 0;
1573 RefreshKeyHelp(gFormData
, Statement
, FALSE
);
1577 Update attribut for this menu.
1579 @param MenuOption The menu opton which this attribut used to.
1580 @param Highlight Whether this menu will be highlight.
1584 SetDisplayAttribute (
1585 IN UI_MENU_OPTION
*MenuOption
,
1586 IN BOOLEAN Highlight
1589 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
1591 Statement
= MenuOption
->ThisTag
;
1594 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetHighlightTextColor ());
1598 if (MenuOption
->GrayOut
) {
1599 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetGrayedTextColor ());
1601 if (Statement
->OpCode
->OpCode
== EFI_IFR_SUBTITLE_OP
) {
1602 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetSubTitleTextColor ());
1604 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetFieldTextColor ());
1610 Print string for this menu option.
1612 @param MenuOption The menu opton which this attribut used to.
1613 @param Col The column that this string will be print at.
1614 @param Row The row that this string will be print at.
1615 @param String The string which need to print.
1616 @param Width The width need to print, if string is less than the
1617 width, the block space will be used.
1618 @param Highlight Whether this menu will be highlight.
1623 IN UI_MENU_OPTION
*MenuOption
,
1628 IN BOOLEAN Highlight
1634 // Print string with normal color.
1637 PrintStringAtWithWidth (Col
, Row
, String
, Width
);
1642 // Print the highlight menu string.
1643 // First print the highlight string.
1645 SetDisplayAttribute(MenuOption
, TRUE
);
1646 Length
= PrintStringAt (Col
, Row
, String
);
1649 // Second, clean the empty after the string.
1651 SetDisplayAttribute(MenuOption
, FALSE
);
1652 PrintStringAtWithWidth (Col
+ Length
, Row
, L
"", Width
- Length
);
1656 Check whether this menu can has option string.
1658 @param MenuOption The menu opton which this attribut used to.
1660 @retval TRUE This menu option can have option string.
1661 @retval FALSE This menu option can't have option string.
1666 IN UI_MENU_OPTION
*MenuOption
1669 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
1672 EFI_IFR_TEXT
*TestOp
;
1675 Statement
= MenuOption
->ThisTag
;
1678 // See if the second text parameter is really NULL
1680 if (Statement
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) {
1681 TestOp
= (EFI_IFR_TEXT
*) Statement
->OpCode
;
1682 if (TestOp
->TextTwo
!= 0) {
1683 String
= GetToken (TestOp
->TextTwo
, gFormData
->HiiHandle
);
1684 Size
= StrLen (String
);
1689 if ((Statement
->OpCode
->OpCode
== EFI_IFR_SUBTITLE_OP
) ||
1690 (Statement
->OpCode
->OpCode
== EFI_IFR_REF_OP
) ||
1691 (Statement
->OpCode
->OpCode
== EFI_IFR_PASSWORD_OP
) ||
1692 (Statement
->OpCode
->OpCode
== EFI_IFR_ACTION_OP
) ||
1693 (Statement
->OpCode
->OpCode
== EFI_IFR_RESET_BUTTON_OP
) ||
1695 // Allow a wide display if text op-code and no secondary text op-code
1697 ((Statement
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) && (Size
== 0))
1708 Print string for this menu option.
1710 @param MenuOption The menu opton which this attribut used to.
1711 @param SkipWidth The skip width between the left to the start of the prompt.
1712 @param BeginCol The begin column for one menu.
1713 @param SkipLine The skip line for this menu.
1714 @param BottomRow The bottom row for this form.
1715 @param Highlight Whether this menu will be highlight.
1717 @retval EFI_SUCESSS Process the user selection success.
1722 IN UI_MENU_OPTION
*MenuOption
,
1727 IN BOOLEAN Highlight
1730 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
1735 CHAR16
*OptionString
;
1736 CHAR16
*OutputString
;
1744 UINTN PromptLineNum
;
1745 UINTN OptionLineNum
;
1749 Statement
= MenuOption
->ThisTag
;
1759 // Set default color.
1761 SetDisplayAttribute (MenuOption
, FALSE
);
1764 // 1. Paint the option string.
1766 Status
= ProcessOptions (MenuOption
, FALSE
, &OptionString
, FALSE
);
1767 if (EFI_ERROR (Status
)) {
1771 if (OptionString
!= NULL
) {
1772 if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
|| Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
1774 // Adjust option string for date/time opcode.
1776 ProcessStringForDateTime(MenuOption
, OptionString
, TRUE
);
1779 Width
= (UINT16
) gOptionBlockWidth
- 1;
1780 Row
= MenuOption
->Row
;
1784 for (Index
= 0; GetLineByWidth (OptionString
, Width
, &GlyphWidth
, &Index
, &OutputString
) != 0x0000;) {
1785 if (((Temp2
== 0)) && (Row
<= BottomRow
)) {
1786 if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
|| Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
1788 // For date/time question, it has three menu options for this qustion.
1789 // The first/second menu options with the skip value is 0. the last one
1790 // with skip value is 1.
1792 if (MenuOption
->Skip
!= 0) {
1794 // For date/ time, print the last past (year for date and second for time)
1795 // - 7 means skip [##/##/ for date and [##:##: for time.
1797 DisplayMenuString (MenuOption
,MenuOption
->OptCol
, Row
, OutputString
, Width
+ 1 - 7, Highlight
);
1800 // For date/ time, print the first and second past (year for date and second for time)
1802 DisplayMenuString (MenuOption
, MenuOption
->OptCol
, Row
, OutputString
, StrLen (OutputString
), Highlight
);
1805 DisplayMenuString (MenuOption
, MenuOption
->OptCol
, Row
, OutputString
, Width
+ 1, Highlight
);
1811 // If there is more string to process print on the next row and increment the Skip value
1813 if (StrLen (&OptionString
[Index
]) != 0) {
1817 // Since the Number of lines for this menu entry may or may not be reflected accurately
1818 // since the prompt might be 1 lines and option might be many, and vice versa, we need to do
1819 // some testing to ensure we are keeping this in-sync.
1821 // If the difference in rows is greater than or equal to the skip value, increase the skip value
1823 if ((Row
- MenuOption
->Row
) >= MenuOption
->Skip
) {
1829 FreePool (OutputString
);
1837 FreePool (OptionString
);
1841 // 2. Paint the description.
1843 PromptWidth
= GetWidth (MenuOption
, &AdjustValue
);
1844 Row
= MenuOption
->Row
;
1848 if (MenuOption
->Description
== NULL
|| MenuOption
->Description
[0] == '\0') {
1849 PrintStringAtWithWidth (BeginCol
, Row
, L
"", PromptWidth
+ AdjustValue
+ SkipWidth
);
1852 for (Index
= 0; GetLineByWidth (MenuOption
->Description
, PromptWidth
, &GlyphWidth
, &Index
, &OutputString
) != 0x0000;) {
1853 if ((Temp
== 0) && (Row
<= BottomRow
)) {
1855 // 1.Clean the start LEFT_SKIPPED_COLUMNS
1857 PrintStringAtWithWidth (BeginCol
, Row
, L
"", SkipWidth
);
1859 if (Statement
->OpCode
->OpCode
== EFI_IFR_REF_OP
&& MenuOption
->Col
>= 2) {
1861 // Print Arrow for Goto button.
1864 MenuOption
->Col
- 2,
1866 GEOMETRICSHAPE_RIGHT_TRIANGLE
1869 DisplayMenuString (MenuOption
, MenuOption
->Col
, Row
, OutputString
, PromptWidth
+ AdjustValue
, Highlight
);
1873 // If there is more string to process print on the next row and increment the Skip value
1875 if (StrLen (&MenuOption
->Description
[Index
]) != 0) {
1881 FreePool (OutputString
);
1892 // 3. If this is a text op with secondary text information
1894 if ((Statement
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) && (((EFI_IFR_TEXT
*)Statement
->OpCode
)->TextTwo
!= 0)) {
1895 StringPtr
= GetToken (((EFI_IFR_TEXT
*)Statement
->OpCode
)->TextTwo
, gFormData
->HiiHandle
);
1897 Width
= (UINT16
) gOptionBlockWidth
- 1;
1898 Row
= MenuOption
->Row
;
1902 for (Index
= 0; GetLineByWidth (StringPtr
, Width
, &GlyphWidth
, &Index
, &OutputString
) != 0x0000;) {
1903 if ((Temp3
== 0) && (Row
<= BottomRow
)) {
1904 DisplayMenuString (MenuOption
, MenuOption
->OptCol
, Row
, OutputString
, Width
+ 1, Highlight
);
1908 // If there is more string to process print on the next row and increment the Skip value
1910 if (StrLen (&StringPtr
[Index
]) != 0) {
1914 // If the rows for text two is greater than or equal to the skip value, increase the skip value
1916 if ((Row
- MenuOption
->Row
) >= MenuOption
->Skip
) {
1922 FreePool (OutputString
);
1928 FreePool (StringPtr
);
1932 // 4.Line number for Option string and prompt string are not equal.
1933 // Clean the column whose line number is less.
1935 if (HasOptionString(MenuOption
) && (OptionLineNum
!= PromptLineNum
)) {
1936 Col
= OptionLineNum
< PromptLineNum
? MenuOption
->OptCol
: BeginCol
;
1937 Row
= (OptionLineNum
< PromptLineNum
? OptionLineNum
: PromptLineNum
) + MenuOption
->Row
;
1938 Width
= (UINT16
) (OptionLineNum
< PromptLineNum
? gOptionBlockWidth
: PromptWidth
+ AdjustValue
+ SkipWidth
);
1939 MaxRow
= (OptionLineNum
< PromptLineNum
? PromptLineNum
: OptionLineNum
) + MenuOption
->Row
- 1;
1941 while (Row
<= MaxRow
) {
1942 DisplayMenuString (MenuOption
, Col
, Row
++, L
"", Width
, FALSE
);
1950 Display menu and wait for user to select one menu option, then return it.
1951 If AutoBoot is enabled, then if user doesn't select any option,
1952 after period of time, it will automatically return the first menu option.
1954 @param FormData The current form data info.
1956 @retval EFI_SUCESSS Process the user selection success.
1957 @retval EFI_NOT_FOUND Process option string for orderedlist/Oneof fail.
1962 IN FORM_DISPLAY_ENGINE_FORM
*FormData
1967 UINTN DistanceValue
;
1977 CHAR16
*OptionString
;
1978 CHAR16
*OutputString
;
1980 CHAR16
*HelpHeaderString
;
1981 CHAR16
*HelpBottomString
;
1990 LIST_ENTRY
*TopOfScreen
;
1991 LIST_ENTRY
*SavedListEntry
;
1992 UI_MENU_OPTION
*MenuOption
;
1993 UI_MENU_OPTION
*NextMenuOption
;
1994 UI_MENU_OPTION
*SavedMenuOption
;
1995 UI_MENU_OPTION
*PreviousMenuOption
;
1996 UI_CONTROL_FLAG ControlFlag
;
1997 UI_SCREEN_OPERATION ScreenOperation
;
1999 FORM_DISPLAY_ENGINE_STATEMENT
*Statement
;
2000 BROWSER_HOT_KEY
*HotKey
;
2001 UINTN HelpPageIndex
;
2002 UINTN HelpPageCount
;
2005 UINTN HelpHeaderLine
;
2006 UINTN HelpBottomLine
;
2007 BOOLEAN MultiHelpPage
;
2008 UINT16 EachLineWidth
;
2009 UINT16 HeaderLineWidth
;
2010 UINT16 BottomLineWidth
;
2011 EFI_STRING_ID HelpInfo
;
2012 UI_EVENT_TYPE EventType
;
2013 FORM_DISPLAY_ENGINE_STATEMENT
*InitialHighlight
;
2014 BOOLEAN SkipHighLight
;
2016 EventType
= UIEventNone
;
2017 Status
= EFI_SUCCESS
;
2019 HelpHeaderString
= NULL
;
2020 HelpBottomString
= NULL
;
2021 OptionString
= NULL
;
2022 ScreenOperation
= UiNoOperation
;
2031 MultiHelpPage
= FALSE
;
2033 HeaderLineWidth
= 0;
2034 BottomLineWidth
= 0;
2035 OutputString
= NULL
;
2039 SkipHighLight
= FALSE
;
2041 NextMenuOption
= NULL
;
2042 PreviousMenuOption
= NULL
;
2043 SavedMenuOption
= NULL
;
2047 gModalSkipColumn
= (CHAR16
) (gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
) / 6;
2048 InitialHighlight
= gFormData
->HighLightedStatement
;
2050 ZeroMem (&Key
, sizeof (EFI_INPUT_KEY
));
2054 // |<-.->|<-.........->|<- .........->|<-...........->|
2055 // Skip Prompt Option Help
2057 Width
= (CHAR16
) ((gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
) / 3);
2058 gOptionBlockWidth
= Width
+ 1;
2059 gHelpBlockWidth
= (CHAR16
) (Width
- LEFT_SKIPPED_COLUMNS
);
2060 gPromptBlockWidth
= (CHAR16
) (gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
- 2 * Width
- 1);
2062 TopRow
= gStatementDimensions
.TopRow
+ SCROLL_ARROW_HEIGHT
;
2063 BottomRow
= gStatementDimensions
.BottomRow
- SCROLL_ARROW_HEIGHT
- 1;
2066 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
2067 Col
= gStatementDimensions
.LeftColumn
+ LEFT_SKIPPED_COLUMNS
+ gModalSkipColumn
;
2069 Col
= gStatementDimensions
.LeftColumn
+ LEFT_SKIPPED_COLUMNS
;
2072 FindTopMenu(FormData
, &TopOfScreen
, &NewPos
, &SkipValue
);
2074 gST
->ConOut
->EnableCursor (gST
->ConOut
, FALSE
);
2076 ControlFlag
= CfInitialization
;
2078 switch (ControlFlag
) {
2079 case CfInitialization
:
2080 if ((gOldFormEntry
.HiiHandle
!= FormData
->HiiHandle
) ||
2081 (!CompareGuid (&gOldFormEntry
.FormSetGuid
, &FormData
->FormSetGuid
))) {
2083 // Clear Statement range if different formset is painted.
2086 gStatementDimensions
.LeftColumn
,
2087 gStatementDimensions
.RightColumn
,
2088 TopRow
- SCROLL_ARROW_HEIGHT
,
2089 BottomRow
+ SCROLL_ARROW_HEIGHT
,
2090 GetFieldTextColor ()
2094 ControlFlag
= CfRepaint
;
2098 ControlFlag
= CfRefreshHighLight
;
2108 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetFieldTextColor ());
2111 // 1. Check whether need to print the arrow up.
2113 if (!ValueIsScroll (TRUE
, TopOfScreen
)) {
2117 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
2118 PrintStringAtWithWidth(gStatementDimensions
.LeftColumn
+ gModalSkipColumn
, TopRow
- 1, L
"", gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
- 2 * gModalSkipColumn
);
2120 PrintStringAtWithWidth(gStatementDimensions
.LeftColumn
, TopRow
- 1, L
"", gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
);
2123 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetArrowColor ());
2125 gStatementDimensions
.LeftColumn
+ gPromptBlockWidth
+ gOptionBlockWidth
+ 1,
2126 TopRow
- SCROLL_ARROW_HEIGHT
,
2129 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetFieldTextColor ());
2133 // 2.Paint the menu.
2135 for (Link
= TopOfScreen
; Link
!= &gMenuOption
; Link
= Link
->ForwardLink
) {
2136 MenuOption
= MENU_OPTION_FROM_LINK (Link
);
2137 MenuOption
->Row
= Row
;
2138 MenuOption
->Col
= Col
;
2139 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
2140 MenuOption
->OptCol
= gStatementDimensions
.LeftColumn
+ LEFT_SKIPPED_COLUMNS
+ gPromptBlockWidth
+ gModalSkipColumn
;
2142 MenuOption
->OptCol
= gStatementDimensions
.LeftColumn
+ LEFT_SKIPPED_COLUMNS
+ gPromptBlockWidth
;
2145 if (MenuOption
->NestInStatement
) {
2146 MenuOption
->Col
+= SUBTITLE_INDENT
;
2150 // Save the highlight menu, will be used in CfRefreshHighLight case.
2152 if (Link
== NewPos
) {
2153 SavedMenuOption
= MenuOption
;
2154 SkipHighLight
= TRUE
;
2157 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
2158 Status
= DisplayOneMenu (MenuOption
,
2159 MenuOption
->Col
- gStatementDimensions
.LeftColumn
,
2160 gStatementDimensions
.LeftColumn
+ gModalSkipColumn
,
2161 Link
== TopOfScreen
? SkipValue
: 0,
2163 (BOOLEAN
) ((Link
== NewPos
) && IsSelectable(MenuOption
))
2166 Status
= DisplayOneMenu (MenuOption
,
2167 MenuOption
->Col
- gStatementDimensions
.LeftColumn
,
2168 gStatementDimensions
.LeftColumn
,
2169 Link
== TopOfScreen
? SkipValue
: 0,
2171 (BOOLEAN
) ((Link
== NewPos
) && IsSelectable(MenuOption
))
2175 if (EFI_ERROR (Status
)) {
2179 // 3. Update the row info which will be used by next menu.
2181 if (Link
== TopOfScreen
) {
2182 Row
+= MenuOption
->Skip
- SkipValue
;
2184 Row
+= MenuOption
->Skip
;
2187 if (Row
> BottomRow
) {
2188 if (!ValueIsScroll (FALSE
, Link
)) {
2192 Row
= BottomRow
+ 1;
2198 // 3. Menus in this form may not cover all form, clean the remain field.
2200 while (Row
<= BottomRow
) {
2201 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
2202 PrintStringAtWithWidth(gStatementDimensions
.LeftColumn
+ gModalSkipColumn
, Row
++, L
"", gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
- 2 * gModalSkipColumn
);
2204 PrintStringAtWithWidth(gStatementDimensions
.LeftColumn
, Row
++, L
"", gStatementDimensions
.RightColumn
- gHelpBlockWidth
- gStatementDimensions
.LeftColumn
);
2209 // 4. Print the down arrow row.
2211 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
2212 PrintStringAtWithWidth(gStatementDimensions
.LeftColumn
+ gModalSkipColumn
, BottomRow
+ 1, L
"", gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
- 2 * + gModalSkipColumn
);
2214 PrintStringAtWithWidth(gStatementDimensions
.LeftColumn
, BottomRow
+ 1, L
"", gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
);
2217 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetArrowColor ());
2219 gStatementDimensions
.LeftColumn
+ gPromptBlockWidth
+ gOptionBlockWidth
+ 1,
2220 BottomRow
+ SCROLL_ARROW_HEIGHT
,
2223 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetFieldTextColor ());
2230 case CfRefreshHighLight
:
2233 // MenuOption: Last menu option that need to remove hilight
2234 // MenuOption is set to NULL in Repaint
2235 // NewPos: Current menu option that need to hilight
2237 ControlFlag
= CfUpdateHelpString
;
2239 if (SkipHighLight
) {
2240 MenuOption
= SavedMenuOption
;
2241 SkipHighLight
= FALSE
;
2242 UpdateHighlightMenuInfo (MenuOption
);
2246 if (IsListEmpty (&gMenuOption
)) {
2248 // No menu option, just update the hotkey filed.
2250 RefreshKeyHelp(gFormData
, NULL
, FALSE
);
2254 if (MenuOption
!= NULL
&& TopOfScreen
== &MenuOption
->Link
) {
2259 if (NewPos
== TopOfScreen
) {
2265 if (NewPos
!= NULL
&& (MenuOption
== NULL
|| NewPos
!= &MenuOption
->Link
)) {
2266 if (MenuOption
!= NULL
) {
2268 // Remove the old highlight menu.
2270 Status
= DisplayOneMenu (MenuOption
,
2271 MenuOption
->Col
- gStatementDimensions
.LeftColumn
,
2272 gStatementDimensions
.LeftColumn
,
2280 // This is the current selected statement
2282 MenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
2283 Statement
= MenuOption
->ThisTag
;
2285 UpdateHighlightMenuInfo (MenuOption
);
2287 if (!IsSelectable (MenuOption
)) {
2291 Status
= DisplayOneMenu (MenuOption
,
2292 MenuOption
->Col
- gStatementDimensions
.LeftColumn
,
2293 gStatementDimensions
.LeftColumn
,
2301 case CfUpdateHelpString
:
2302 ControlFlag
= CfPrepareToReadKey
;
2303 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
2308 // NewLine means only update highlight menu (remove old highlight and highlith
2309 // the new one), not need to full repain the form.
2311 if (Repaint
|| NewLine
) {
2312 if (IsListEmpty (&gMenuOption
)) {
2314 // Don't print anything if no mwnu option.
2316 StringPtr
= GetToken (STRING_TOKEN (EMPTY_STRING
), gHiiHandle
);
2319 // Don't print anything if it is a NULL help token
2321 ASSERT(MenuOption
!= NULL
);
2322 HelpInfo
= ((EFI_IFR_STATEMENT_HEADER
*) ((CHAR8
*)MenuOption
->ThisTag
->OpCode
+ sizeof (EFI_IFR_OP_HEADER
)))->Help
;
2323 if (HelpInfo
== 0 || !IsSelectable (MenuOption
)) {
2324 StringPtr
= GetToken (STRING_TOKEN (EMPTY_STRING
), gHiiHandle
);
2326 StringPtr
= GetToken (HelpInfo
, gFormData
->HiiHandle
);
2330 RowCount
= BottomRow
- TopRow
+ 1;
2333 // 1.Calculate how many line the help string need to print.
2335 if (HelpString
!= NULL
) {
2336 FreePool (HelpString
);
2339 HelpLine
= ProcessHelpString (StringPtr
, &HelpString
, &EachLineWidth
, RowCount
);
2340 FreePool (StringPtr
);
2342 if (HelpLine
> RowCount
) {
2343 MultiHelpPage
= TRUE
;
2344 StringPtr
= GetToken (STRING_TOKEN(ADJUST_HELP_PAGE_UP
), gHiiHandle
);
2345 if (HelpHeaderString
!= NULL
) {
2346 FreePool (HelpHeaderString
);
2347 HelpHeaderString
= NULL
;
2349 HelpHeaderLine
= ProcessHelpString (StringPtr
, &HelpHeaderString
, &HeaderLineWidth
, 0);
2350 FreePool (StringPtr
);
2351 StringPtr
= GetToken (STRING_TOKEN(ADJUST_HELP_PAGE_DOWN
), gHiiHandle
);
2352 if (HelpBottomString
!= NULL
) {
2353 FreePool (HelpBottomString
);
2354 HelpBottomString
= NULL
;
2356 HelpBottomLine
= ProcessHelpString (StringPtr
, &HelpBottomString
, &BottomLineWidth
, 0);
2357 FreePool (StringPtr
);
2359 // Calculate the help page count.
2361 if (HelpLine
> 2 * RowCount
- 2) {
2362 HelpPageCount
= (HelpLine
- RowCount
+ 1) / (RowCount
- 2) + 1;
2363 if ((HelpLine
- RowCount
+ 1) % (RowCount
- 2) > 1) {
2370 MultiHelpPage
= FALSE
;
2375 // Check whether need to show the 'More(U/u)' at the begin.
2376 // Base on current direct info, here shows aligned to the right side of the column.
2377 // If the direction is multi line and aligned to right side may have problem, so
2378 // add ASSERT code here.
2380 if (HelpPageIndex
> 0) {
2381 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetInfoTextColor ());
2382 for (Index
= 0; Index
< HelpHeaderLine
; Index
++) {
2383 ASSERT (HelpHeaderLine
== 1);
2384 ASSERT (GetStringWidth (HelpHeaderString
) / 2 < (UINTN
) (gHelpBlockWidth
- 1));
2385 PrintStringAtWithWidth (
2386 gStatementDimensions
.RightColumn
- gHelpBlockWidth
,
2392 gStatementDimensions
.RightColumn
- GetStringWidth (HelpHeaderString
) / 2 - 1,
2394 &HelpHeaderString
[Index
* HeaderLineWidth
]
2399 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetHelpTextColor ());
2401 // Print the help string info.
2403 if (!MultiHelpPage
) {
2404 for (Index
= 0; Index
< HelpLine
; Index
++) {
2405 PrintStringAtWithWidth (
2406 gStatementDimensions
.RightColumn
- gHelpBlockWidth
,
2408 &HelpString
[Index
* EachLineWidth
],
2412 for (; Index
< RowCount
; Index
++) {
2413 PrintStringAtWithWidth (
2414 gStatementDimensions
.RightColumn
- gHelpBlockWidth
,
2420 gST
->ConOut
->SetCursorPosition(gST
->ConOut
, gStatementDimensions
.RightColumn
-1, BottomRow
);
2422 if (HelpPageIndex
== 0) {
2423 for (Index
= 0; Index
< RowCount
- HelpBottomLine
; Index
++) {
2424 PrintStringAtWithWidth (
2425 gStatementDimensions
.RightColumn
- gHelpBlockWidth
,
2427 &HelpString
[Index
* EachLineWidth
],
2432 for (Index
= 0; (Index
< RowCount
- HelpBottomLine
- HelpHeaderLine
) &&
2433 (Index
+ HelpPageIndex
* (RowCount
- 2) + 1 < HelpLine
); Index
++) {
2434 PrintStringAtWithWidth (
2435 gStatementDimensions
.RightColumn
- gHelpBlockWidth
,
2436 Index
+ TopRow
+ HelpHeaderLine
,
2437 &HelpString
[(Index
+ HelpPageIndex
* (RowCount
- 2) + 1)* EachLineWidth
],
2441 if (HelpPageIndex
== HelpPageCount
- 1) {
2442 for (; Index
< RowCount
- HelpHeaderLine
; Index
++) {
2443 PrintStringAtWithWidth (
2444 gStatementDimensions
.RightColumn
- gHelpBlockWidth
,
2445 Index
+ TopRow
+ HelpHeaderLine
,
2450 gST
->ConOut
->SetCursorPosition(gST
->ConOut
, gStatementDimensions
.RightColumn
-1, BottomRow
);
2456 // Check whether need to print the 'More(D/d)' at the bottom.
2457 // Base on current direct info, here shows aligned to the right side of the column.
2458 // If the direction is multi line and aligned to right side may have problem, so
2459 // add ASSERT code here.
2461 if (HelpPageIndex
< HelpPageCount
- 1 && MultiHelpPage
) {
2462 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetInfoTextColor ());
2463 for (Index
= 0; Index
< HelpBottomLine
; Index
++) {
2464 ASSERT (HelpBottomLine
== 1);
2465 ASSERT (GetStringWidth (HelpBottomString
) / 2 < (UINTN
) (gHelpBlockWidth
- 1));
2466 PrintStringAtWithWidth (
2467 gStatementDimensions
.RightColumn
- gHelpBlockWidth
,
2468 BottomRow
+ Index
- HelpBottomLine
+ 1,
2473 gStatementDimensions
.RightColumn
- GetStringWidth (HelpBottomString
) / 2 - 1,
2474 BottomRow
+ Index
- HelpBottomLine
+ 1,
2475 &HelpBottomString
[Index
* BottomLineWidth
]
2480 // Reset this flag every time we finish using it.
2486 case CfPrepareToReadKey
:
2487 ControlFlag
= CfReadKey
;
2488 ScreenOperation
= UiNoOperation
;
2492 ControlFlag
= CfScreenOperation
;
2495 // Wait for user's selection
2498 Status
= gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
2499 if (!EFI_ERROR (Status
)) {
2500 EventType
= UIEventKey
;
2505 // If we encounter error, continue to read another key in.
2507 if (Status
!= EFI_NOT_READY
) {
2511 EventType
= UiWaitForEvent(gST
->ConIn
->WaitForKey
);
2512 if (EventType
== UIEventKey
) {
2513 gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
2518 if (EventType
== UIEventDriver
) {
2519 gUserInput
->Action
= BROWSER_ACTION_NONE
;
2520 ControlFlag
= CfExit
;
2524 if (EventType
== UIEventTimeOut
) {
2525 gUserInput
->Action
= BROWSER_ACTION_FORM_EXIT
;
2526 ControlFlag
= CfExit
;
2530 switch (Key
.UnicodeChar
) {
2531 case CHAR_CARRIAGE_RETURN
:
2532 if(MenuOption
== NULL
|| MenuOption
->GrayOut
|| MenuOption
->ReadOnly
) {
2533 ControlFlag
= CfReadKey
;
2537 ScreenOperation
= UiSelect
;
2542 // We will push the adjustment of these numeric values directly to the input handler
2543 // NOTE: we won't handle manual input numeric
2548 // If the screen has no menu items, and the user didn't select UiReset
2549 // ignore the selection and go back to reading keys.
2551 if(IsListEmpty (&gMenuOption
) || MenuOption
->GrayOut
|| MenuOption
->ReadOnly
) {
2552 ControlFlag
= CfReadKey
;
2556 ASSERT(MenuOption
!= NULL
);
2557 Statement
= MenuOption
->ThisTag
;
2558 if ((Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
)
2559 || (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)
2560 || ((Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) && (GetFieldFromNum(Statement
->OpCode
) != 0))
2562 if (Key
.UnicodeChar
== '+') {
2563 gDirection
= SCAN_RIGHT
;
2565 gDirection
= SCAN_LEFT
;
2568 Status
= ProcessOptions (MenuOption
, TRUE
, &OptionString
, TRUE
);
2569 if (OptionString
!= NULL
) {
2570 FreePool (OptionString
);
2572 if (EFI_ERROR (Status
)) {
2574 // Repaint to clear possible error prompt pop-up
2579 ControlFlag
= CfExit
;
2585 ScreenOperation
= UiUp
;
2590 ScreenOperation
= UiDown
;
2594 if(IsListEmpty (&gMenuOption
)) {
2595 ControlFlag
= CfReadKey
;
2599 ASSERT(MenuOption
!= NULL
);
2600 if (MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_CHECKBOX_OP
&& !MenuOption
->GrayOut
&& !MenuOption
->ReadOnly
) {
2601 ScreenOperation
= UiSelect
;
2607 if (!MultiHelpPage
) {
2608 ControlFlag
= CfReadKey
;
2611 ControlFlag
= CfUpdateHelpString
;
2612 HelpPageIndex
= HelpPageIndex
< HelpPageCount
- 1 ? HelpPageIndex
+ 1 : HelpPageCount
- 1;
2617 if (!MultiHelpPage
) {
2618 ControlFlag
= CfReadKey
;
2621 ControlFlag
= CfUpdateHelpString
;
2622 HelpPageIndex
= HelpPageIndex
> 0 ? HelpPageIndex
- 1 : 0;
2626 for (Index
= 0; Index
< mScanCodeNumber
; Index
++) {
2627 if (Key
.ScanCode
== gScanCodeToOperation
[Index
].ScanCode
) {
2628 ScreenOperation
= gScanCodeToOperation
[Index
].ScreenOperation
;
2633 if (((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) && (Key
.ScanCode
== SCAN_ESC
|| Index
== mScanCodeNumber
)) {
2635 // ModalForm has no ESC key and Hot Key.
2637 ControlFlag
= CfReadKey
;
2638 } else if (Index
== mScanCodeNumber
) {
2640 // Check whether Key matches the registered hot key.
2643 HotKey
= GetHotKeyFromRegisterList (&Key
);
2644 if (HotKey
!= NULL
) {
2645 ScreenOperation
= UiHotKey
;
2652 case CfScreenOperation
:
2653 if ((ScreenOperation
!= UiReset
) && (ScreenOperation
!= UiHotKey
)) {
2655 // If the screen has no menu items, and the user didn't select UiReset or UiHotKey
2656 // ignore the selection and go back to reading keys.
2658 if (IsListEmpty (&gMenuOption
)) {
2659 ControlFlag
= CfReadKey
;
2665 Index
< sizeof (gScreenOperationToControlFlag
) / sizeof (gScreenOperationToControlFlag
[0]);
2668 if (ScreenOperation
== gScreenOperationToControlFlag
[Index
].ScreenOperation
) {
2669 ControlFlag
= gScreenOperationToControlFlag
[Index
].ControlFlag
;
2676 ControlFlag
= CfRepaint
;
2678 ASSERT(MenuOption
!= NULL
);
2679 Statement
= MenuOption
->ThisTag
;
2680 if (Statement
->OpCode
->OpCode
== EFI_IFR_TEXT_OP
) {
2684 switch (Statement
->OpCode
->OpCode
) {
2685 case EFI_IFR_REF_OP
:
2686 case EFI_IFR_ACTION_OP
:
2687 case EFI_IFR_RESET_BUTTON_OP
:
2688 ControlFlag
= CfExit
;
2693 // Editable Questions: oneof, ordered list, checkbox, numeric, string, password
2695 RefreshKeyHelp (gFormData
, Statement
, TRUE
);
2696 Status
= ProcessOptions (MenuOption
, TRUE
, &OptionString
, TRUE
);
2698 if (OptionString
!= NULL
) {
2699 FreePool (OptionString
);
2702 if (EFI_ERROR (Status
)) {
2705 RefreshKeyHelp (gFormData
, Statement
, FALSE
);
2708 ControlFlag
= CfExit
;
2716 // We come here when someone press ESC
2717 // If the policy is not exit front page when user press ESC, process here.
2719 if (!FormExitPolicy()) {
2722 ControlFlag
= CfRepaint
;
2727 // When user press ESC, it will try to show another menu, should clean the gSequence info.
2729 if (gSequence
!= 0) {
2733 gUserInput
->Action
= BROWSER_ACTION_FORM_EXIT
;
2734 ControlFlag
= CfExit
;
2738 ControlFlag
= CfRepaint
;
2740 gUserInput
->Action
= HotKey
->Action
;
2741 ControlFlag
= CfExit
;
2745 ControlFlag
= CfRepaint
;
2746 ASSERT(MenuOption
!= NULL
);
2747 if ((MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) || (MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
2748 if (MenuOption
->Sequence
!= 0) {
2750 // In the middle or tail of the Date/Time op-code set, go left.
2752 ASSERT(NewPos
!= NULL
);
2753 NewPos
= NewPos
->BackLink
;
2759 ControlFlag
= CfRepaint
;
2760 ASSERT(MenuOption
!= NULL
);
2761 if ((MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) || (MenuOption
->ThisTag
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
2762 if (MenuOption
->Sequence
!= 2) {
2764 // In the middle or tail of the Date/Time op-code set, go left.
2766 ASSERT(NewPos
!= NULL
);
2767 NewPos
= NewPos
->ForwardLink
;
2773 ControlFlag
= CfRepaint
;
2776 SavedListEntry
= NewPos
;
2778 ASSERT(NewPos
!= NULL
);
2780 // Adjust Date/Time position before we advance forward.
2782 AdjustDateAndTimePosition (TRUE
, &NewPos
);
2784 MenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
2785 ASSERT (MenuOption
!= NULL
);
2787 NewPos
= NewPos
->BackLink
;
2789 // Find next selectable menu or the first menu beyond current form.
2791 Difference
= MoveToNextStatement (TRUE
, &NewPos
, MenuOption
->Row
- TopRow
, FALSE
);
2792 if (Difference
< 0) {
2794 // We hit the begining MenuOption that can be focused
2795 // so we simply scroll to the top.
2798 if (TopOfScreen
!= gMenuOption
.ForwardLink
|| SkipValue
!= 0) {
2799 TopOfScreen
= gMenuOption
.ForwardLink
;
2800 NewPos
= SavedListEntry
;
2804 // Scroll up to the last page when we have arrived at top page.
2806 TopOfScreen
= FindTopOfScreenMenu (gMenuOption
.BackLink
, BottomRow
- TopRow
, &SkipValue
);
2807 NewPos
= gMenuOption
.BackLink
;
2808 MoveToNextStatement (TRUE
, &NewPos
, BottomRow
- TopRow
, TRUE
);
2811 NextMenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
2813 if (MenuOption
->Row
< TopRow
+ Difference
+ NextMenuOption
->Skip
) {
2815 // Previous focus MenuOption is above the TopOfScreen, so we need to scroll
2817 TopOfScreen
= NewPos
;
2823 // Check whether new highlight menu is selectable, if not, keep highlight on the old one.
2825 // BottomRow - TopRow + 1 means the total rows current forms supported.
2826 // Difference + NextMenuOption->Skip + 1 means the distance between last highlight menu
2827 // and new top menu. New top menu will all shows in next form, but last highlight menu
2828 // may only shows 1 line. + 1 at right part means at least need to keep 1 line for the
2829 // last highlight menu.
2831 if (!IsSelectable(NextMenuOption
) && IsSelectable(MenuOption
) &&
2832 (BottomRow
- TopRow
+ 1 >= Difference
+ NextMenuOption
->Skip
+ 1)) {
2833 NewPos
= SavedListEntry
;
2837 UpdateStatusBar (INPUT_ERROR
, FALSE
);
2840 // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
2842 AdjustDateAndTimePosition (TRUE
, &TopOfScreen
);
2843 AdjustDateAndTimePosition (TRUE
, &NewPos
);
2848 // SkipValue means lines is skipped when show the top menu option.
2850 ControlFlag
= CfRepaint
;
2856 // First minus the menu of the top screen, it's value is SkipValue.
2858 if (SkipValue
>= BottomRow
- TopRow
+ 1) {
2860 // SkipValue > (BottomRow - TopRow + 1) means current menu has more than one
2861 // form of options to be show, so just update the SkipValue to show the next
2862 // parts of options.
2864 SkipValue
-= BottomRow
- TopRow
+ 1;
2865 NewPos
= TopOfScreen
;
2868 Index
= (BottomRow
+ 1) - SkipValue
- TopRow
;
2871 TopOfScreen
= FindTopOfScreenMenu(TopOfScreen
, Index
, &SkipValue
);
2872 NewPos
= TopOfScreen
;
2873 MoveToNextStatement (FALSE
, &NewPos
, BottomRow
- TopRow
, FALSE
);
2875 UpdateStatusBar (INPUT_ERROR
, FALSE
);
2878 // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
2879 // Don't do this when we are already in the first page.
2881 AdjustDateAndTimePosition (TRUE
, &TopOfScreen
);
2882 AdjustDateAndTimePosition (TRUE
, &NewPos
);
2887 // SkipValue means lines is skipped when show the top menu option.
2889 ControlFlag
= CfRepaint
;
2894 NextMenuOption
= MENU_OPTION_FROM_LINK (Link
);
2895 Index
= TopRow
+ NextMenuOption
->Skip
- SkipValue
;
2897 // Count to the menu option which will show at the top of the next form.
2899 while ((Index
<= BottomRow
+ 1) && (Link
->ForwardLink
!= &gMenuOption
)) {
2900 Link
= Link
->ForwardLink
;
2901 NextMenuOption
= MENU_OPTION_FROM_LINK (Link
);
2902 Index
= Index
+ NextMenuOption
->Skip
;
2905 if ((Link
->ForwardLink
== &gMenuOption
) && (Index
<= BottomRow
+ 1)) {
2907 // Highlight on the last menu which can be highlight.
2910 MoveToNextStatement (TRUE
, &Link
, Index
- TopRow
, TRUE
);
2913 // Calculate the skip line for top of screen menu.
2915 if (Link
== TopOfScreen
) {
2917 // The top of screen menu option occupies the entire form.
2919 SkipValue
+= BottomRow
- TopRow
+ 1;
2921 SkipValue
= NextMenuOption
->Skip
- (Index
- (BottomRow
+ 1));
2926 // Move to the Next selectable menu.
2928 MoveToNextStatement (FALSE
, &Link
, BottomRow
- TopRow
, TRUE
);
2932 // Save the menu as the next highlight menu.
2936 UpdateStatusBar (INPUT_ERROR
, FALSE
);
2939 // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
2940 // Don't do this when we are already in the last page.
2942 AdjustDateAndTimePosition (TRUE
, &TopOfScreen
);
2943 AdjustDateAndTimePosition (TRUE
, &NewPos
);
2948 // SkipValue means lines is skipped when show the top menu option.
2949 // NewPos points to the menu which is highlighted now.
2951 ControlFlag
= CfRepaint
;
2954 if (NewPos
== TopOfScreen
) {
2960 SavedListEntry
= NewPos
;
2962 // Since the behavior of hitting the down arrow on a Date/Time op-code is intended
2963 // to be one that progresses to the next set of op-codes, we need to advance to the last
2964 // Date/Time op-code and leave the remaining logic in UiDown intact so the appropriate
2965 // checking can be done. The only other logic we need to introduce is that if a Date/Time
2966 // op-code is the last entry in the menu, we need to rewind back to the first op-code of
2967 // the Date/Time op-code.
2969 AdjustDateAndTimePosition (FALSE
, &NewPos
);
2971 MenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
2972 NewPos
= NewPos
->ForwardLink
;
2974 // Find the next selectable menu.
2976 if (MenuOption
->Row
+ MenuOption
->Skip
- Temp2
> BottomRow
+ 1) {
2977 if (gMenuOption
.ForwardLink
== NewPos
|| &gMenuOption
== NewPos
) {
2983 Difference
= MoveToNextStatement (FALSE
, &NewPos
, BottomRow
+ 1 - (MenuOption
->Row
+ MenuOption
->Skip
- Temp2
), FALSE
);
2985 if (Difference
< 0) {
2987 // Scroll to the first page.
2989 if (TopOfScreen
!= gMenuOption
.ForwardLink
|| SkipValue
!= 0) {
2990 TopOfScreen
= gMenuOption
.ForwardLink
;
2994 MenuOption
= MENU_OPTION_FROM_LINK (SavedListEntry
);
2996 NewPos
= gMenuOption
.ForwardLink
;
2997 MoveToNextStatement (FALSE
, &NewPos
, BottomRow
- TopRow
, TRUE
);
3001 // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
3003 AdjustDateAndTimePosition (TRUE
, &TopOfScreen
);
3004 AdjustDateAndTimePosition (TRUE
, &NewPos
);
3009 // Get next selected menu info.
3011 AdjustDateAndTimePosition (FALSE
, &NewPos
);
3012 NextMenuOption
= MENU_OPTION_FROM_LINK (NewPos
);
3013 if (NextMenuOption
->Row
== 0) {
3014 UpdateOptionSkipLines (NextMenuOption
);
3018 // Calculate new highlight menu end row.
3020 Temp
= (MenuOption
->Row
+ MenuOption
->Skip
- Temp2
) + Difference
+ NextMenuOption
->Skip
- 1;
3021 if (Temp
> BottomRow
) {
3023 // Get the top screen menu info.
3025 AdjustDateAndTimePosition (FALSE
, &TopOfScreen
);
3026 SavedMenuOption
= MENU_OPTION_FROM_LINK (TopOfScreen
);
3029 // Current Top screen menu occupy (SavedMenuOption->Skip - SkipValue) rows.
3030 // Full shows the new selected menu need to skip (Temp - BottomRow - 1) rows.
3032 if ((Temp
- BottomRow
) >= (SavedMenuOption
->Skip
- SkipValue
)) {
3034 // Skip the top op-code
3036 TopOfScreen
= TopOfScreen
->ForwardLink
;
3037 DistanceValue
= (Temp
- BottomRow
) - (SavedMenuOption
->Skip
- SkipValue
);
3039 SavedMenuOption
= MENU_OPTION_FROM_LINK (TopOfScreen
);
3042 // If we have a remainder, skip that many more op-codes until we drain the remainder
3043 // Special case is the selected highlight menu has more than one form of menus.
3045 while (DistanceValue
>= SavedMenuOption
->Skip
&& TopOfScreen
!= NewPos
) {
3047 // Since the Difference is greater than or equal to this op-code's skip value, skip it
3049 DistanceValue
= DistanceValue
- (INTN
) SavedMenuOption
->Skip
;
3050 TopOfScreen
= TopOfScreen
->ForwardLink
;
3051 SavedMenuOption
= MENU_OPTION_FROM_LINK (TopOfScreen
);
3054 // Since we will act on this op-code in the next routine, and increment the
3055 // SkipValue, set the skips to one less than what is required.
3057 if (TopOfScreen
!= NewPos
) {
3058 SkipValue
= DistanceValue
;
3064 // Since we will act on this op-code in the next routine, and increment the
3065 // SkipValue, set the skips to one less than what is required.
3067 SkipValue
+= Temp
- BottomRow
;
3070 } else if (!IsSelectable (NextMenuOption
)) {
3072 // Continue to go down until scroll to next page or the selectable option is found.
3074 ScreenOperation
= UiDown
;
3075 ControlFlag
= CfScreenOperation
;
3079 MenuOption
= MENU_OPTION_FROM_LINK (SavedListEntry
);
3082 // Check whether new highlight menu is selectable, if not, keep highlight on the old one.
3084 // BottomRow - TopRow + 1 means the total rows current forms supported.
3085 // Difference + NextMenuOption->Skip + 1 means the distance between last highlight menu
3086 // and new top menu. New top menu will all shows in next form, but last highlight menu
3087 // may only shows 1 line. + 1 at right part means at least need to keep 1 line for the
3088 // last highlight menu.
3090 if (!IsSelectable (NextMenuOption
) && IsSelectable (MenuOption
) &&
3091 (BottomRow
- TopRow
+ 1 >= Difference
+ NextMenuOption
->Skip
+ 1)) {
3092 NewPos
= SavedListEntry
;
3095 UpdateStatusBar (INPUT_ERROR
, FALSE
);
3098 // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
3100 AdjustDateAndTimePosition (TRUE
, &TopOfScreen
);
3101 AdjustDateAndTimePosition (TRUE
, &NewPos
);
3104 case CfUiNoOperation
:
3105 ControlFlag
= CfRepaint
;
3109 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
3110 if (HelpString
!= NULL
) {
3111 FreePool (HelpString
);
3113 if (HelpHeaderString
!= NULL
) {
3114 FreePool (HelpHeaderString
);
3116 if (HelpBottomString
!= NULL
) {
3117 FreePool (HelpBottomString
);
3129 Base on the browser status info to show an pop up message.
3133 BrowserStatusProcess (
3140 if (gFormData
->BrowserStatus
== BROWSER_SUCCESS
) {
3144 if (gFormData
->ErrorString
!= NULL
) {
3145 ErrorInfo
= gFormData
->ErrorString
;
3147 switch (gFormData
->BrowserStatus
) {
3148 case BROWSER_SUBMIT_FAIL
:
3149 ErrorInfo
= gSaveFailed
;
3152 case BROWSER_NO_SUBMIT_IF
:
3153 ErrorInfo
= gNoSubmitIf
;
3156 case BROWSER_FORM_NOT_FOUND
:
3157 ErrorInfo
= gFormNotFound
;
3160 case BROWSER_FORM_SUPPRESS
:
3161 ErrorInfo
= gFormSuppress
;
3164 case BROWSER_PROTOCOL_NOT_FOUND
:
3165 ErrorInfo
= gProtocolNotFound
;
3169 ErrorInfo
= gBrwoserError
;
3175 // Error occur, prompt error message.
3178 CreateDialog (&Key
, gEmptyString
, ErrorInfo
, gPressEnter
, gEmptyString
, NULL
);
3179 } while (Key
.UnicodeChar
!= CHAR_CARRIAGE_RETURN
);
3183 Display one form, and return user input.
3185 @param FormData Form Data to be shown.
3186 @param UserInputData User input data.
3188 @retval EFI_SUCCESS 1.Form Data is shown, and user input is got.
3189 2.Error info has show and return.
3190 @retval EFI_INVALID_PARAMETER The input screen dimension is not valid
3191 @retval EFI_NOT_FOUND New form data has some error.
3196 IN FORM_DISPLAY_ENGINE_FORM
*FormData
,
3197 OUT USER_INPUT
*UserInputData
3202 ASSERT (FormData
!= NULL
);
3203 if (FormData
== NULL
) {
3204 return EFI_INVALID_PARAMETER
;
3207 gUserInput
= UserInputData
;
3208 gFormData
= FormData
;
3211 // Process the status info first.
3213 BrowserStatusProcess();
3214 if (UserInputData
== NULL
) {
3216 // UserInputData == NULL, means only need to print the error info, return here.
3221 ConvertStatementToMenu();
3223 Status
= DisplayPageFrame (FormData
, &gStatementDimensions
);
3224 if (EFI_ERROR (Status
)) {
3229 // Check whether layout is changed.
3232 || (gOldFormEntry
.HiiHandle
!= FormData
->HiiHandle
)
3233 || (!CompareGuid (&gOldFormEntry
.FormSetGuid
, &FormData
->FormSetGuid
))
3234 || (gOldFormEntry
.FormId
!= FormData
->FormId
)) {
3235 mStatementLayoutIsChanged
= TRUE
;
3237 mStatementLayoutIsChanged
= FALSE
;
3240 Status
= UiDisplayMenu(FormData
);
3243 // Backup last form info.
3245 mIsFirstForm
= FALSE
;
3246 gOldFormEntry
.HiiHandle
= FormData
->HiiHandle
;
3247 CopyGuid (&gOldFormEntry
.FormSetGuid
, &FormData
->FormSetGuid
);
3248 gOldFormEntry
.FormId
= FormData
->FormId
;
3254 Clear Screen to the initial state.
3258 DriverClearDisplayPage (
3262 ClearDisplayPage ();
3263 mIsFirstForm
= TRUE
;
3267 Set Buffer to Value for Size bytes.
3269 @param Buffer Memory to set.
3270 @param Size Number of bytes to set
3271 @param Value Value of the set operation.
3284 while ((Size
--) != 0) {
3290 Initialize Setup Browser driver.
3292 @param ImageHandle The image handle.
3293 @param SystemTable The system table.
3295 @retval EFI_SUCCESS The Setup Browser module is initialized correctly..
3296 @return Other value if failed to initialize the Setup Browser module.
3301 InitializeDisplayEngine (
3302 IN EFI_HANDLE ImageHandle
,
3303 IN EFI_SYSTEM_TABLE
*SystemTable
3307 EFI_INPUT_KEY HotKey
;
3308 EFI_STRING NewString
;
3309 EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL
*FormBrowserEx2
;
3312 // Publish our HII data
3314 gHiiHandle
= HiiAddPackages (
3315 &gDisplayEngineGuid
,
3317 DisplayEngineStrings
,
3320 ASSERT (gHiiHandle
!= NULL
);
3323 // Install Form Display protocol
3325 Status
= gBS
->InstallProtocolInterface (
3326 &mPrivateData
.Handle
,
3327 &gEdkiiFormDisplayEngineProtocolGuid
,
3328 EFI_NATIVE_INTERFACE
,
3329 &mPrivateData
.FromDisplayProt
3331 ASSERT_EFI_ERROR (Status
);
3333 InitializeDisplayStrings();
3335 ZeroMem (&gHighligthMenuInfo
, sizeof (gHighligthMenuInfo
));
3336 ZeroMem (&gOldFormEntry
, sizeof (gOldFormEntry
));
3339 // Use BrowserEx2 protocol to register HotKey.
3341 Status
= gBS
->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid
, NULL
, (VOID
**) &FormBrowserEx2
);
3342 if (!EFI_ERROR (Status
)) {
3344 // Register the default HotKey F9 and F10 again.
3346 HotKey
.UnicodeChar
= CHAR_NULL
;
3347 HotKey
.ScanCode
= SCAN_F10
;
3348 NewString
= HiiGetString (gHiiHandle
, STRING_TOKEN (FUNCTION_TEN_STRING
), NULL
);
3349 ASSERT (NewString
!= NULL
);
3350 FormBrowserEx2
->RegisterHotKey (&HotKey
, BROWSER_ACTION_SUBMIT
, 0, NewString
);
3352 HotKey
.ScanCode
= SCAN_F9
;
3353 NewString
= HiiGetString (gHiiHandle
, STRING_TOKEN (FUNCTION_NINE_STRING
), NULL
);
3354 ASSERT (NewString
!= NULL
);
3355 FormBrowserEx2
->RegisterHotKey (&HotKey
, BROWSER_ACTION_DEFAULT
, EFI_HII_DEFAULT_CLASS_STANDARD
, NewString
);
3362 This is the default unload handle for display core drivers.
3364 @param[in] ImageHandle The drivers' driver image.
3366 @retval EFI_SUCCESS The image is unloaded.
3367 @retval Others Failed to unload the image.
3372 UnloadDisplayEngine (
3373 IN EFI_HANDLE ImageHandle
3376 HiiRemovePackages(gHiiHandle
);
3378 FreeDisplayStrings ();