2 Private structure, MACRO and function definitions for User Interface related functionalities.
4 Copyright (c) 2004 - 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #define REGULAR_NUMERIC 0
24 #define TIME_NUMERIC 1
25 #define DATE_NUMERIC 2
27 #define SUBTITLE_INDENT 2
43 } UI_SCREEN_OPERATION
;
70 #define UI_ACTION_NONE 0
71 #define UI_ACTION_REFRESH_FORM 1
72 #define UI_ACTION_REFRESH_FORMSET 2
73 #define UI_ACTION_EXIT 3
76 EFI_HII_HANDLE Handle
;
79 // Target formset/form/Question information
92 // Ation for Browser to taken:
93 // UI_ACTION_NONE - navigation inside a form
94 // UI_ACTION_REFRESH_FORM - re-evaluate expressions and repaint form
95 // UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary
100 // Current selected fomset/form/Question
102 FORM_BROWSER_FORMSET
*FormSet
;
103 FORM_BROWSER_FORM
*Form
;
104 FORM_BROWSER_STATEMENT
*Statement
;
107 #define UI_MENU_OPTION_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'm')
108 #define UI_MENU_LIST_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'l')
114 EFI_HII_HANDLE Handle
;
115 FORM_BROWSER_STATEMENT
*ThisTag
;
122 UINTN Skip
; // Number of lines
125 // Display item sequence for date/time
126 // Date: Month/Day/Year
129 // Time: Hour : Minute : Second
139 #define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
149 typedef struct _MENU_REFRESH_ENTRY
{
150 struct _MENU_REFRESH_ENTRY
*Next
;
151 UI_MENU_OPTION
*MenuOption
; // Describes the entry needing an update
152 UI_MENU_SELECTION
*Selection
;
155 UINTN CurrentAttribute
;
156 } MENU_REFRESH_ENTRY
;
160 UI_SCREEN_OPERATION ScreenOperation
;
161 } SCAN_CODE_TO_SCREEN_OPERATION
;
164 UI_SCREEN_OPERATION ScreenOperation
;
165 UI_CONTROL_FLAG ControlFlag
;
166 } SCREEN_OPERATION_T0_CONTROL_FLAG
;
169 extern LIST_ENTRY gMenuList
;
170 extern MENU_REFRESH_ENTRY
*gMenuRefreshHead
;
171 extern UI_MENU_SELECTION
*gCurrentSelection
;
177 Initialize Menu option list.
186 Initialize Menu option list.
195 Remove a Menu in list, and return FormId/QuestionId for previous Menu.
197 @param Selection Menu selection.
201 UiRemoveMenuListEntry (
202 OUT UI_MENU_SELECTION
*Selection
206 Free Menu option linked list.
215 Add one menu entry to the linked lst
217 @param Selection Menu selection.
222 IN UI_MENU_SELECTION
*Selection
226 Free Menu option linked list.
235 Add one menu option by specified description and context.
237 @param String String description for this option.
238 @param Handle Hii handle for the package list.
239 @param Statement Statement of this Menu Option.
240 @param NumberOfLines Display lines for this Menu Option.
241 @param MenuItemCount The index for this Option in the Menu.
247 IN EFI_HII_HANDLE Handle
,
248 IN FORM_BROWSER_STATEMENT
*Statement
,
249 IN UINT16 NumberOfLines
,
250 IN UINT16 MenuItemCount
254 Display menu and wait for user to select one menu option, then return it.
255 If AutoBoot is enabled, then if user doesn't select any option,
256 after period of time, it will automatically return the first menu option.
258 @param Selection Menu selection.
260 @return Return the pointer of the menu which selected,
261 @return otherwise return NULL.
266 IN OUT UI_MENU_SELECTION
*Selection
270 Free up the resource allocated for all strings required
280 The worker function that send the displays to the screen. On output,
281 the selection made by user is returned.
283 @param Selection On input, Selection tell setup browser the information
284 about the Selection, form and formset to be displayed.
285 On output, Selection return the screen item that is selected
288 @retval EFI_SUCCESS The page is displayed successfully.
289 @return Other value if the page failed to be diplayed.
294 IN OUT UI_MENU_SELECTION
*Selection
298 VSPrint worker function that prints a Value as a decimal number in Buffer.
300 @param Buffer Location to place ascii decimal number string of Value.
301 @param Flags Flags to use in printing decimal string, see file header for
303 @param Value Decimal value to convert to a string in Buffer.
305 @return Number of characters printed.
316 Set Buffer to Value for Size bytes.
318 @param Buffer Memory to set.
319 @param Size Number of bytes to set
320 @param Value Value of the set operation.
331 Wait for a given event to fire, or for an optional timeout to expire.
333 @param Event The event to wait for
334 @param Timeout An optional timeout value in 100 ns units.
335 @param RefreshInterval Menu refresh interval (in seconds).
337 @retval EFI_SUCCESS Event fired before Timeout expired.
338 @retval EFI_TIME_OUT Timout expired before Event fired.
342 UiWaitForSingleEvent (
344 IN UINT64 Timeout
, OPTIONAL
345 IN UINT8 RefreshInterval OPTIONAL
349 Draw a pop up windows based on the dimension, number of lines and
352 @param RequestedWidth The width of the pop-up.
353 @param NumberOfLines The number of lines.
354 @param ... A series of text strings that displayed in the pop-up.
359 IN UINTN ScreenWidth
,
360 IN UINTN NumberOfLines
,
365 Get string or password input from user.
367 @param MenuOption Pointer to the current input menu.
368 @param Prompt The prompt string shown on popup window.
369 @param StringPtr Destination for use input string.
371 @retval EFI_SUCCESS If string input is read successfully
372 @retval EFI_DEVICE_ERROR If operation fails
377 IN UI_MENU_OPTION
*MenuOption
,
379 OUT CHAR16
*StringPtr
383 Get selection for OneOf and OrderedList (Left/Right will be ignored).
385 @param Selection Pointer to current selection.
386 @param MenuOption Pointer to the current input menu.
388 @retval EFI_SUCCESS If Option input is processed successfully
389 @retval EFI_DEVICE_ERROR If operation fails
393 GetSelectionInputPopUp (
394 IN UI_MENU_SELECTION
*Selection
,
395 IN UI_MENU_OPTION
*MenuOption
399 This routine reads a numeric value from the user input.
401 @param Selection Pointer to current selection.
402 @param MenuOption Pointer to the current input menu.
404 @retval EFI_SUCCESS If numerical input is read successfully
405 @retval EFI_DEVICE_ERROR If operation fails
410 IN UI_MENU_SELECTION
*Selection
,
411 IN UI_MENU_OPTION
*MenuOption
415 Update status bar on the bottom of menu.
417 @param MessageType The type of message to be shown.
418 @param Flags The flags in Question header.
419 @param State Set or clear.
424 IN UINTN MessageType
,
430 Process Question Config.
432 @param Selection The UI menu selection.
433 @param Question The Question to be peocessed.
435 @retval EFI_SUCCESS Question Config process success.
436 @retval Other Question Config process fail.
440 ProcessQuestionConfig (
441 IN UI_MENU_SELECTION
*Selection
,
442 IN FORM_BROWSER_STATEMENT
*Question
446 Print Question Value according to it's storage width and display attributes.
448 @param Question The Question to be printed.
449 @param FormattedNumber Buffer for output string.
450 @param BufferSize The FormattedNumber buffer size in bytes.
452 @retval EFI_SUCCESS Print success.
453 @retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.
457 PrintFormattedNumber (
458 IN FORM_BROWSER_STATEMENT
*Question
,
459 IN OUT CHAR16
*FormattedNumber
,
464 Search an Option of a Question by its value.
466 @param Question The Question
467 @param OptionValue Value for Option to be searched.
469 @retval Pointer Pointer to the found Option.
470 @retval NULL Option not found.
475 IN FORM_BROWSER_STATEMENT
*Question
,
476 IN EFI_HII_VALUE
*OptionValue
480 Process a Question's Option (whether selected or un-selected).
482 @param Selection Pointer to UI_MENU_SELECTION.
483 @param MenuOption The MenuOption for this Question.
484 @param Selected TRUE: if Question is selected.
485 @param OptionString Pointer of the Option String to be displayed.
487 @retval EFI_SUCCESS Question Option process success.
488 @retval Other Question Option process fail.
493 IN UI_MENU_SELECTION
*Selection
,
494 IN UI_MENU_OPTION
*MenuOption
,
496 OUT CHAR16
**OptionString
500 Process the help string: Split StringPtr to several lines of strings stored in
501 FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.
503 @param StringPtr The entire help string.
504 @param FormattedString The oupput formatted string.
505 @param RowCount TRUE: if Question is selected.
510 IN CHAR16
*StringPtr
,
511 OUT CHAR16
**FormattedString
,
516 Update key's help imformation.
518 @param MenuOption The Menu option
519 @param Selected Whether or not a tag be selected
524 IN UI_MENU_OPTION
*MenuOption
,
529 Clear retangle with specified text attribute.
531 @param LeftColumn Left column of retangle.
532 @param RightColumn Right column of retangle.
533 @param TopRow Start row of retangle.
534 @param BottomRow End row of retangle.
535 @param TextAttribute The character foreground and background.
548 Count the storage space of a Unicode string.
550 This function handles the Unicode string with NARROW_CHAR
551 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
552 does not count in the resultant output. If a WIDE_CHAR is
553 hit, then 2 Unicode character will consume an output storage
554 space with size of CHAR16 till a NARROW_CHAR is hit.
556 @param String The input string to be counted.
558 @return Storage space for the input string.
567 Will copy LineWidth amount of a string in the OutputString buffer and return the
568 number of CHAR16 characters that were copied into the OutputString buffer.
570 @param InputString String description for this option.
571 @param LineWidth Width of the desired string to extract in CHAR16
573 @param Index Where in InputString to start the copy process
574 @param OutputString Buffer to copy the string into
576 @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.
581 IN CHAR16
*InputString
,
584 OUT CHAR16
**OutputString
588 Get the supported width for a particular op-code
590 @param Statement The FORM_BROWSER_STATEMENT structure passed in.
591 @param Handle The handle in the HII database being used
593 @return Returns the number of CHAR16 characters that is support.
598 IN FORM_BROWSER_STATEMENT
*Statement
,
599 IN EFI_HII_HANDLE Handle
603 Concatenate a narrow string to another string.
605 @param Destination The destination string.
606 @param Source The source string. The string to be concatenated.
607 to the end of Destination.
617 Wait for a key to be pressed by user.
619 @param Key The key which is pressed by user.
621 @retval EFI_SUCCESS The function always completed successfully.
626 OUT EFI_INPUT_KEY
*Key
630 Reset stack pointer to begin of the stack.
639 Push an Operand onto the Stack
641 @param Operand Operand to push.
643 @retval EFI_SUCCESS The value was pushed onto the stack.
644 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
654 Pop an Operand from the Stack
656 @param Operand Operand to pop.
658 @retval EFI_SUCCESS The value was pushed onto the stack.
659 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
669 Get Form given its FormId.
671 @param FormSet The formset which contains this form.
672 @param FormId Id of this form.
674 @retval Pointer The form.
675 @retval NULL Specified Form is not found in the formset.
680 IN FORM_BROWSER_FORMSET
*FormSet
,
685 Search a Question in Formset scope using its QuestionId.
687 @param FormSet The formset which contains this form.
688 @param Form The form which contains this Question.
689 @param QuestionId Id of this Question.
691 @retval Pointer The Question.
692 @retval NULL Specified Question not found in the form.
695 FORM_BROWSER_STATEMENT
*
697 IN FORM_BROWSER_FORMSET
*FormSet
,
698 IN FORM_BROWSER_FORM
*Form
,
703 Zero extend integer/boolean/date/time to UINT64 for comparing.
705 @param Value HII Value to be converted.
710 IN EFI_HII_VALUE
*Value
714 Compare two Hii value.
716 @param Value1 Expression value to compare on left-hand.
717 @param Value2 Expression value to compare on right-hand.
718 @param HiiHandle Only required for string compare.
720 @retval EFI_INVALID_PARAMETER Could not perform comparation on two values.
721 @retval 0 Two operators equeal.
722 @return Positive value if Value1 is greater than Value2.
723 @retval Negative value if Value1 is less than Value2.
728 IN EFI_HII_VALUE
*Value1
,
729 IN EFI_HII_VALUE
*Value2
,
730 IN EFI_HII_HANDLE HiiHandle OPTIONAL
734 Evaluate the result of a HII expression
736 @param FormSet FormSet associated with this expression.
737 @param Form Form associated with this expression.
738 @param Expression Expression to be evaluated.
740 @retval EFI_SUCCESS The expression evaluated successfuly
741 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId
743 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
745 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack
746 @retval EFI_INVALID_PARAMETER Syntax error with the Expression
751 IN FORM_BROWSER_FORMSET
*FormSet
,
752 IN FORM_BROWSER_FORM
*Form
,
753 IN OUT FORM_EXPRESSION
*Expression