]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Application/UiApp/FrontPageCustomizedUi.c
MdeModulePkg UiApp: change code for easy customization.
[mirror_edk2.git] / MdeModulePkg / Application / UiApp / FrontPageCustomizedUi.c
diff --git a/MdeModulePkg/Application/UiApp/FrontPageCustomizedUi.c b/MdeModulePkg/Application/UiApp/FrontPageCustomizedUi.c
new file mode 100644 (file)
index 0000000..6e4f7b5
--- /dev/null
@@ -0,0 +1,132 @@
+/** @file\r
+\r
+  This library class defines a set of interfaces to customize Ui module\r
+\r
+Copyright (c) 2016, 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
+\r
+**/\r
+#include <Uefi.h>\r
+#include <Protocol/HiiConfigAccess.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include "FrontPageCustomizedUiSupport.h"\r
+\r
+/**\r
+  Customize menus in the page.\r
+\r
+  @param[in]  HiiHandle             The HII Handle of the form to update.\r
+  @param[in]  StartOpCodeHandle     The context used to insert opcode.\r
+  @param[in]  CustomizePageType     The page type need to be customized.\r
+\r
+**/\r
+VOID\r
+UiCustomizeFrontPage (\r
+  IN EFI_HII_HANDLE  HiiHandle,\r
+  IN VOID            *StartOpCodeHandle\r
+  )\r
+{\r
+  //\r
+  // Create "Select Language" menu with Oneof opcode.\r
+  //\r
+  UiCreateLanguageMenu (HiiHandle, StartOpCodeHandle);\r
+\r
+  //\r
+  // Create empty line.\r
+  //\r
+  UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);\r
+\r
+  //\r
+  // Find third party drivers which need to be shown in the front page.\r
+  //\r
+  UiListThirdPartyDrivers (HiiHandle, &gEfiIfrFrontPageGuid, NULL, StartOpCodeHandle);\r
+\r
+  //\r
+  // Create empty line.\r
+  //\r
+  UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);\r
+\r
+  //\r
+  // Create "Continue" menu.\r
+  //\r
+  UiCreateContinueMenu(HiiHandle, StartOpCodeHandle);\r
+\r
+  //\r
+  // Create reset menu.\r
+  //\r
+  UiCreateResetMenu(HiiHandle, StartOpCodeHandle);\r
+}\r
+\r
+/**\r
+  This function processes the results of changes in configuration.\r
+\r
+\r
+  @param HiiHandle       Points to the hii handle for this formset.\r
+  @param Action          Specifies the type of action taken by the browser.\r
+  @param QuestionId      A unique value which is sent to the original exporting driver\r
+                         so that it can identify the type of data to expect.\r
+  @param Type            The type of value for the question.\r
+  @param Value           A pointer to the data being sent to the original exporting driver.\r
+  @param ActionRequest   On return, points to the action requested by the callback function.\r
+\r
+  @retval  EFI_SUCCESS           The callback successfully handled the action.\r
+  @retval  EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the variable and its data.\r
+  @retval  EFI_DEVICE_ERROR      The variable could not be saved.\r
+  @retval  EFI_UNSUPPORTED       The specified Action is not supported by the callback.\r
+\r
+**/\r
+EFI_STATUS\r
+UiFrontPageCallbackHandler (\r
+  IN  EFI_HII_HANDLE                         HiiHandle,\r
+  IN  EFI_BROWSER_ACTION                     Action,\r
+  IN  EFI_QUESTION_ID                        QuestionId,\r
+  IN  UINT8                                  Type,\r
+  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+\r
+  if (UiSupportLibCallbackHandler (HiiHandle, Action, QuestionId, Type, Value, ActionRequest, &Status)) {\r
+    return Status;\r
+  }\r
+\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Update the banner string in the front page.\r
+\r
+  Current layout for the banner string like below:\r
+  PS: Totally only 5 lines of banner supported.\r
+\r
+  Line 1: Left BannerStr                           RightBannerStr\r
+  Line 2: Left BannerStr                           RightBannerStr\r
+  Line 3: Left BannerStr                           RightBannerStr\r
+  Line 4: Left BannerStr                           RightBannerStr\r
+  Line 5: Left BannerStr                           RightBannerStr\r
+  <EmptyLine>\r
+  First menu in front page.\r
+  ...\r
+\r
+  @param  LineIndex         The line index of the banner need to check.\r
+  @param  LeftOrRight       The left or right banner need to check.\r
+  @param  BannerStr         Banner string need to update.\r
+                            Input the current string and user can update\r
+                            it and return the new string.\r
+\r
+**/\r
+VOID\r
+UiCustomizeFrontPageBanner (\r
+  IN     UINTN          LineIndex,\r
+  IN     BOOLEAN        LeftOrRight,\r
+  IN OUT EFI_STRING     *BannerStr\r
+  )\r
+{\r
+}\r