3 This library class defines a set of interfaces to customize Display module
5 Copyright (c) 2013 - 2014, 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.
15 #include "CustomizedDisplayLibInternal.h"
17 EFI_GUID gCustomizedDisplayLibGuid
= { 0x99fdc8fd, 0x849b, 0x4eba, { 0xad, 0x13, 0xfb, 0x96, 0x99, 0xc9, 0xa, 0x4d } };
19 EFI_HII_HANDLE mCDLStringPackHandle
;
20 UINT16 gClassOfVfr
; // Formset class information
21 BOOLEAN gLibIsFirstForm
= TRUE
;
22 BANNER_DATA
*gBannerData
;
27 +------------------------------------------------------------------------------+
29 +------------------------------------------------------------------------------+
39 +------------------------------------------------------------------------------+
40 | F9=Reset to Defaults F10=Save |
41 | ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Exit |
42 +------------------------------------------------------------------------------+
47 This funtion defines Page Frame and Backgroud.
49 Based on the above layout, it will be responsible for HeaderHeight, FooterHeight,
50 StatusBarHeight and Backgroud. And, it will reserve Screen for Statement.
52 @param[in] FormData Form Data to be shown in Page.
53 @param[out] ScreenForStatement Screen to be used for Statement. (Prompt, Value and Help)
60 IN FORM_DISPLAY_ENGINE_FORM
*FormData
,
61 OUT EFI_SCREEN_DESCRIPTOR
*ScreenForStatement
66 ASSERT (FormData
!= NULL
&& ScreenForStatement
!= NULL
);
67 if (FormData
== NULL
|| ScreenForStatement
== NULL
) {
68 return EFI_INVALID_PARAMETER
;
71 Status
= ScreenDiemensionInfoValidate (FormData
);
72 if (EFI_ERROR (Status
)) {
76 gClassOfVfr
= FORMSET_CLASS_PLATFORM_SETUP
;
78 ProcessExternedOpcode(FormData
);
81 // Calculate the ScreenForStatement.
83 ScreenForStatement
->BottomRow
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
;
84 if (gClassOfVfr
== FORMSET_CLASS_FRONT_PAGE
) {
85 ScreenForStatement
->TopRow
= gScreenDimensions
.TopRow
+ FRONT_PAGE_HEADER_HEIGHT
;
87 ScreenForStatement
->TopRow
= gScreenDimensions
.TopRow
+ NONE_FRONT_PAGE_HEADER_HEIGHT
;
89 ScreenForStatement
->LeftColumn
= gScreenDimensions
.LeftColumn
;
90 ScreenForStatement
->RightColumn
= gScreenDimensions
.RightColumn
;
92 if ((gLibIsFirstForm
) || ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0)) {
94 // Ensure we are in Text mode
96 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
97 ClearLines (0, gScreenDimensions
.RightColumn
, 0, gScreenDimensions
.BottomRow
, KEYHELP_BACKGROUND
);
98 gLibIsFirstForm
= FALSE
;
102 // Don't print frame for modal form.
104 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
108 if (gClassOfVfr
== FORMSET_CLASS_FRONT_PAGE
) {
109 PrintBannerInfo (FormData
);
112 PrintFramework (FormData
);
114 UpdateStatusBar(NV_UPDATE_REQUIRED
, FormData
->SettingChangedFlag
);
120 This function updates customized key panel's help information.
121 The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-.
122 and arrange them in Footer panel.
124 @param[in] FormData Form Data to be shown in Page. FormData has the highlighted statement.
125 @param[in] Statement The statement current selected.
126 @param[in] Selected Whether or not a tag be selected. TRUE means Enter has hit this question.
131 IN FORM_DISPLAY_ENGINE_FORM
*FormData
,
132 IN FORM_DISPLAY_ENGINE_STATEMENT
*Statement
,
138 UINTN RightColumnOfHelp
;
140 UINTN BottomRowOfHelp
;
141 UINTN StartColumnOfHelp
;
142 EFI_IFR_NUMERIC
*NumericOp
;
143 EFI_IFR_DATE
*DateOp
;
144 EFI_IFR_TIME
*TimeOp
;
153 ASSERT (FormData
!= NULL
);
154 if (FormData
== NULL
) {
158 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_TEXT
| KEYHELP_BACKGROUND
);
160 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
164 SecCol
= gScreenDimensions
.LeftColumn
+ (gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3;
165 ThdCol
= gScreenDimensions
.LeftColumn
+ (gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3 * 2;
168 // + 2 means leave 1 space before the first hotkey info.
170 StartColumnOfHelp
= gScreenDimensions
.LeftColumn
+ 2;
171 RightColumnOfHelp
= gScreenDimensions
.RightColumn
- 1;
172 TopRowOfHelp
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
+ 1;
173 BottomRowOfHelp
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- 2;
175 ColumnWidth1
= SecCol
- StartColumnOfHelp
;
176 ColumnWidth2
= ThdCol
- SecCol
;
177 ColumnWidth3
= RightColumnOfHelp
- ThdCol
;
178 ColumnStr1
= gLibEmptyString
;
179 ColumnStr2
= gLibEmptyString
;
180 ColumnStr3
= gLibEmptyString
;
183 // Clean the space at gScreenDimensions.LeftColumn + 1.
185 PrintStringAtWithWidth (StartColumnOfHelp
- 1, BottomRowOfHelp
, gLibEmptyString
, 1);
186 PrintStringAtWithWidth (StartColumnOfHelp
- 1, TopRowOfHelp
, gLibEmptyString
, 1);
188 if (Statement
== NULL
) {
190 // Print Key for Form without showable statement.
192 PrintHotKeyHelpString (FormData
, TRUE
);
193 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
194 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth2
);
195 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
196 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
197 ColumnStr3
= gEscapeString
;
199 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
208 if (Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) {
209 NumericOp
= (EFI_IFR_NUMERIC
*) Statement
->OpCode
;
210 HexDisplay
= (NumericOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
211 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
212 DateOp
= (EFI_IFR_DATE
*) Statement
->OpCode
;
213 HexDisplay
= (DateOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
214 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
215 TimeOp
= (EFI_IFR_TIME
*) Statement
->OpCode
;
216 HexDisplay
= (TimeOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
218 switch (Statement
->OpCode
->OpCode
) {
219 case EFI_IFR_ORDERED_LIST_OP
:
220 case EFI_IFR_ONE_OF_OP
:
221 case EFI_IFR_NUMERIC_OP
:
222 case EFI_IFR_TIME_OP
:
223 case EFI_IFR_DATE_OP
:
225 PrintHotKeyHelpString (FormData
, TRUE
);
227 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
228 ColumnStr3
= gEscapeString
;
230 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
232 if ((Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) ||
233 (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
245 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterString
, ColumnWidth2
);
246 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gAdjustNumber
, ColumnWidth1
);
248 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
249 if (Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
&& NumericOp
!= NULL
&& LibGetFieldFromNum(Statement
->OpCode
) != 0) {
250 ColumnStr1
= gAdjustNumber
;
252 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
253 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterString
, ColumnWidth2
);
256 PrintHotKeyHelpString (FormData
, FALSE
);
257 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterCommitString
, ColumnWidth2
);
260 // If it is a selected numeric with manual input, display different message
262 if ((Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) ||
263 (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) ||
264 (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
265 ColumnStr2
= HexDisplay
? gHexNumericInput
: gDecNumericInput
;
266 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
268 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
271 if (Statement
->OpCode
->OpCode
== EFI_IFR_ORDERED_LIST_OP
) {
272 ColumnStr1
= gPlusString
;
273 ColumnStr3
= gMinusString
;
275 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
276 PrintStringAtWithWidth (ThdCol
, TopRowOfHelp
, ColumnStr3
, ColumnWidth3
);
277 PrintStringAtWithWidth (SecCol
, TopRowOfHelp
, ColumnStr2
, ColumnWidth2
);
279 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, gEnterEscapeString
, ColumnWidth3
);
283 case EFI_IFR_CHECKBOX_OP
:
284 PrintHotKeyHelpString (FormData
, TRUE
);
286 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
287 ColumnStr3
= gEscapeString
;
289 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
291 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
292 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gToggleCheckBox
, ColumnWidth2
);
293 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
297 case EFI_IFR_PASSWORD_OP
:
298 case EFI_IFR_STRING_OP
:
299 case EFI_IFR_TEXT_OP
:
300 case EFI_IFR_ACTION_OP
:
301 case EFI_IFR_RESET_BUTTON_OP
:
302 case EFI_IFR_SUBTITLE_OP
:
304 PrintHotKeyHelpString (FormData
, TRUE
);
306 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
307 ColumnStr3
= gEscapeString
;
309 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
311 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
312 if (Statement
->OpCode
->OpCode
!= EFI_IFR_TEXT_OP
&& Statement
->OpCode
->OpCode
!= EFI_IFR_SUBTITLE_OP
) {
313 ColumnStr2
= gEnterString
;
315 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, ColumnStr2
, ColumnWidth2
);
316 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
318 PrintHotKeyHelpString (FormData
, FALSE
);
319 if (Statement
->OpCode
->OpCode
!= EFI_IFR_REF_OP
) {
320 ColumnStr2
= gEnterCommitString
;
321 ColumnStr3
= gEnterEscapeString
;
323 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
324 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, ColumnStr1
, ColumnWidth1
);
325 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, ColumnStr2
, ColumnWidth2
);
326 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
338 This function updates the status bar on the bottom of menu screen. It just shows StatusBar.
339 Original logic in this function should be splitted out.
341 @param[in] MessageType The type of message to be shown. InputError or Configuration Changed.
342 @param[in] State Show or Clear Message.
347 IN UINTN MessageType
,
354 OptionWidth
= (CHAR16
) ((gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3);
356 switch (MessageType
) {
359 gST
->ConOut
->SetAttribute (gST
->ConOut
, ERROR_TEXT
);
361 gScreenDimensions
.LeftColumn
+ OptionWidth
,
362 gScreenDimensions
.BottomRow
- 1,
366 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_BACKGROUND
);
367 for (Index
= 0; Index
< (LibGetStringWidth (gInputErrorMessage
) - 2) / 2; Index
++) {
368 PrintStringAt (gScreenDimensions
.LeftColumn
+ OptionWidth
+ Index
, gScreenDimensions
.BottomRow
- 1, L
" ");
373 case NV_UPDATE_REQUIRED
:
375 // Global setting support. Show configuration change on every form.
378 gST
->ConOut
->SetAttribute (gST
->ConOut
, INFO_TEXT
);
380 gScreenDimensions
.LeftColumn
+ OptionWidth
* 2,
381 gScreenDimensions
.BottomRow
- 1,
385 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_BACKGROUND
);
386 for (Index
= 0; Index
< (LibGetStringWidth (gNvUpdateMessage
) - 2) / 2; Index
++) {
388 (gScreenDimensions
.LeftColumn
+ OptionWidth
* 2 + Index
),
389 gScreenDimensions
.BottomRow
- 1,
402 Create popup window. It will replace CreateDialog().
404 This function draws OEM/Vendor specific pop up windows.
406 @param[out] Key User Input Key
407 @param ... String to be shown in Popup. The variable argument list is terminated by a NULL.
413 OUT EFI_INPUT_KEY
*Key
, OPTIONAL
418 EFI_INPUT_KEY KeyValue
;
430 UINTN DimensionsWidth
;
431 UINTN DimensionsHeight
;
432 UINTN CurrentAttribute
;
433 BOOLEAN CursorVisible
;
436 // If screen dimension info is not ready, get it from console.
438 if (gScreenDimensions
.RightColumn
== 0 || gScreenDimensions
.BottomRow
== 0) {
439 ZeroMem (&gScreenDimensions
, sizeof (EFI_SCREEN_DESCRIPTOR
));
440 gST
->ConOut
->QueryMode (
442 gST
->ConOut
->Mode
->Mode
,
443 &gScreenDimensions
.RightColumn
,
444 &gScreenDimensions
.BottomRow
448 DimensionsWidth
= gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
;
449 DimensionsHeight
= gScreenDimensions
.BottomRow
- gScreenDimensions
.TopRow
;
453 VA_START (Marker
, Key
);
454 while ((String
= VA_ARG (Marker
, CHAR16
*)) != NULL
) {
457 if ((LibGetStringWidth (String
) / 2) > LargestString
) {
458 LargestString
= (LibGetStringWidth (String
) / 2);
463 if ((LargestString
+ 2) > DimensionsWidth
) {
464 LargestString
= DimensionsWidth
- 2;
467 CurrentAttribute
= gST
->ConOut
->Mode
->Attribute
;
468 CursorVisible
= gST
->ConOut
->Mode
->CursorVisible
;
469 gST
->ConOut
->EnableCursor (gST
->ConOut
, FALSE
);
470 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
473 // Subtract the PopUp width from total Columns, allow for one space extra on
474 // each end plus a border.
476 Start
= (DimensionsWidth
- LargestString
- 2) / 2 + gScreenDimensions
.LeftColumn
+ 1;
477 End
= Start
+ LargestString
+ 1;
479 Top
= ((DimensionsHeight
- LineNum
- 2) / 2) + gScreenDimensions
.TopRow
- 1;
480 Bottom
= Top
+ LineNum
+ 2;
482 Character
= BOXDRAW_DOWN_RIGHT
;
483 PrintCharAt (Start
, Top
, Character
);
484 Character
= BOXDRAW_HORIZONTAL
;
485 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
486 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
489 Character
= BOXDRAW_DOWN_LEFT
;
490 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
491 Character
= BOXDRAW_VERTICAL
;
494 VA_START (Marker
, Key
);
495 for (Index
= Top
; Index
+ 2 < Bottom
; Index
++, Count
++) {
496 String
= VA_ARG (Marker
, CHAR16
*);
498 if (String
[0] == CHAR_NULL
) {
500 // Passing in a NULL results in a blank space
502 ClearLines (Start
, End
, Index
+ 1, Index
+ 1, GetPopupColor ());
503 } else if (String
[0] == L
' ') {
505 // Passing in a space results in the assumption that this is where typing will occur
507 ClearLines (Start
+ 1, End
- 1, Index
+ 1, Index
+ 1, POPUP_INVERSE_TEXT
| POPUP_INVERSE_BACKGROUND
);
509 ((DimensionsWidth
- LibGetStringWidth (String
) / 2) / 2) + gScreenDimensions
.LeftColumn
+ 1,
515 // This will clear the background of the line - we never know who might have been
516 // here before us. This differs from the next clear in that it used the non-reverse
517 // video for normal printing.
519 ClearLines (Start
, End
, Index
+ 1, Index
+ 1, GetPopupColor ());
521 ((DimensionsWidth
- LibGetStringWidth (String
) / 2) / 2) + gScreenDimensions
.LeftColumn
+ 1,
527 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
528 PrintCharAt (Start
, Index
+ 1, Character
);
529 PrintCharAt (End
- 1, Index
+ 1, Character
);
533 Character
= BOXDRAW_UP_RIGHT
;
534 PrintCharAt (Start
, Bottom
- 1, Character
);
535 Character
= BOXDRAW_HORIZONTAL
;
536 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
537 PrintCharAt ((UINTN
)-1, (UINTN
) -1, Character
);
540 Character
= BOXDRAW_UP_LEFT
;
541 PrintCharAt ((UINTN
)-1, (UINTN
) -1, Character
);
544 Status
= WaitForKeyStroke (&KeyValue
);
545 ASSERT_EFI_ERROR (Status
);
546 CopyMem (Key
, &KeyValue
, sizeof (EFI_INPUT_KEY
));
549 gST
->ConOut
->SetAttribute (gST
->ConOut
, CurrentAttribute
);
550 gST
->ConOut
->EnableCursor (gST
->ConOut
, CursorVisible
);
554 Confirm how to handle the changed data.
556 @return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values.
568 gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
570 YesResponse
= gYesResponse
[0];
571 NoResponse
= gNoResponse
[0];
574 // If NV flag is up, prompt user
577 CreateDialog (&Key
, gLibEmptyString
, gSaveChanges
, gAreYouSure
, gLibEmptyString
, NULL
);
580 (Key
.ScanCode
!= SCAN_ESC
) &&
581 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (NoResponse
| UPPER_LOWER_CASE_OFFSET
)) &&
582 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (YesResponse
| UPPER_LOWER_CASE_OFFSET
))
585 if (Key
.ScanCode
== SCAN_ESC
) {
586 return BROWSER_ACTION_NONE
;
587 } else if ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) == (YesResponse
| UPPER_LOWER_CASE_OFFSET
)) {
588 return BROWSER_ACTION_SUBMIT
;
590 return BROWSER_ACTION_DISCARD
;
595 OEM specifies whether Setup exits Page by ESC key.
597 This function customized the behavior that whether Setup exits Page so that
598 system able to boot when configuration is not changed.
600 @retval TRUE Exits FrontPage
601 @retval FALSE Don't exit FrontPage.
609 return gClassOfVfr
== FORMSET_CLASS_FRONT_PAGE
? FALSE
: TRUE
;
613 Set Timeout value for a ceratain Form to get user response.
615 This function allows to set timeout value on a ceratain form if necessary.
616 If timeout is not zero, the form will exit if user has no response in timeout.
618 @param[in] FormData Form Data to be shown in Page
620 @return 0 No timeout for this form.
621 @return > 0 Timeout value in 100 ns units.
626 IN FORM_DISPLAY_ENGINE_FORM
*FormData
635 Prints a unicode string to the default console, at
636 the supplied cursor position, using L"%s" format.
638 @param Column The cursor position to print the string at. When it is -1, use current Position.
639 @param Row The cursor position to print the string at. When it is -1, use current Position.
640 @param String String pointer.
642 @return Length of string printed to the console
653 return PrintAt (0, Column
, Row
, L
"%s", String
);
657 Prints a unicode string to the default console, at
658 the supplied cursor position, using L"%s" format.
660 @param Column The cursor position to print the string at. When it is -1, use current Position.
661 @param Row The cursor position to print the string at. When it is -1, use current Position.
662 @param String String pointer.
663 @param Width Width for String.
665 @return Length of string printed to the console
670 PrintStringAtWithWidth (
677 return PrintAt (Width
, Column
, Row
, L
"%s", String
);
681 Prints a character to the default console, at
682 the supplied cursor position, using L"%c" format.
684 @param Column The cursor position to print the string at. When it is -1, use current Position.
685 @param Row The cursor position to print the string at. When it is -1, use current Position.
686 @param Character Character to print.
688 @return Length of string printed to the console.
699 return PrintAt (0, Column
, Row
, L
"%c", Character
);
703 Clear retangle with specified text attribute.
705 @param LeftColumn Left column of retangle.
706 @param RightColumn Right column of retangle.
707 @param TopRow Start row of retangle.
708 @param BottomRow End row of retangle.
709 @param TextAttribute The character foreground and background.
716 IN UINTN RightColumn
,
719 IN UINTN TextAttribute
726 // For now, allocate an arbitrarily long buffer
728 Buffer
= AllocateZeroPool (0x10000);
729 ASSERT (Buffer
!= NULL
);
732 // Set foreground and background as defined
734 gST
->ConOut
->SetAttribute (gST
->ConOut
, TextAttribute
);
737 // Much faster to buffer the long string instead of print it a character at a time
739 LibSetUnicodeMem (Buffer
, RightColumn
- LeftColumn
, L
' ');
742 // Clear the desired area with the appropriate foreground/background
744 for (Row
= TopRow
; Row
<= BottomRow
; Row
++) {
745 PrintStringAt (LeftColumn
, Row
, Buffer
);
748 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, LeftColumn
, TopRow
);
754 // Color Setting Functions
758 Get OEM/Vendor specific popup attribute colors.
760 @retval Byte code color setting for popup color.
768 return POPUP_TEXT
| POPUP_BACKGROUND
;
772 Get OEM/Vendor specific popup attribute colors.
774 @retval Byte code color setting for popup inverse color.
778 GetPopupInverseColor (
782 return POPUP_INVERSE_TEXT
| POPUP_INVERSE_BACKGROUND
;
786 Get OEM/Vendor specific PickList color attribute.
788 @retval Byte code color setting for pick list color.
796 return PICKLIST_HIGHLIGHT_TEXT
| PICKLIST_HIGHLIGHT_BACKGROUND
;
800 Get OEM/Vendor specific arrow color attribute.
802 @retval Byte code color setting for arrow color.
810 return ARROW_TEXT
| ARROW_BACKGROUND
;
814 Get OEM/Vendor specific info text color attribute.
816 @retval Byte code color setting for info text color.
824 return INFO_TEXT
| FIELD_BACKGROUND
;
828 Get OEM/Vendor specific help text color attribute.
830 @retval Byte code color setting for help text color.
838 return HELP_TEXT
| FIELD_BACKGROUND
;
842 Get OEM/Vendor specific grayed out text color attribute.
844 @retval Byte code color setting for grayed out text color.
852 return FIELD_TEXT_GRAYED
| FIELD_BACKGROUND
;
856 Get OEM/Vendor specific highlighted text color attribute.
858 @retval Byte code color setting for highlight text color.
862 GetHighlightTextColor (
866 return PcdGet8 (PcdBrowserFieldTextHighlightColor
) | PcdGet8 (PcdBrowserFieldBackgroundHighlightColor
);
870 Get OEM/Vendor specific field text color attribute.
872 @retval Byte code color setting for field text color.
880 return PcdGet8 (PcdBrowserFieldTextColor
) | FIELD_BACKGROUND
;
884 Get OEM/Vendor specific subtitle text color attribute.
886 @retval Byte code color setting for subtitle text color.
890 GetSubTitleTextColor (
894 return PcdGet8 (PcdBrowserSubtitleTextColor
) | FIELD_BACKGROUND
;
898 Clear Screen to the initial state.
906 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
907 gST
->ConOut
->ClearScreen (gST
->ConOut
);
908 gLibIsFirstForm
= TRUE
;
912 Constructor of Customized Display Library Instance.
914 @param ImageHandle The firmware allocated handle for the EFI image.
915 @param SystemTable A pointer to the EFI System Table.
917 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
922 CustomizedDisplayLibConstructor (
923 IN EFI_HANDLE ImageHandle
,
924 IN EFI_SYSTEM_TABLE
*SystemTable
927 mCDLStringPackHandle
= HiiAddPackages (&gCustomizedDisplayLibGuid
, ImageHandle
, CustomizedDisplayLibStrings
, NULL
);
928 ASSERT (mCDLStringPackHandle
!= NULL
);
930 InitializeLibStrings();
936 Destructor of Customized Display Library Instance.
938 @param ImageHandle The firmware allocated handle for the EFI image.
939 @param SystemTable A pointer to the EFI System Table.
941 @retval EFI_SUCCESS The destructor completed successfully.
942 @retval Other value The destructor did not complete successfully.
947 CustomizedDisplayLibDestructor (
948 IN EFI_HANDLE ImageHandle
,
949 IN EFI_SYSTEM_TABLE
*SystemTable
952 HiiRemovePackages(mCDLStringPackHandle
);