]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / DisplayEngineDxe / FormDisplay.h
index f369877386ff235a115059fd17367136a8ed7c51..e6d3ae417ead3d7a5178d7a18d5641ae9f19eb3b 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   FormDiplay protocol to show Form\r
 \r
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under \r
-the terms and conditions of the BSD License that accompanies this distribution.  \r
-The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.                                            \r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -28,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/FormBrowserEx2.h>\r
 #include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/DisplayProtocol.h>\r
+#include <Protocol/HiiPopup.h>\r
 \r
 #include <Guid/MdeModuleHii.h>\r
 \r
@@ -41,6 +36,17 @@ extern FORM_DISPLAY_ENGINE_FORM      *gFormData;
 extern EFI_HII_HANDLE                gHiiHandle;\r
 extern UINT16                        gDirection;\r
 extern LIST_ENTRY                    gMenuOption;\r
+extern CHAR16                        *gConfirmOptYes;\r
+extern CHAR16                        *gConfirmOptNo;\r
+extern CHAR16                        *gConfirmOptOk;\r
+extern CHAR16                        *gConfirmOptCancel;\r
+extern CHAR16                        *gYesOption;\r
+extern CHAR16                        *gNoOption;\r
+extern CHAR16                        *gOkOption;\r
+extern CHAR16                        *gCancelOption;\r
+extern CHAR16                        *gErrorPopup;\r
+extern CHAR16                        *gWarningPopup;\r
+extern CHAR16                        *gInfoPopup;\r
 \r
 //\r
 // Browser Global Strings\r
@@ -58,11 +64,13 @@ extern CHAR16            *gMiniString;
 extern CHAR16            *gOptionMismatch;\r
 extern CHAR16            *gFormSuppress;\r
 extern CHAR16            *gProtocolNotFound;\r
+extern CHAR16            *gPasswordUnsupported;\r
 \r
 extern CHAR16            gPromptBlockWidth;\r
 extern CHAR16            gOptionBlockWidth;\r
 extern CHAR16            gHelpBlockWidth;\r
 extern CHAR16            *mUnknownString;\r
+extern BOOLEAN           gMisMatch;\r
 \r
 //\r
 // Screen definitions\r
@@ -112,8 +120,9 @@ extern CHAR16            *mUnknownString;
 //\r
 // It take 23 characters including the NULL to print a 64 bits number with "[" and "]".\r
 // pow(2, 64) = [18446744073709551616]\r
+// with extra '-' flat, set the width to 24.\r
 //\r
-#define MAX_NUMERIC_INPUT_WIDTH 23\r
+#define MAX_NUMERIC_INPUT_WIDTH 24\r
 \r
 #define EFI_HII_EXPRESSION_INCONSISTENT_IF   0\r
 #define EFI_HII_EXPRESSION_NO_SUBMIT_IF      1\r
@@ -136,6 +145,7 @@ typedef struct {
   // Produced protocol\r
   //\r
   EDKII_FORM_DISPLAY_ENGINE_PROTOCOL FromDisplayProt;\r
+  EFI_HII_POPUP_PROTOCOL             HiiPopup;\r
 } FORM_DISPLAY_DRIVER_PRIVATE_DATA;\r
 \r
 \r
