MdeModulePkg/DisplayEngine: Add implementation of HiiPopup protocol
Add the implementation of HiiPopup protocol in DisplayEngineDxe, since DisplayEngineDxe is responsible for drawing tasks. 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:
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
FormDiplay protocol to show Form
|
||||
|
||||
Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2013 - 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 that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Protocol/FormBrowserEx2.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Protocol/DisplayProtocol.h>
|
||||
#include <Protocol/HiiPopup.h>
|
||||
|
||||
#include <Guid/MdeModuleHii.h>
|
||||
|
||||
@ -41,6 +42,17 @@ extern FORM_DISPLAY_ENGINE_FORM *gFormData;
|
||||
extern EFI_HII_HANDLE gHiiHandle;
|
||||
extern UINT16 gDirection;
|
||||
extern LIST_ENTRY gMenuOption;
|
||||
extern CHAR16 *gConfirmOptYes;
|
||||
extern CHAR16 *gConfirmOptNo;
|
||||
extern CHAR16 *gConfirmOptOk;
|
||||
extern CHAR16 *gConfirmOptCancel;
|
||||
extern CHAR16 *gYesOption;
|
||||
extern CHAR16 *gNoOption;
|
||||
extern CHAR16 *gOkOption;
|
||||
extern CHAR16 *gCancelOption;
|
||||
extern CHAR16 *gErrorPopup;
|
||||
extern CHAR16 *gWarningPopup;
|
||||
extern CHAR16 *gInfoPopup;
|
||||
|
||||
//
|
||||
// Browser Global Strings
|
||||
@ -139,6 +151,7 @@ typedef struct {
|
||||
// Produced protocol
|
||||
//
|
||||
EDKII_FORM_DISPLAY_ENGINE_PROTOCOL FromDisplayProt;
|
||||
EFI_HII_POPUP_PROTOCOL HiiPopup;
|
||||
} FORM_DISPLAY_DRIVER_PRIVATE_DATA;
|
||||
|
||||
|
||||
@ -272,6 +285,60 @@ typedef struct {
|
||||
|
||||
#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
|
||||
|
||||
#define USER_SELECTABLE_OPTION_OK_WIDTH StrLen (gOkOption)
|
||||
#define USER_SELECTABLE_OPTION_OK_CAL_WIDTH (StrLen (gOkOption) + StrLen (gCancelOption))
|
||||
#define USER_SELECTABLE_OPTION_YES_NO_WIDTH (StrLen (gYesOption) + StrLen (gNoOption))
|
||||
#define USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH (StrLen (gYesOption) + StrLen (gNoOption) + StrLen (gCancelOption))
|
||||
|
||||
#define USER_SELECTABLE_OPTION_SKIP_WIDTH 2
|
||||
|
||||
//
|
||||
// +-------------------------------------------+ // POPUP_BORDER }
|
||||
// | ERROR/WARNING/INFO | // POPUP_STYLE_STRING_HEIGHT } POPUP_HEADER_HEIGHT
|
||||
// |-------------------------------------------| // POPUP_EMPTY_LINE_HEIGHT }
|
||||
// | popup messages |
|
||||
// | | // POPUP_EMPTY_LINE_HEIGHT }
|
||||
// | user selectable options | // POPUP_USER_SELECTABLE_OPTION_HEIGHT } POPUP_FOOTER_HEIGHT
|
||||
// +-------------------------------------------+ // POPUP_BORDER }
|
||||
//
|
||||
#define POPUP_BORDER 1
|
||||
#define POPUP_EMPTY_LINE_HEIGHT 1
|
||||
#define POPUP_STYLE_STRING_HEIGHT 1
|
||||
#define POPUP_USER_SELECTABLE_OPTION_HEIGHT 1
|
||||
|
||||
#define POPUP_HEADER_HEIGHT (POPUP_BORDER + POPUP_STYLE_STRING_HEIGHT + POPUP_EMPTY_LINE_HEIGHT)
|
||||
#define POPUP_FOOTER_HEIGHT (POPUP_EMPTY_LINE_HEIGHT + POPUP_USER_SELECTABLE_OPTION_HEIGHT + POPUP_BORDER)
|
||||
|
||||
#define USER_SELECTABLE_OPTION_SIGNATURE SIGNATURE_32 ('u', 's', 's', 'o')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HII_POPUP_SELECTION OptionType;
|
||||
CHAR16 *OptionString;
|
||||
//
|
||||
// Display item sequence for user select options
|
||||
// Ok: Ok
|
||||
// Sequence: 0
|
||||
//
|
||||
// Ok/Cancel: Ok : Cancel
|
||||
// Sequence: 0 1
|
||||
//
|
||||
// Yes/No: Yes : No
|
||||
// Sequence: 0 1
|
||||
//
|
||||
// Yes/No/Cancel: Yes : No: Cancel
|
||||
// Sequence: 0 1 2
|
||||
//
|
||||
UINTN Sequence;
|
||||
UINTN OptionRow;
|
||||
UINTN OptionCol;
|
||||
UINTN MaxSequence;
|
||||
UINTN MinSequence;
|
||||
} USER_SELECTABLE_OPTION;
|
||||
|
||||
#define SELECTABLE_OPTION_FROM_LINK(a) CR (a, USER_SELECTABLE_OPTION, Link, USER_SELECTABLE_OPTION_SIGNATURE)
|
||||
|
||||
/**
|
||||
Print Question Value according to it's storage width and display attributes.
|
||||
|
||||
@ -650,4 +717,31 @@ UpdateHighlightMenuInfo (
|
||||
IN UINTN SkipValue
|
||||
);
|
||||
|
||||
/**
|
||||
Displays a popup window.
|
||||
|
||||
@param This A pointer to the EFI_HII_POPUP_PROTOCOL instance.
|
||||
@param PopupStyle Popup style to use.
|
||||
@param PopupType Type of the popup to display.
|
||||
@param HiiHandle HII handle of the string pack containing Message
|
||||
@param Message A message to display in the popup box.
|
||||
@param UserSelection User selection.
|
||||
|
||||
@retval EFI_SUCCESS The popup box was successfully displayed.
|
||||
@retval EFI_INVALID_PARAMETER HiiHandle and Message do not define a valid HII string.
|
||||
@retval EFI_INVALID_PARAMETER PopupType is not one of the values defined by this specification.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to display the popup box.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CreatePopup (
|
||||
IN EFI_HII_POPUP_PROTOCOL *This,
|
||||
IN EFI_HII_POPUP_STYLE PopupStyle,
|
||||
IN EFI_HII_POPUP_TYPE PopupType,
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_STRING_ID Message,
|
||||
OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user