3 This library class defines a set of interfaces to customize Display module
5 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "CustomizedDisplayLibInternal.h"
11 EFI_GUID gCustomizedDisplayLibGuid
= { 0x99fdc8fd, 0x849b, 0x4eba, { 0xad, 0x13, 0xfb, 0x96, 0x99, 0xc9, 0xa, 0x4d } };
13 EFI_HII_HANDLE mCDLStringPackHandle
;
14 UINT16 gClassOfVfr
; // Formset class information
15 BOOLEAN gLibIsFirstForm
= TRUE
;
16 BANNER_DATA
*gBannerData
;
21 +------------------------------------------------------------------------------+
23 +------------------------------------------------------------------------------+
33 +------------------------------------------------------------------------------+
34 | F9=Reset to Defaults F10=Save |
35 | ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Exit |
36 +------------------------------------------------------------------------------+
41 This funtion defines Page Frame and Backgroud.
43 Based on the above layout, it will be responsible for HeaderHeight, FooterHeight,
44 StatusBarHeight and Backgroud. And, it will reserve Screen for Statement.
46 @param[in] FormData Form Data to be shown in Page.
47 @param[out] ScreenForStatement Screen to be used for Statement. (Prompt, Value and Help)
54 IN FORM_DISPLAY_ENGINE_FORM
*FormData
,
55 OUT EFI_SCREEN_DESCRIPTOR
*ScreenForStatement
60 ASSERT (FormData
!= NULL
&& ScreenForStatement
!= NULL
);
61 if (FormData
== NULL
|| ScreenForStatement
== NULL
) {
62 return EFI_INVALID_PARAMETER
;
65 Status
= ScreenDiemensionInfoValidate (FormData
);
66 if (EFI_ERROR (Status
)) {
70 gClassOfVfr
= FORMSET_CLASS_PLATFORM_SETUP
;
72 ProcessExternedOpcode(FormData
);
75 // Calculate the ScreenForStatement.
77 ScreenForStatement
->BottomRow
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
;
78 if (gClassOfVfr
== FORMSET_CLASS_FRONT_PAGE
) {
79 ScreenForStatement
->TopRow
= gScreenDimensions
.TopRow
+ FRONT_PAGE_HEADER_HEIGHT
;
81 ScreenForStatement
->TopRow
= gScreenDimensions
.TopRow
+ NONE_FRONT_PAGE_HEADER_HEIGHT
;
83 ScreenForStatement
->LeftColumn
= gScreenDimensions
.LeftColumn
;
84 ScreenForStatement
->RightColumn
= gScreenDimensions
.RightColumn
;
86 if ((gLibIsFirstForm
) || ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0)) {
88 // Ensure we are in Text mode
90 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
91 ClearLines (0, gScreenDimensions
.RightColumn
, 0, gScreenDimensions
.BottomRow
, KEYHELP_BACKGROUND
);
92 gLibIsFirstForm
= FALSE
;
96 // Don't print frame for modal form.
98 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
102 if (gClassOfVfr
== FORMSET_CLASS_FRONT_PAGE
) {
103 PrintBannerInfo (FormData
);
106 PrintFramework (FormData
);
108 UpdateStatusBar(NV_UPDATE_REQUIRED
, FormData
->SettingChangedFlag
);
114 This function updates customized key panel's help information.
115 The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-.
116 and arrange them in Footer panel.
118 @param[in] FormData Form Data to be shown in Page. FormData has the highlighted statement.
119 @param[in] Statement The statement current selected.
120 @param[in] Selected Whether or not a tag be selected. TRUE means Enter has hit this question.
125 IN FORM_DISPLAY_ENGINE_FORM
*FormData
,
126 IN FORM_DISPLAY_ENGINE_STATEMENT
*Statement
,
132 UINTN RightColumnOfHelp
;
134 UINTN BottomRowOfHelp
;
135 UINTN StartColumnOfHelp
;
136 EFI_IFR_NUMERIC
*NumericOp
;
137 EFI_IFR_DATE
*DateOp
;
138 EFI_IFR_TIME
*TimeOp
;
147 ASSERT (FormData
!= NULL
);
148 if (FormData
== NULL
) {
152 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_TEXT
| KEYHELP_BACKGROUND
);
154 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
158 SecCol
= gScreenDimensions
.LeftColumn
+ (gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3;
159 ThdCol
= gScreenDimensions
.LeftColumn
+ (gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3 * 2;
162 // + 2 means leave 1 space before the first hotkey info.
164 StartColumnOfHelp
= gScreenDimensions
.LeftColumn
+ 2;
165 RightColumnOfHelp
= gScreenDimensions
.RightColumn
- 1;
166 TopRowOfHelp
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
+ 1;
167 BottomRowOfHelp
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- 2;
169 ColumnWidth1
= SecCol
- StartColumnOfHelp
;
170 ColumnWidth2
= ThdCol
- SecCol
;
171 ColumnWidth3
= RightColumnOfHelp
- ThdCol
;
172 ColumnStr1
= gLibEmptyString
;
173 ColumnStr2
= gLibEmptyString
;
174 ColumnStr3
= gLibEmptyString
;
177 // Clean the space at gScreenDimensions.LeftColumn + 1.
179 PrintStringAtWithWidth (StartColumnOfHelp
- 1, BottomRowOfHelp
, gLibEmptyString
, 1);
180 PrintStringAtWithWidth (StartColumnOfHelp
- 1, TopRowOfHelp
, gLibEmptyString
, 1);
182 if (Statement
== NULL
) {
184 // Print Key for Form without showable statement.
186 PrintHotKeyHelpString (FormData
, TRUE
);
187 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
188 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth2
);
189 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
190 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
191 ColumnStr3
= gEscapeString
;
193 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
202 if (Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) {
203 NumericOp
= (EFI_IFR_NUMERIC
*) Statement
->OpCode
;
204 HexDisplay
= (NumericOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
205 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
206 DateOp
= (EFI_IFR_DATE
*) Statement
->OpCode
;
207 HexDisplay
= (DateOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
208 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
209 TimeOp
= (EFI_IFR_TIME
*) Statement
->OpCode
;
210 HexDisplay
= (TimeOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
212 switch (Statement
->OpCode
->OpCode
) {
213 case EFI_IFR_ORDERED_LIST_OP
:
214 case EFI_IFR_ONE_OF_OP
:
215 case EFI_IFR_NUMERIC_OP
:
216 case EFI_IFR_TIME_OP
:
217 case EFI_IFR_DATE_OP
:
219 PrintHotKeyHelpString (FormData
, TRUE
);
221 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
222 ColumnStr3
= gEscapeString
;
224 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
226 if ((Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) ||
227 (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
239 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterString
, ColumnWidth2
);
240 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gAdjustNumber
, ColumnWidth1
);
242 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
243 if (Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
&& NumericOp
!= NULL
&& LibGetFieldFromNum(Statement
->OpCode
) != 0) {
244 ColumnStr1
= gAdjustNumber
;
246 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
247 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterString
, ColumnWidth2
);
250 PrintHotKeyHelpString (FormData
, FALSE
);
251 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterCommitString
, ColumnWidth2
);
254 // If it is a selected numeric with manual input, display different message
256 if ((Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) ||
257 (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) ||
258 (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
259 ColumnStr2
= HexDisplay
? gHexNumericInput
: gDecNumericInput
;
260 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
262 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
265 if (Statement
->OpCode
->OpCode
== EFI_IFR_ORDERED_LIST_OP
) {
266 ColumnStr1
= gPlusString
;
267 ColumnStr3
= gMinusString
;
269 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
270 PrintStringAtWithWidth (ThdCol
, TopRowOfHelp
, ColumnStr3
, ColumnWidth3
);
271 PrintStringAtWithWidth (SecCol
, TopRowOfHelp
, ColumnStr2
, ColumnWidth2
);
273 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, gEnterEscapeString
, ColumnWidth3
);
277 case EFI_IFR_CHECKBOX_OP
:
278 PrintHotKeyHelpString (FormData
, TRUE
);
280 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
281 ColumnStr3
= gEscapeString
;
283 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
285 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
286 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gToggleCheckBox
, ColumnWidth2
);
287 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
291 case EFI_IFR_PASSWORD_OP
:
292 case EFI_IFR_STRING_OP
:
293 case EFI_IFR_TEXT_OP
:
294 case EFI_IFR_ACTION_OP
:
295 case EFI_IFR_RESET_BUTTON_OP
:
296 case EFI_IFR_SUBTITLE_OP
:
298 PrintHotKeyHelpString (FormData
, TRUE
);
300 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
301 ColumnStr3
= gEscapeString
;
303 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
305 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
306 if (Statement
->OpCode
->OpCode
!= EFI_IFR_TEXT_OP
&& Statement
->OpCode
->OpCode
!= EFI_IFR_SUBTITLE_OP
) {
307 ColumnStr2
= gEnterString
;
309 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, ColumnStr2
, ColumnWidth2
);
310 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
312 PrintHotKeyHelpString (FormData
, FALSE
);
313 if (Statement
->OpCode
->OpCode
!= EFI_IFR_REF_OP
) {
314 ColumnStr2
= gEnterCommitString
;
315 ColumnStr3
= gEnterEscapeString
;
317 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
318 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, ColumnStr1
, ColumnWidth1
);
319 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, ColumnStr2
, ColumnWidth2
);
320 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
332 This function updates the status bar on the bottom of menu screen. It just shows StatusBar.
333 Original logic in this function should be splitted out.
335 @param[in] MessageType The type of message to be shown. InputError or Configuration Changed.
336 @param[in] State Show or Clear Message.
341 IN UINTN MessageType
,
348 OptionWidth
= (CHAR16
) ((gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3);
350 switch (MessageType
) {
353 gST
->ConOut
->SetAttribute (gST
->ConOut
, ERROR_TEXT
);
355 gScreenDimensions
.LeftColumn
+ OptionWidth
,
356 gScreenDimensions
.BottomRow
- 1,
360 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_BACKGROUND
);
361 for (Index
= 0; Index
< (LibGetStringWidth (gInputErrorMessage
) - 2) / 2; Index
++) {
362 PrintStringAt (gScreenDimensions
.LeftColumn
+ OptionWidth
+ Index
, gScreenDimensions
.BottomRow
- 1, L
" ");
367 case NV_UPDATE_REQUIRED
:
369 // Global setting support. Show configuration change on every form.
372 gST
->ConOut
->SetAttribute (gST
->ConOut
, INFO_TEXT
);
374 gScreenDimensions
.LeftColumn
+ OptionWidth
* 2,
375 gScreenDimensions
.BottomRow
- 1,
379 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_BACKGROUND
);
380 for (Index
= 0; Index
< (LibGetStringWidth (gNvUpdateMessage
) - 2) / 2; Index
++) {
382 (gScreenDimensions
.LeftColumn
+ OptionWidth
* 2 + Index
),
383 gScreenDimensions
.BottomRow
- 1,
396 Create popup window. It will replace CreateDialog().
398 This function draws OEM/Vendor specific pop up windows.
400 @param[out] Key User Input Key
401 @param ... String to be shown in Popup. The variable argument list is terminated by a NULL.
407 OUT EFI_INPUT_KEY
*Key
, OPTIONAL
412 EFI_INPUT_KEY KeyValue
;
424 UINTN DimensionsWidth
;
425 UINTN DimensionsHeight
;
426 UINTN CurrentAttribute
;
427 BOOLEAN CursorVisible
;
430 // If screen dimension info is not ready, get it from console.
432 if (gScreenDimensions
.RightColumn
== 0 || gScreenDimensions
.BottomRow
== 0) {
433 ZeroMem (&gScreenDimensions
, sizeof (EFI_SCREEN_DESCRIPTOR
));
434 gST
->ConOut
->QueryMode (
436 gST
->ConOut
->Mode
->Mode
,
437 &gScreenDimensions
.RightColumn
,
438 &gScreenDimensions
.BottomRow
442 DimensionsWidth
= gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
;
443 DimensionsHeight
= gScreenDimensions
.BottomRow
- gScreenDimensions
.TopRow
;
447 VA_START (Marker
, Key
);
448 while ((String
= VA_ARG (Marker
, CHAR16
*)) != NULL
) {
451 if ((LibGetStringWidth (String
) / 2) > LargestString
) {
452 LargestString
= (LibGetStringWidth (String
) / 2);
457 if ((LargestString
+ 2) > DimensionsWidth
) {
458 LargestString
= DimensionsWidth
- 2;
461 CurrentAttribute
= gST
->ConOut
->Mode
->Attribute
;
462 CursorVisible
= gST
->ConOut
->Mode
->CursorVisible
;
463 gST
->ConOut
->EnableCursor (gST
->ConOut
, FALSE
);
464 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
467 // Subtract the PopUp width from total Columns, allow for one space extra on
468 // each end plus a border.
470 Start
= (DimensionsWidth
- LargestString
- 2) / 2 + gScreenDimensions
.LeftColumn
+ 1;
471 End
= Start
+ LargestString
+ 1;
473 Top
= ((DimensionsHeight
- LineNum
- 2) / 2) + gScreenDimensions
.TopRow
- 1;
474 Bottom
= Top
+ LineNum
+ 2;
476 Character
= BOXDRAW_DOWN_RIGHT
;
477 PrintCharAt (Start
, Top
, Character
);
478 Character
= BOXDRAW_HORIZONTAL
;
479 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
480 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
483 Character
= BOXDRAW_DOWN_LEFT
;
484 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
485 Character
= BOXDRAW_VERTICAL
;
488 VA_START (Marker
, Key
);
489 for (Index
= Top
; Index
+ 2 < Bottom
; Index
++, Count
++) {
490 String
= VA_ARG (Marker
, CHAR16
*);
492 if (String
[0] == CHAR_NULL
) {
494 // Passing in a NULL results in a blank space
496 ClearLines (Start
, End
, Index
+ 1, Index
+ 1, GetPopupColor ());
497 } else if (String
[0] == L
' ') {
499 // Passing in a space results in the assumption that this is where typing will occur
501 ClearLines (Start
+ 1, End
- 1, Index
+ 1, Index
+ 1, POPUP_INVERSE_TEXT
| POPUP_INVERSE_BACKGROUND
);
503 ((DimensionsWidth
- LibGetStringWidth (String
) / 2) / 2) + gScreenDimensions
.LeftColumn
+ 1,
509 // This will clear the background of the line - we never know who might have been
510 // here before us. This differs from the next clear in that it used the non-reverse
511 // video for normal printing.
513 ClearLines (Start
, End
, Index
+ 1, Index
+ 1, GetPopupColor ());
515 ((DimensionsWidth
- LibGetStringWidth (String
) / 2) / 2) + gScreenDimensions
.LeftColumn
+ 1,
521 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
522 PrintCharAt (Start
, Index
+ 1, Character
);
523 PrintCharAt (End
- 1, Index
+ 1, Character
);
527 Character
= BOXDRAW_UP_RIGHT
;
528 PrintCharAt (Start
, Bottom
- 1, Character
);
529 Character
= BOXDRAW_HORIZONTAL
;
530 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
531 PrintCharAt ((UINTN
)-1, (UINTN
) -1, Character
);
534 Character
= BOXDRAW_UP_LEFT
;
535 PrintCharAt ((UINTN
)-1, (UINTN
) -1, Character
);
538 Status
= WaitForKeyStroke (&KeyValue
);
539 ASSERT_EFI_ERROR (Status
);
540 CopyMem (Key
, &KeyValue
, sizeof (EFI_INPUT_KEY
));
543 gST
->ConOut
->SetAttribute (gST
->ConOut
, CurrentAttribute
);
544 gST
->ConOut
->EnableCursor (gST
->ConOut
, CursorVisible
);
548 Confirm how to handle the changed data.
550 @return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values.
562 gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
564 YesResponse
= gYesResponse
[0];
565 NoResponse
= gNoResponse
[0];
568 // If NV flag is up, prompt user
571 CreateDialog (&Key
, gLibEmptyString
, gSaveChanges
, gAreYouSure
, gLibEmptyString
, NULL
);
574 (Key
.ScanCode
!= SCAN_ESC
) &&
575 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (NoResponse
| UPPER_LOWER_CASE_OFFSET
)) &&
576 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (YesResponse
| UPPER_LOWER_CASE_OFFSET
))
579 if (Key
.ScanCode
== SCAN_ESC
) {
580 return BROWSER_ACTION_NONE
;
581 } else if ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) == (YesResponse
| UPPER_LOWER_CASE_OFFSET
)) {
582 return BROWSER_ACTION_SUBMIT
;
584 return BROWSER_ACTION_DISCARD
;
589 OEM specifies whether Setup exits Page by ESC key.
591 This function customized the behavior that whether Setup exits Page so that
592 system able to boot when configuration is not changed.
594 @retval TRUE Exits FrontPage
595 @retval FALSE Don't exit FrontPage.
603 return gClassOfVfr
== FORMSET_CLASS_FRONT_PAGE
? FALSE
: TRUE
;
607 Set Timeout value for a ceratain Form to get user response.
609 This function allows to set timeout value on a ceratain form if necessary.
610 If timeout is not zero, the form will exit if user has no response in timeout.
612 @param[in] FormData Form Data to be shown in Page
614 @return 0 No timeout for this form.
615 @return > 0 Timeout value in 100 ns units.
620 IN FORM_DISPLAY_ENGINE_FORM
*FormData
629 Prints a unicode string to the default console, at
630 the supplied cursor position, using L"%s" format.
632 @param Column The cursor position to print the string at. When it is -1, use current Position.
633 @param Row The cursor position to print the string at. When it is -1, use current Position.
634 @param String String pointer.
636 @return Length of string printed to the console
647 return PrintAt (0, Column
, Row
, L
"%s", String
);
651 Prints a unicode string to the default console, at
652 the supplied cursor position, using L"%s" format.
654 @param Column The cursor position to print the string at. When it is -1, use current Position.
655 @param Row The cursor position to print the string at. When it is -1, use current Position.
656 @param String String pointer.
657 @param Width Width for String.
659 @return Length of string printed to the console
664 PrintStringAtWithWidth (
671 return PrintAt (Width
, Column
, Row
, L
"%s", String
);
675 Prints a character to the default console, at
676 the supplied cursor position, using L"%c" format.
678 @param Column The cursor position to print the string at. When it is -1, use current Position.
679 @param Row The cursor position to print the string at. When it is -1, use current Position.
680 @param Character Character to print.
682 @return Length of string printed to the console.
693 return PrintAt (0, Column
, Row
, L
"%c", Character
);
697 Clear retangle with specified text attribute.
699 @param LeftColumn Left column of retangle.
700 @param RightColumn Right column of retangle.
701 @param TopRow Start row of retangle.
702 @param BottomRow End row of retangle.
703 @param TextAttribute The character foreground and background.
710 IN UINTN RightColumn
,
713 IN UINTN TextAttribute
720 // For now, allocate an arbitrarily long buffer
722 Buffer
= AllocateZeroPool (0x10000);
723 ASSERT (Buffer
!= NULL
);
726 // Set foreground and background as defined
728 gST
->ConOut
->SetAttribute (gST
->ConOut
, TextAttribute
);
731 // Much faster to buffer the long string instead of print it a character at a time
733 LibSetUnicodeMem (Buffer
, RightColumn
- LeftColumn
, L
' ');
736 // Clear the desired area with the appropriate foreground/background
738 for (Row
= TopRow
; Row
<= BottomRow
; Row
++) {
739 PrintStringAt (LeftColumn
, Row
, Buffer
);
742 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, LeftColumn
, TopRow
);
748 // Color Setting Functions
752 Get OEM/Vendor specific popup attribute colors.
754 @retval Byte code color setting for popup color.
762 return POPUP_TEXT
| POPUP_BACKGROUND
;
766 Get OEM/Vendor specific popup attribute colors.
768 @retval Byte code color setting for popup inverse color.
772 GetPopupInverseColor (
776 return POPUP_INVERSE_TEXT
| POPUP_INVERSE_BACKGROUND
;
780 Get OEM/Vendor specific PickList color attribute.
782 @retval Byte code color setting for pick list color.
790 return PICKLIST_HIGHLIGHT_TEXT
| PICKLIST_HIGHLIGHT_BACKGROUND
;
794 Get OEM/Vendor specific arrow color attribute.
796 @retval Byte code color setting for arrow color.
804 return ARROW_TEXT
| ARROW_BACKGROUND
;
808 Get OEM/Vendor specific info text color attribute.
810 @retval Byte code color setting for info text color.
818 return INFO_TEXT
| FIELD_BACKGROUND
;
822 Get OEM/Vendor specific help text color attribute.
824 @retval Byte code color setting for help text color.
832 return HELP_TEXT
| FIELD_BACKGROUND
;
836 Get OEM/Vendor specific grayed out text color attribute.
838 @retval Byte code color setting for grayed out text color.
846 return FIELD_TEXT_GRAYED
| FIELD_BACKGROUND
;
850 Get OEM/Vendor specific highlighted text color attribute.
852 @retval Byte code color setting for highlight text color.
856 GetHighlightTextColor (
860 return PcdGet8 (PcdBrowserFieldTextHighlightColor
) | PcdGet8 (PcdBrowserFieldBackgroundHighlightColor
);
864 Get OEM/Vendor specific field text color attribute.
866 @retval Byte code color setting for field text color.
874 return PcdGet8 (PcdBrowserFieldTextColor
) | FIELD_BACKGROUND
;
878 Get OEM/Vendor specific subtitle text color attribute.
880 @retval Byte code color setting for subtitle text color.
884 GetSubTitleTextColor (
888 return PcdGet8 (PcdBrowserSubtitleTextColor
) | FIELD_BACKGROUND
;
892 Clear Screen to the initial state.
900 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
901 gST
->ConOut
->ClearScreen (gST
->ConOut
);
902 gLibIsFirstForm
= TRUE
;
906 Constructor of Customized Display Library Instance.
908 @param ImageHandle The firmware allocated handle for the EFI image.
909 @param SystemTable A pointer to the EFI System Table.
911 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
916 CustomizedDisplayLibConstructor (
917 IN EFI_HANDLE ImageHandle
,
918 IN EFI_SYSTEM_TABLE
*SystemTable
921 mCDLStringPackHandle
= HiiAddPackages (&gCustomizedDisplayLibGuid
, ImageHandle
, CustomizedDisplayLibStrings
, NULL
);
922 ASSERT (mCDLStringPackHandle
!= NULL
);
924 InitializeLibStrings();
930 Destructor of Customized Display Library Instance.
932 @param ImageHandle The firmware allocated handle for the EFI image.
933 @param SystemTable A pointer to the EFI System Table.
935 @retval EFI_SUCCESS The destructor completed successfully.
936 @retval Other value The destructor did not complete successfully.
941 CustomizedDisplayLibDestructor (
942 IN EFI_HANDLE ImageHandle
,
943 IN EFI_SYSTEM_TABLE
*SystemTable
946 HiiRemovePackages(mCDLStringPackHandle
);