14MENU_ITEM_FUNCTION *ControlBasedMenuFunctions;
25 SHELL_FREE_NON_NULL (MenuItems);
43 for (NumItems = 0, ItemsWalker = Items; ItemsWalker !=
NULL && ItemsWalker->Function !=
NULL; ItemsWalker++, NumItems++) {
47 if (MenuItems ==
NULL) {
48 return EFI_OUT_OF_RESOURCES;
64 IN MENU_ITEM_FUNCTION *Items
67 ControlBasedMenuFunctions = Items;
90 CHAR16 *FunctionKeyString;
108 for (Item = MenuItems; Item !=
NULL && Item->Function !=
NULL; Item++) {
110 if (NameString ==
NULL) {
111 return EFI_INVALID_PARAMETER;
114 Width =
MAX ((
StrLen (NameString) + 6), 20);
115 if (((Col + Width) > LastCol)) {
120 FunctionKeyString =
HiiGetString (gShellDebug1HiiHandle, Item->FunctionKeyToken,
NULL);
121 if (FunctionKeyString ==
NULL) {
123 return EFI_INVALID_PARAMETER;
126 ShellPrintEx ((INT32)(Col) - 1, (INT32)(Row) - 1, L
"%E%s%N %H%s%N ", FunctionKeyString, NameString);
152 Index = Key->ScanCode - SCAN_F1;
157 if (Index > (NumItems - 1)) {
162 return (MenuItems[Index].Function ());
184 ControlIndex = MAX_UINT16;
186 if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
187 (KeyData->KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID))
193 ControlIndex = KeyData->Key.UnicodeChar;
194 }
else if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
195 ((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) != 0) &&
196 ((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0))
202 if ((KeyData->Key.UnicodeChar >= L
'A') && (KeyData->Key.UnicodeChar <= L
'Z')) {
203 ControlIndex = KeyData->Key.UnicodeChar - L
'A' + 1;
204 }
else if ((KeyData->Key.UnicodeChar >= L
'a') && (KeyData->Key.UnicodeChar <= L
'z')) {
205 ControlIndex = KeyData->Key.UnicodeChar - L
'a' + 1;
209 if ( (SCAN_CONTROL_Z < ControlIndex)
210 || (
NULL == ControlBasedMenuFunctions[ControlIndex]))
212 return EFI_NOT_FOUND;
215 ControlBasedMenuFunctions[ControlIndex]();
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS StatusBarSetStatusString(IN CHAR16 *Str)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
VOID EditorClearLine(IN UINTN Row, IN UINTN LastCol, IN UINTN LastRow)