summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2017-08-22 15:06:21 +0800
committerEric Dong <eric.dong@intel.com>2017-08-23 10:37:14 +0800
commitdfc55275908142e41293911bbda9be49365fb2a1 (patch)
treea0a4f65f6029280ed6caab03159a7b6c38c809f4 /MdeModulePkg
parent06aad9a2311a4a429320265e89f27a59f98d7369 (diff)
downloadedk2-dfc55275908142e41293911bbda9be49365fb2a1.tar.gz
edk2-dfc55275908142e41293911bbda9be49365fb2a1.tar.bz2
edk2-dfc55275908142e41293911bbda9be49365fb2a1.zip
MdeModulePkg/DriverSample: Add sample case for popup protocol
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c29
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h4
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf3
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr10
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni8
5 files changed, 49 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index f103b9ca21..bbd9713eea 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -1100,6 +1100,9 @@ DriverCallback (
CHAR16 *TmpStr;
UINTN Index;
UINT64 BufferValue;
+ EFI_HII_POPUP_SELECTION UserSelection;
+
+ UserSelection = 0xFF;
if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||
(ActionRequest == NULL)) {
@@ -1619,6 +1622,22 @@ DriverCallback (
}
break;
+ case 0x1330:
+ Status = mPrivateData->HiiPopup->CreatePopup (
+ mPrivateData->HiiPopup,
+ EfiHiiPopupStyleInfo,
+ EfiHiiPopupTypeYesNo,
+ mPrivateData->HiiHandle[0],
+ STRING_TOKEN (STR_POPUP_STRING),
+ &UserSelection
+ );
+ if (!EFI_ERROR (Status)) {
+ if (UserSelection == EfiHiiPopupSelectionYes) {
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
+ }
+ }
+ break;
+
default:
break;
}
@@ -1678,6 +1697,7 @@ DriverSampleInit (
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;
+ EFI_HII_POPUP_PROTOCOL *PopupHandler;
CHAR16 *NewString;
UINTN BufferSize;
DRIVER_SAMPLE_CONFIGURATION *Configuration;
@@ -1763,6 +1783,15 @@ DriverSampleInit (
}
mPrivateData->HiiKeywordHandler = HiiKeywordHandler;
+ //
+ // Locate HiiPopup protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiHiiPopupProtocolGuid, NULL, (VOID **) &PopupHandler);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mPrivateData->HiiPopup = PopupHandler;
+
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverHandle[0],
&gEfiDevicePathProtocolGuid,
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
index 6c97239cf3..507cff6ec9 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -33,6 +33,7 @@ Revision History
#include <Protocol/HiiString.h>
#include <Protocol/FormBrowserEx.h>
#include <Protocol/HiiConfigKeyword.h>
+#include <Protocol/HiiPopup.h>
#include <Guid/MdeModuleHii.h>
#include <Library/DebugLib.h>
@@ -98,6 +99,7 @@ typedef struct {
EFI_HII_STRING_PROTOCOL *HiiString;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;
+ EFI_HII_POPUP_PROTOCOL *HiiPopup;
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
index 4233e635bc..bfd7484518 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
@@ -4,7 +4,7 @@
# This driver shows how HII protocol, VFR and UNI files are used to create a HII
# driver which can be dipslayed and configured by a UEFI HII Form Browser.
#
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -93,6 +93,7 @@
gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES
gEdkiiFormBrowserExProtocolGuid ## CONSUMES
gEfiConfigKeywordHandlerProtocolGuid ## CONSUMES
+ gEfiHiiPopupProtocolGuid ## CONSUMES
[Depex]
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
index 4bdaf765bc..d547ec809b 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
+++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -2,7 +2,7 @@
//
// Sample Setup formset.
//
-// Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+// Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
@@ -476,7 +476,13 @@ formset
maximum = 255,
default = 18,
endnumeric;
-
+
+ text
+ help = STRING_TOKEN(STR_POPUP_TEST_HELP),
+ text = STRING_TOKEN(STR_POPUP_TEST_PROMPT),
+ flags = INTERACTIVE,
+ key = 0x1330;
+
goto 2,
prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
help = STRING_TOKEN(STR_GOTO_HELP);
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
index 8d24a476f3..6a268d1236 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
+++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
@@ -1,6 +1,6 @@
// *++
//
-// Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+// Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
@@ -267,6 +267,12 @@
#language fr-FR "Submitted callback test"
#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"
#language fr-FR "Change the value and press F10 to submmit will pop up a dialogue to show SUBMITTED Callback has been triggered"
+#string STR_POPUP_TEST_PROMPT #language en-US "Select it to invoke Hii Popup Protocol"
+ #language fr-FR "Select it to invoke Hii Popup Protocol"
+#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"
+ #language fr-FR "Select this question will pop up a message box, then user can decide whether exit curret form or not"
+#string STR_POPUP_STRING #language en-US "Are you sure to exit current form?"
+ #language fr-FR "Are you sure to exit current form?"
// Boot Order
#string STR_BOOT_TITLE #language en-US "Boot"
#string STR_BOOT_OPTIONS #language en-US "Boot Order"