@@ -196,9 +206,31 @@ typedef struct {
 \r
 typedef struct {\r
   EFI_HII_HANDLE     HiiHandle;\r
-  EFI_QUESTION_ID    QuestionId;\r
-  EFI_IFR_OP_HEADER  *OpCode;\r
-  UINT16             DisplayRow;\r
+  UINT16             FormId;\r
+\r
+  //\r
+  // Info for the highlight question.\r
+  // HLT means highlight\r
+  //\r
+  // If one statement has questionid, save questionid info to find the question.\r
+  // If one statement not has questionid info, save the opcode info to find the\r
+  // statement. If more than one statement has same opcode in one form(just like\r
+  // empty subtitle info may has more than one info one form), also use Index\r
+  // info to find the statement.\r
+  //\r
+  EFI_QUESTION_ID    HLTQuestionId;\r
+  EFI_IFR_OP_HEADER  *HLTOpCode;\r
+  UINTN              HLTIndex;\r
+  UINTN              HLTSequence;\r
+\r
+  //\r
+  // Info for the top of screen question.\r
+  // TOS means Top Of Screen\r
+  //\r
+  EFI_QUESTION_ID    TOSQuestionId;\r
+  EFI_IFR_OP_HEADER  *TOSOpCode;\r
+  UINTN              TOSIndex;\r
+\r
   UINT16             SkipValue;\r
 } DISPLAY_HIGHLIGHT_MENU_INFO;\r
 \r
@@ -247,6 +279,60 @@ typedef struct {
 \r
 #define MENU_OPTION_FROM_LINK(a)  CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)\r
 \r
+#define USER_SELECTABLE_OPTION_OK_WIDTH           StrLen (gOkOption)\r
+#define USER_SELECTABLE_OPTION_OK_CAL_WIDTH       (StrLen (gOkOption) + StrLen (gCancelOption))\r
+#define USER_SELECTABLE_OPTION_YES_NO_WIDTH       (StrLen (gYesOption) + StrLen (gNoOption))\r
+#define USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH   (StrLen (gYesOption) + StrLen (gNoOption) + StrLen (gCancelOption))\r
+\r
+#define USER_SELECTABLE_OPTION_SKIP_WIDTH  2\r
+\r
+//\r
+// +-------------------------------------------+ // POPUP_BORDER                        }\r
+// |            ERROR/WARNING/INFO             | // POPUP_STYLE_STRING_HEIGHT           } POPUP_HEADER_HEIGHT\r
+// |-------------------------------------------| // POPUP_EMPTY_LINE_HEIGHT             }\r
+// |             popup messages                |\r
+// |                                           | // POPUP_EMPTY_LINE_HEIGHT             }\r
+// |         user selectable options           | // POPUP_USER_SELECTABLE_OPTION_HEIGHT } POPUP_FOOTER_HEIGHT\r
+// +-------------------------------------------+ // POPUP_BORDER                        }\r
+//\r
+#define POPUP_BORDER  1\r
+#define POPUP_EMPTY_LINE_HEIGHT  1\r
+#define POPUP_STYLE_STRING_HEIGHT  1\r
+#define POPUP_USER_SELECTABLE_OPTION_HEIGHT  1\r
+\r
+#define POPUP_HEADER_HEIGHT  (POPUP_BORDER + POPUP_STYLE_STRING_HEIGHT + POPUP_EMPTY_LINE_HEIGHT)\r
+#define POPUP_FOOTER_HEIGHT  (POPUP_EMPTY_LINE_HEIGHT + POPUP_USER_SELECTABLE_OPTION_HEIGHT + POPUP_BORDER)\r
+\r
+#define USER_SELECTABLE_OPTION_SIGNATURE  SIGNATURE_32 ('u', 's', 's', 'o')\r
+\r
+typedef struct {\r
+  UINTN                   Signature;\r
+  LIST_ENTRY              Link;\r
+  EFI_HII_POPUP_SELECTION OptionType;\r
+  CHAR16                  *OptionString;\r
+  //\r
+  // Display item sequence for user select options\r
+  //  Ok:        Ok\r
+  //  Sequence:  0\r
+  //\r
+  //  Ok/Cancel:   Ok : Cancel\r
+  //  Sequence:    0      1\r
+  //\r
+  //  Yes/No:      Yes : No\r
+  //  Sequence:     0    1\r
+  //\r
+  //  Yes/No/Cancel: Yes : No: Cancel\r
+  //  Sequence:       0    1    2\r
+  //\r
+  UINTN                   Sequence;\r
+  UINTN                   OptionRow;\r
+  UINTN                   OptionCol;\r
+  UINTN                   MaxSequence;\r
+  UINTN                   MinSequence;\r
+} USER_SELECTABLE_OPTION;\r
+\r
+#define SELECTABLE_OPTION_FROM_LINK(a)  CR (a, USER_SELECTABLE_OPTION, Link, USER_SELECTABLE_OPTION_SIGNATURE)\r
+\r
 /**\r
   Print Question Value according to it's storage width and display attributes.\r
 \r
@@ -298,7 +384,7 @@ GetArrayData (
   IN UINT8                    Type,\r
   IN UINTN                    Index\r
   );\r
-  \r
+\r
 /**\r
   Search an Option of a Question by its value.\r
 \r
@@ -370,7 +456,7 @@ CreateMultiStringPopUp (
   @param  Index                  Where in InputString to start the copy process\r
   @param  OutputString           Buffer to copy the string into\r
 \r
-  @return Returns the number of CHAR16 characters that were copied into the OutputString \r
+  @return Returns the number of CHAR16 characters that were copied into the OutputString\r
   buffer, include extra glyph info and '\0' info.\r
 \r
 **/\r
@@ -398,7 +484,7 @@ GetToken (
   IN  EFI_STRING_ID                Token,\r
   IN  EFI_HII_HANDLE               HiiHandle\r
   );\r
-  \r
+\r
 /**\r
   Count the storage space of a Unicode string.\r
 \r
@@ -467,7 +553,7 @@ CreateSharedPopUp (
   IN  UINTN                       NumberOfLines,\r
   IN  VA_LIST                     Marker\r
   );\r
-  \r
+\r
 /**\r
   Wait for a key to be pressed by user.\r
 \r
@@ -550,14 +636,14 @@ SetUnicodeMem (
 \r
 /**\r
   Display one form, and return user input.\r
-  \r
+\r
   @param FormData                Form Data to be shown.\r
   @param UserInputData           User input data.\r
-  \r
+\r
   @retval EFI_SUCCESS            Form Data is shown, and user input is got.\r
 **/\r
 EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
 FormDisplay (\r
   IN  FORM_DISPLAY_ENGINE_FORM  *FormData,\r
   OUT USER_INPUT                *UserInputData\r
@@ -567,7 +653,7 @@ FormDisplay (
   Clear Screen to the initial state.\r
 **/\r
 VOID\r
-EFIAPI \r
+EFIAPI\r
 DriverClearDisplayPage (\r
   VOID\r
   );\r
@@ -577,7 +663,7 @@ DriverClearDisplayPage (
 \r
 **/\r
 VOID\r
-EFIAPI \r
+EFIAPI\r
 ExitDisplay (\r
   VOID\r
   );\r
@@ -610,4 +696,46 @@ RefreshTimeOutProcess (
   IN  VOID         *Context\r
   );\r
 \r
+/**\r
+  Record the highlight menu and top of screen menu info.\r
+\r
+  @param  Highlight               The menu opton which is highlight.\r
+  @param  TopOfScreen             The menu opton which is at the top of the form.\r
+  @param  SkipValue               The skip line info for the top of screen menu.\r
+\r
+**/\r
+VOID\r
+UpdateHighlightMenuInfo (\r
+  IN  LIST_ENTRY                      *Highlight,\r
+  IN  LIST_ENTRY                      *TopOfScreen,\r
+  IN  UINTN                           SkipValue\r
+  );\r
+\r
+/**\r
+  Displays a popup window.\r
+\r
+  @param  This           A pointer to the EFI_HII_POPUP_PROTOCOL instance.\r
+  @param  PopupStyle     Popup style to use.\r
+  @param  PopupType      Type of the popup to display.\r
+  @param  HiiHandle      HII handle of the string pack containing Message\r
+  @param  Message        A message to display in the popup box.\r
+  @param  UserSelection  User selection.\r
+\r
+  @retval EFI_SUCCESS            The popup box was successfully displayed.\r
+  @retval EFI_INVALID_PARAMETER  HiiHandle and Message do not define a valid HII string.\r
+  @retval EFI_INVALID_PARAMETER  PopupType is not one of the values defined by this specification.\r
+  @retval EFI_OUT_OF_RESOURCES   There are not enough resources available to display the popup box.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CreatePopup (\r
+  IN  EFI_HII_POPUP_PROTOCOL  *This,\r
+  IN  EFI_HII_POPUP_STYLE     PopupStyle,\r
+  IN  EFI_HII_POPUP_TYPE      PopupType,\r
+  IN  EFI_HII_HANDLE          HiiHandle,\r
+  IN  EFI_STRING_ID           Message,\r
+  OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL\r
+  );\r
+\r
 #endif\r