mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
06aad9a231
commit
dfc5527590
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue