3 This library class defines a set of interfaces to customize Ui module
5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Protocol/HiiConfigAccess.h>
17 #include <Library/BaseLib.h>
18 #include <Library/MemoryAllocationLib.h>
19 #include "FrontPage.h"
20 #include "FrontPageCustomizedUiSupport.h"
22 extern FRONT_PAGE_CALLBACK_DATA gFrontPagePrivate
;
25 Customize menus in the page.
27 @param[in] HiiHandle The HII Handle of the form to update.
28 @param[in] StartOpCodeHandle The context used to insert opcode.
29 @param[in] CustomizePageType The page type need to be customized.
33 UiCustomizeFrontPage (
34 IN EFI_HII_HANDLE HiiHandle
,
35 IN VOID
*StartOpCodeHandle
39 // Create "Select Language" menu with Oneof opcode.
41 UiCreateLanguageMenu (HiiHandle
, StartOpCodeHandle
);
46 UiCreateEmptyLine(HiiHandle
, StartOpCodeHandle
);
49 // Find third party drivers which need to be shown in the front page.
51 UiListThirdPartyDrivers (HiiHandle
, &gEfiIfrFrontPageGuid
, NULL
, StartOpCodeHandle
);
56 UiCreateEmptyLine(HiiHandle
, StartOpCodeHandle
);
59 // Create "Continue" menu.
61 UiCreateContinueMenu(HiiHandle
, StartOpCodeHandle
);
66 UiCreateResetMenu(HiiHandle
, StartOpCodeHandle
);
70 This function processes the results of changes in configuration.
73 @param HiiHandle Points to the hii handle for this formset.
74 @param Action Specifies the type of action taken by the browser.
75 @param QuestionId A unique value which is sent to the original exporting driver
76 so that it can identify the type of data to expect.
77 @param Type The type of value for the question.
78 @param Value A pointer to the data being sent to the original exporting driver.
79 @param ActionRequest On return, points to the action requested by the callback function.
81 @retval EFI_SUCCESS The callback successfully handled the action.
82 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
83 @retval EFI_DEVICE_ERROR The variable could not be saved.
84 @retval EFI_UNSUPPORTED The specified Action is not supported by the callback.
88 UiFrontPageCallbackHandler (
89 IN EFI_HII_HANDLE HiiHandle
,
90 IN EFI_BROWSER_ACTION Action
,
91 IN EFI_QUESTION_ID QuestionId
,
93 IN EFI_IFR_TYPE_VALUE
*Value
,
94 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
99 if (UiSupportLibCallbackHandler (HiiHandle
, Action
, QuestionId
, Type
, Value
, ActionRequest
, &Status
)) {
103 return EFI_UNSUPPORTED
;
107 Update the banner string in the front page.
109 Current layout for the banner string like below:
110 PS: Totally only 5 lines of banner supported.
112 Line 1: Left BannerStr RightBannerStr
113 Line 2: Left BannerStr RightBannerStr
114 Line 3: Left BannerStr RightBannerStr
115 Line 4: Left BannerStr RightBannerStr
116 Line 5: Left BannerStr RightBannerStr
118 First menu in front page.
121 @param LineIndex The line index of the banner need to check.
122 @param LeftOrRight The left or right banner need to check.
123 @param BannerStr Banner string need to update.
124 Input the current string and user can update
125 it and return the new string.
129 UiCustomizeFrontPageBanner (
131 IN BOOLEAN LeftOrRight
,
132 IN OUT EFI_STRING
*BannerStr
135 if ((LineIndex
== 5) && LeftOrRight
) {
136 // Update STR_CUSTOMIZE_BANNER_LINE5_LEFT
137 if (PcdGetBool(PcdTestKeyUsed
)) {
138 if (BannerStr
!= NULL
) {
139 FreePool(*BannerStr
);
141 *BannerStr
= HiiGetString(gFrontPagePrivate
.HiiHandle
, STRING_TOKEN(STR_TEST_KEY_USED
), NULL
);