]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
MdeModulePkg/DisplayEngine: Add implementation of HiiPopup protocol
[mirror_edk2.git] / MdeModulePkg / Universal / DisplayEngineDxe / FormDisplay.h
index 45532ab126ad688ca6f61b91f8128aa27024a32e..7e2a1aa64be084d0b394425b6e0315daad28bbd6 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FormDiplay protocol to show Form\r
 \r
-Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2017, 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
@@ -28,6 +28,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 +42,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
@@ -139,6 +151,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
@@ -272,6 +285,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
@@ -650,4 +717,31 @@ UpdateHighlightMenuInfo (
   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