Add one sample case about how to use HiiPopup protocol to draw message box.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
CHAR16 *TmpStr;\r
UINTN Index;\r
UINT64 BufferValue;\r
+ EFI_HII_POPUP_SELECTION UserSelection;\r
+\r
+ UserSelection = 0xFF;\r
\r
if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||\r
(ActionRequest == NULL)) {\r
}\r
break;\r
\r
+ case 0x1330:\r
+ Status = mPrivateData->HiiPopup->CreatePopup (\r
+ mPrivateData->HiiPopup,\r
+ EfiHiiPopupStyleInfo,\r
+ EfiHiiPopupTypeYesNo,\r
+ mPrivateData->HiiHandle[0],\r
+ STRING_TOKEN (STR_POPUP_STRING),\r
+ &UserSelection\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ if (UserSelection == EfiHiiPopupSelectionYes) {\r
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+ }\r
+ }\r
+ break;\r
+\r
default:\r
break;\r
}\r
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;\r
+ EFI_HII_POPUP_PROTOCOL *PopupHandler;\r
CHAR16 *NewString;\r
UINTN BufferSize;\r
DRIVER_SAMPLE_CONFIGURATION *Configuration;\r
}\r
mPrivateData->HiiKeywordHandler = HiiKeywordHandler;\r
\r
+ //\r
+ // Locate HiiPopup protocol\r
+ //\r
+ Status = gBS->LocateProtocol (&gEfiHiiPopupProtocolGuid, NULL, (VOID **) &PopupHandler);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ mPrivateData->HiiPopup = PopupHandler;\r
+\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
&DriverHandle[0],\r
&gEfiDevicePathProtocolGuid,\r
/** @file\r
\r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include <Protocol/HiiString.h>\r
#include <Protocol/FormBrowserEx.h>\r
#include <Protocol/HiiConfigKeyword.h>\r
+#include <Protocol/HiiPopup.h>\r
\r
#include <Guid/MdeModuleHii.h>\r
#include <Library/DebugLib.h>\r
EFI_HII_STRING_PROTOCOL *HiiString;\r
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;\r
+ EFI_HII_POPUP_PROTOCOL *HiiPopup;\r
\r
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
\r
# This driver shows how HII protocol, VFR and UNI files are used to create a HII \r
# driver which can be dipslayed and configured by a UEFI HII Form Browser.\r
#\r
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES\r
gEdkiiFormBrowserExProtocolGuid ## CONSUMES\r
gEfiConfigKeywordHandlerProtocolGuid ## CONSUMES\r
+ gEfiHiiPopupProtocolGuid ## CONSUMES\r
\r
[Depex]\r
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid\r
//\r
// Sample Setup formset.\r
//\r
-// Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
maximum = 255,\r
default = 18,\r
endnumeric;\r
- \r
+\r
+ text\r
+ help = STRING_TOKEN(STR_POPUP_TEST_HELP),\r
+ text = STRING_TOKEN(STR_POPUP_TEST_PROMPT),\r
+ flags = INTERACTIVE,\r
+ key = 0x1330;\r
+\r
goto 2,\r
prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY\r
help = STRING_TOKEN(STR_GOTO_HELP);\r
// *++\r
//\r
-// Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
// This program and the accompanying materials \r
// are licensed and made available under the terms and conditions of the BSD License \r
// which accompanies this distribution. The full text of the license may be found at \r
#language fr-FR "Submitted callback test"\r
#string STR_SUBMITTED_CALLBACK_TEST_HELP #language en-US "Change the value and press F10 to submmit will pop up a dialogue to show SUBMITTED Callback has been triggered"\r
#language fr-FR "Change the value and press F10 to submmit will pop up a dialogue to show SUBMITTED Callback has been triggered"\r
+#string STR_POPUP_TEST_PROMPT #language en-US "Select it to invoke Hii Popup Protocol"\r
+ #language fr-FR "Select it to invoke Hii Popup Protocol"\r
+#string STR_POPUP_TEST_HELP #language en-US "Select this question will pop up a message box, then user can decide whether exit curret form or not"\r
+ #language fr-FR "Select this question will pop up a message box, then user can decide whether exit curret form or not"\r
+#string STR_POPUP_STRING #language en-US "Are you sure to exit current form?"\r
+ #language fr-FR "Are you sure to exit current form?"\r
// Boot Order\r
#string STR_BOOT_TITLE #language en-US "Boot"\r
#string STR_BOOT_OPTIONS #language en-US "Boot Order"\r