3 This library class defines a set of interfaces to customize Display module
5 Copyright (c) 2013, 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 LeftColumnOfHelp
;
139 UINTN RightColumnOfHelp
;
141 UINTN BottomRowOfHelp
;
142 UINTN StartColumnOfHelp
;
143 EFI_IFR_NUMERIC
*NumericOp
;
144 EFI_IFR_DATE
*DateOp
;
145 EFI_IFR_TIME
*TimeOp
;
154 ASSERT (FormData
!= NULL
);
155 if (FormData
== NULL
) {
159 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_TEXT
| KEYHELP_BACKGROUND
);
161 if ((FormData
->Attribute
& HII_DISPLAY_MODAL
) != 0) {
165 SecCol
= gScreenDimensions
.LeftColumn
+ (gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3;
166 ThdCol
= gScreenDimensions
.LeftColumn
+ (gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3 * 2;
168 StartColumnOfHelp
= gScreenDimensions
.LeftColumn
+ 2;
169 LeftColumnOfHelp
= gScreenDimensions
.LeftColumn
+ 1;
170 RightColumnOfHelp
= gScreenDimensions
.RightColumn
- 1;
171 TopRowOfHelp
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- gFooterHeight
+ 1;
172 BottomRowOfHelp
= gScreenDimensions
.BottomRow
- STATUS_BAR_HEIGHT
- 2;
174 ColumnWidth1
= SecCol
- StartColumnOfHelp
;
175 ColumnWidth2
= ThdCol
- SecCol
;
176 ColumnWidth3
= RightColumnOfHelp
- ThdCol
;
177 ColumnStr1
= gLibEmptyString
;
178 ColumnStr2
= gLibEmptyString
;
179 ColumnStr3
= gLibEmptyString
;
181 if (Statement
== NULL
) {
183 // Print Key for Form without showable statement.
185 PrintHotKeyHelpString (FormData
, TRUE
);
186 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
187 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth2
);
188 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
189 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, gEscapeString
, ColumnWidth3
);
198 if (Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) {
199 NumericOp
= (EFI_IFR_NUMERIC
*) Statement
->OpCode
;
200 HexDisplay
= (NumericOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
201 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
202 DateOp
= (EFI_IFR_DATE
*) Statement
->OpCode
;
203 HexDisplay
= (DateOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
204 } else if (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
205 TimeOp
= (EFI_IFR_TIME
*) Statement
->OpCode
;
206 HexDisplay
= (TimeOp
->Flags
& EFI_IFR_DISPLAY_UINT_HEX
) == EFI_IFR_DISPLAY_UINT_HEX
;
208 switch (Statement
->OpCode
->OpCode
) {
209 case EFI_IFR_ORDERED_LIST_OP
:
210 case EFI_IFR_ONE_OF_OP
:
211 case EFI_IFR_NUMERIC_OP
:
212 case EFI_IFR_TIME_OP
:
213 case EFI_IFR_DATE_OP
:
215 PrintHotKeyHelpString (FormData
, TRUE
);
217 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
218 ColumnStr3
= gEscapeString
;
220 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
222 if ((Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) ||
223 (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
235 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterString
, ColumnWidth2
);
236 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gAdjustNumber
, ColumnWidth1
);
238 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
239 if (Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
&& NumericOp
!= NULL
&& LibGetFieldFromNum(Statement
->OpCode
) != 0) {
240 ColumnStr1
= gAdjustNumber
;
242 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
243 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterString
, ColumnWidth2
);
246 PrintHotKeyHelpString (FormData
, FALSE
);
247 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gEnterCommitString
, ColumnWidth2
);
250 // If it is a selected numeric with manual input, display different message
252 if ((Statement
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) ||
253 (Statement
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) ||
254 (Statement
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
255 ColumnStr2
= HexDisplay
? gHexNumericInput
: gDecNumericInput
;
256 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
258 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
261 if (Statement
->OpCode
->OpCode
== EFI_IFR_ORDERED_LIST_OP
) {
262 ColumnStr1
= gPlusString
;
263 ColumnStr3
= gMinusString
;
265 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
266 PrintStringAtWithWidth (ThdCol
, TopRowOfHelp
, ColumnStr3
, ColumnWidth3
);
267 PrintStringAtWithWidth (SecCol
, TopRowOfHelp
, ColumnStr2
, ColumnWidth2
);
269 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, gEnterEscapeString
, ColumnWidth3
);
273 case EFI_IFR_CHECKBOX_OP
:
274 PrintHotKeyHelpString (FormData
, TRUE
);
276 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
277 ColumnStr3
= gEscapeString
;
279 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
281 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
282 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, gToggleCheckBox
, ColumnWidth2
);
283 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, gLibEmptyString
, ColumnWidth1
);
287 case EFI_IFR_PASSWORD_OP
:
288 case EFI_IFR_STRING_OP
:
289 case EFI_IFR_TEXT_OP
:
290 case EFI_IFR_ACTION_OP
:
291 case EFI_IFR_RESET_BUTTON_OP
:
292 case EFI_IFR_SUBTITLE_OP
:
294 PrintHotKeyHelpString (FormData
, TRUE
);
296 if (gClassOfVfr
== FORMSET_CLASS_PLATFORM_SETUP
) {
297 ColumnStr3
= gEscapeString
;
299 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
301 PrintAt (ColumnWidth1
, StartColumnOfHelp
, BottomRowOfHelp
, L
"%c%c%s", ARROW_UP
, ARROW_DOWN
, gMoveHighlight
);
302 if (Statement
->OpCode
->OpCode
!= EFI_IFR_TEXT_OP
&& Statement
->OpCode
->OpCode
!= EFI_IFR_SUBTITLE_OP
) {
303 ColumnStr2
= gEnterString
;
305 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, ColumnStr2
, ColumnWidth2
);
306 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
308 PrintHotKeyHelpString (FormData
, FALSE
);
309 if (Statement
->OpCode
->OpCode
!= EFI_IFR_REF_OP
) {
310 ColumnStr2
= gEnterCommitString
;
311 ColumnStr3
= gEnterEscapeString
;
313 PrintStringAtWithWidth (StartColumnOfHelp
, TopRowOfHelp
, ColumnStr1
, ColumnWidth1
);
314 PrintStringAtWithWidth (StartColumnOfHelp
, BottomRowOfHelp
, ColumnStr1
, ColumnWidth1
);
315 PrintStringAtWithWidth (SecCol
, BottomRowOfHelp
, ColumnStr2
, ColumnWidth2
);
316 PrintStringAtWithWidth (ThdCol
, BottomRowOfHelp
, ColumnStr3
, ColumnWidth3
);
328 This function updates the status bar on the bottom of menu screen. It just shows StatusBar.
329 Original logic in this function should be splitted out.
331 @param[in] MessageType The type of message to be shown. InputError or Configuration Changed.
332 @param[in] State Show or Clear Message.
337 IN UINTN MessageType
,
344 OptionWidth
= (CHAR16
) ((gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
) / 3);
346 switch (MessageType
) {
349 gST
->ConOut
->SetAttribute (gST
->ConOut
, ERROR_TEXT
);
351 gScreenDimensions
.LeftColumn
+ OptionWidth
,
352 gScreenDimensions
.BottomRow
- 1,
356 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_BACKGROUND
);
357 for (Index
= 0; Index
< (LibGetStringWidth (gInputErrorMessage
) - 2) / 2; Index
++) {
358 PrintStringAt (gScreenDimensions
.LeftColumn
+ OptionWidth
+ Index
, gScreenDimensions
.BottomRow
- 1, L
" ");
363 case NV_UPDATE_REQUIRED
:
365 // Global setting support. Show configuration change on every form.
368 gST
->ConOut
->SetAttribute (gST
->ConOut
, INFO_TEXT
);
370 gScreenDimensions
.LeftColumn
+ OptionWidth
* 2,
371 gScreenDimensions
.BottomRow
- 1,
375 gST
->ConOut
->SetAttribute (gST
->ConOut
, KEYHELP_BACKGROUND
);
376 for (Index
= 0; Index
< (LibGetStringWidth (gNvUpdateMessage
) - 2) / 2; Index
++) {
378 (gScreenDimensions
.LeftColumn
+ OptionWidth
* 2 + Index
),
379 gScreenDimensions
.BottomRow
- 1,
392 Create popup window. It will replace CreateDialog().
394 This function draws OEM/Vendor specific pop up windows.
396 @param[out] Key User Input Key
397 @param ... String to be shown in Popup. The variable argument list is terminated by a NULL.
403 OUT EFI_INPUT_KEY
*Key
, OPTIONAL
408 EFI_INPUT_KEY KeyValue
;
420 UINTN DimensionsWidth
;
421 UINTN DimensionsHeight
;
422 UINTN CurrentAttribute
;
423 BOOLEAN CursorVisible
;
426 // If screen dimension info is not ready, get it from console.
428 if (gScreenDimensions
.RightColumn
== 0 || gScreenDimensions
.BottomRow
== 0) {
429 ZeroMem (&gScreenDimensions
, sizeof (EFI_SCREEN_DESCRIPTOR
));
430 gST
->ConOut
->QueryMode (
432 gST
->ConOut
->Mode
->Mode
,
433 &gScreenDimensions
.RightColumn
,
434 &gScreenDimensions
.BottomRow
438 DimensionsWidth
= gScreenDimensions
.RightColumn
- gScreenDimensions
.LeftColumn
;
439 DimensionsHeight
= gScreenDimensions
.BottomRow
- gScreenDimensions
.TopRow
;
443 VA_START (Marker
, Key
);
444 while ((String
= VA_ARG (Marker
, CHAR16
*)) != NULL
) {
447 if ((LibGetStringWidth (String
) / 2) > LargestString
) {
448 LargestString
= (LibGetStringWidth (String
) / 2);
453 if ((LargestString
+ 2) > DimensionsWidth
) {
454 LargestString
= DimensionsWidth
- 2;
457 CurrentAttribute
= gST
->ConOut
->Mode
->Attribute
;
458 CursorVisible
= gST
->ConOut
->Mode
->CursorVisible
;
459 gST
->ConOut
->EnableCursor (gST
->ConOut
, FALSE
);
460 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
463 // Subtract the PopUp width from total Columns, allow for one space extra on
464 // each end plus a border.
466 Start
= (DimensionsWidth
- LargestString
- 2) / 2 + gScreenDimensions
.LeftColumn
+ 1;
467 End
= Start
+ LargestString
+ 1;
469 Top
= ((DimensionsHeight
- LineNum
- 2) / 2) + gScreenDimensions
.TopRow
- 1;
470 Bottom
= Top
+ LineNum
+ 2;
472 Character
= BOXDRAW_DOWN_RIGHT
;
473 PrintCharAt (Start
, Top
, Character
);
474 Character
= BOXDRAW_HORIZONTAL
;
475 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
476 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
479 Character
= BOXDRAW_DOWN_LEFT
;
480 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
481 Character
= BOXDRAW_VERTICAL
;
484 VA_START (Marker
, Key
);
485 for (Index
= Top
; Index
+ 2 < Bottom
; Index
++, Count
++) {
486 String
= VA_ARG (Marker
, CHAR16
*);
488 if (String
[0] == CHAR_NULL
) {
490 // Passing in a NULL results in a blank space
492 ClearLines (Start
, End
, Index
+ 1, Index
+ 1, GetPopupColor ());
493 } else if (String
[0] == L
' ') {
495 // Passing in a space results in the assumption that this is where typing will occur
497 ClearLines (Start
+ 1, End
- 1, Index
+ 1, Index
+ 1, POPUP_INVERSE_TEXT
| POPUP_INVERSE_BACKGROUND
);
499 ((DimensionsWidth
- LibGetStringWidth (String
) / 2) / 2) + gScreenDimensions
.LeftColumn
+ 1,
505 // This will clear the background of the line - we never know who might have been
506 // here before us. This differs from the next clear in that it used the non-reverse
507 // video for normal printing.
509 ClearLines (Start
, End
, Index
+ 1, Index
+ 1, GetPopupColor ());
511 ((DimensionsWidth
- LibGetStringWidth (String
) / 2) / 2) + gScreenDimensions
.LeftColumn
+ 1,
517 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
518 PrintCharAt (Start
, Index
+ 1, Character
);
519 PrintCharAt (End
- 1, Index
+ 1, Character
);
523 Character
= BOXDRAW_UP_RIGHT
;
524 PrintCharAt (Start
, Bottom
- 1, Character
);
525 Character
= BOXDRAW_HORIZONTAL
;
526 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
527 PrintCharAt ((UINTN
)-1, (UINTN
) -1, Character
);
530 Character
= BOXDRAW_UP_LEFT
;
531 PrintCharAt ((UINTN
)-1, (UINTN
) -1, Character
);
534 Status
= WaitForKeyStroke (&KeyValue
);
535 ASSERT_EFI_ERROR (Status
);
536 CopyMem (Key
, &KeyValue
, sizeof (EFI_INPUT_KEY
));
539 gST
->ConOut
->SetAttribute (gST
->ConOut
, CurrentAttribute
);
540 gST
->ConOut
->EnableCursor (gST
->ConOut
, CursorVisible
);
544 Confirm how to handle the changed data.
546 @return Action BROWSER_SAVE_CHANGES, BROWSER_DISCARD_CHANGES or other values.
558 gST
->ConIn
->ReadKeyStroke (gST
->ConIn
, &Key
);
560 YesResponse
= gYesResponse
[0];
561 NoResponse
= gNoResponse
[0];
564 // If NV flag is up, prompt user
567 CreateDialog (&Key
, gLibEmptyString
, gSaveChanges
, gAreYouSure
, gLibEmptyString
, NULL
);
570 (Key
.ScanCode
!= SCAN_ESC
) &&
571 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (NoResponse
| UPPER_LOWER_CASE_OFFSET
)) &&
572 ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) != (YesResponse
| UPPER_LOWER_CASE_OFFSET
))
575 if (Key
.ScanCode
== SCAN_ESC
) {
576 return BROWSER_NO_CHANGES
;
577 } else if ((Key
.UnicodeChar
| UPPER_LOWER_CASE_OFFSET
) == (YesResponse
| UPPER_LOWER_CASE_OFFSET
)) {
578 return BROWSER_SAVE_CHANGES
;
580 return BROWSER_DISCARD_CHANGES
;
585 OEM specifies whether Setup exits Page by ESC key.
587 This function customized the behavior that whether Setup exits Page so that
588 system able to boot when configuration is not changed.
590 @retval TRUE Exits FrontPage
591 @retval FALSE Don't exit FrontPage.
599 return gClassOfVfr
== FORMSET_CLASS_FRONT_PAGE
? FALSE
: TRUE
;
603 Set Timeout value for a ceratain Form to get user response.
605 This function allows to set timeout value on a ceratain form if necessary.
606 If timeout is not zero, the form will exit if user has no response in timeout.
608 @param[in] FormData Form Data to be shown in Page
610 @return 0 No timeout for this form.
611 @return > 0 Timeout value in 100 ns units.
616 IN FORM_DISPLAY_ENGINE_FORM
*FormData
625 Prints a unicode string to the default console, at
626 the supplied cursor position, using L"%s" format.
628 @param Column The cursor position to print the string at. When it is -1, use current Position.
629 @param Row The cursor position to print the string at. When it is -1, use current Position.
630 @param String String pointer.
632 @return Length of string printed to the console
643 return PrintAt (0, Column
, Row
, L
"%s", String
);
647 Prints a unicode string to the default console, at
648 the supplied cursor position, using L"%s" format.
650 @param Column The cursor position to print the string at. When it is -1, use current Position.
651 @param Row The cursor position to print the string at. When it is -1, use current Position.
652 @param String String pointer.
653 @param Width Width for String.
655 @return Length of string printed to the console
660 PrintStringAtWithWidth (
667 return PrintAt (Width
, Column
, Row
, L
"%s", String
);
671 Prints a chracter to the default console, at
672 the supplied cursor position, using L"%c" format.
674 @param Column The cursor position to print the string at. When it is -1, use current Position.
675 @param Row The cursor position to print the string at. When it is -1, use current Position.
676 @param Character Character to print.
678 @return Length of string printed to the console.
689 return PrintAt (0, Column
, Row
, L
"%c", Character
);
693 Clear retangle with specified text attribute.
695 @param LeftColumn Left column of retangle.
696 @param RightColumn Right column of retangle.
697 @param TopRow Start row of retangle.
698 @param BottomRow End row of retangle.
699 @param TextAttribute The character foreground and background.
706 IN UINTN RightColumn
,
709 IN UINTN TextAttribute
716 // For now, allocate an arbitrarily long buffer
718 Buffer
= AllocateZeroPool (0x10000);
719 ASSERT (Buffer
!= NULL
);
722 // Set foreground and background as defined
724 gST
->ConOut
->SetAttribute (gST
->ConOut
, TextAttribute
);
727 // Much faster to buffer the long string instead of print it a character at a time
729 LibSetUnicodeMem (Buffer
, RightColumn
- LeftColumn
, L
' ');
732 // Clear the desired area with the appropriate foreground/background
734 for (Row
= TopRow
; Row
<= BottomRow
; Row
++) {
735 PrintStringAt (LeftColumn
, Row
, Buffer
);
738 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, LeftColumn
, TopRow
);
744 // Color Setting Functions
748 Get OEM/Vendor specific popup attribute colors.
750 @retval Byte code color setting for popup color.
758 return POPUP_TEXT
| POPUP_BACKGROUND
;
762 Get OEM/Vendor specific popup attribute colors.
764 @retval Byte code color setting for popup inverse color.
768 GetPopupInverseColor (
772 return POPUP_INVERSE_TEXT
| POPUP_INVERSE_BACKGROUND
;
776 Get OEM/Vendor specific PickList color attribute.
778 @retval Byte code color setting for pick list color.
786 return PICKLIST_HIGHLIGHT_TEXT
| PICKLIST_HIGHLIGHT_BACKGROUND
;
790 Get OEM/Vendor specific arrow color attribute.
792 @retval Byte code color setting for arrow color.
800 return ARROW_TEXT
| ARROW_BACKGROUND
;
804 Get OEM/Vendor specific info text color attribute.
806 @retval Byte code color setting for info text color.
814 return INFO_TEXT
| FIELD_BACKGROUND
;
818 Get OEM/Vendor specific help text color attribute.
820 @retval Byte code color setting for help text color.
828 return HELP_TEXT
| FIELD_BACKGROUND
;
832 Get OEM/Vendor specific grayed out text color attribute.
834 @retval Byte code color setting for grayed out text color.
842 return FIELD_TEXT_GRAYED
| FIELD_BACKGROUND
;
846 Get OEM/Vendor specific highlighted text color attribute.
848 @retval Byte code color setting for highlight text color.
852 GetHighlightTextColor (
856 return PcdGet8 (PcdBrowserFieldTextHighlightColor
) | PcdGet8 (PcdBrowserFieldBackgroundHighlightColor
);
860 Get OEM/Vendor specific field text color attribute.
862 @retval Byte code color setting for field text color.
870 return PcdGet8 (PcdBrowserFieldTextColor
) | FIELD_BACKGROUND
;
874 Get OEM/Vendor specific subtitle text color attribute.
876 @retval Byte code color setting for subtitle text color.
880 GetSubTitleTextColor (
884 return PcdGet8 (PcdBrowserSubtitleTextColor
) | FIELD_BACKGROUND
;
888 Clear Screen to the initial state.
896 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
897 gST
->ConOut
->ClearScreen (gST
->ConOut
);
898 gLibIsFirstForm
= TRUE
;
902 Constructor of Customized Display Library Instance.
904 @param ImageHandle The firmware allocated handle for the EFI image.
905 @param SystemTable A pointer to the EFI System Table.
907 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
912 CustomizedDisplayLibConstructor (
913 IN EFI_HANDLE ImageHandle
,
914 IN EFI_SYSTEM_TABLE
*SystemTable
917 mCDLStringPackHandle
= HiiAddPackages (&gCustomizedDisplayLibGuid
, ImageHandle
, CustomizedDisplayLibStrings
, NULL
);
918 ASSERT (mCDLStringPackHandle
!= NULL
);
920 InitializeLibStrings();
926 Destructor of Customized Display Library Instance.
928 @param ImageHandle The firmware allocated handle for the EFI image.
929 @param SystemTable A pointer to the EFI System Table.
931 @retval EFI_SUCCESS The destructor completed successfully.
932 @retval Other value The destructor did not complete successfully.
937 CustomizedDisplayLibDestructor (
938 IN EFI_HANDLE ImageHandle
,
939 IN EFI_SYSTEM_TABLE
*SystemTable
942 HiiRemovePackages(mCDLStringPackHandle
);