TianoCore EDK2 master
Loading...
Searching...
No Matches
Popup.c File Reference
#include "FormDisplay.h"

Go to the source code of this file.

Functions

VOID FreeSelectableOptions (LIST_ENTRY *OptionList)
 
VOID DisplayOneSelectableOption (IN USER_SELECTABLE_OPTION *SelectableOption, IN BOOLEAN Highlight)
 
EFI_STATUS AddOneSelectableOption (IN EFI_HII_POPUP_TYPE PopupType, IN EFI_HII_POPUP_SELECTION OptionType, IN CHAR16 *OptionString, IN UINTN OptionCol, IN UINTN OptionRow)
 
EFI_STATUS AddUserSelectableOptions (IN EFI_HII_POPUP_TYPE PopupType)
 
VOID GetUserSelection (IN EFI_HII_POPUP_TYPE PopupType, OUT EFI_HII_POPUP_SELECTION *UserSelection)
 
VOID GetStringOffsetWithWidth (IN CHAR16 *String, IN UINTN MaxWidth, OUT UINTN *Offset)
 
UINTN ParseMessageString (IN CHAR16 *InputString, OUT CHAR16 **OutputString, OUT UINTN *OutputStrWidth, IN OUT UINTN *Index)
 
VOID CalculatePopupPosition (IN EFI_HII_POPUP_TYPE PopupType, OUT EFI_SCREEN_DESCRIPTOR *ScreenForPopup)
 
EFI_STATUS DrawMessageBox (IN EFI_HII_POPUP_STYLE PopupStyle)
 
EFI_STATUS EFIAPI CreatePopup (IN EFI_HII_POPUP_PROTOCOL *This, IN EFI_HII_POPUP_STYLE PopupStyle, IN EFI_HII_POPUP_TYPE PopupType, IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID Message, OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL)
 

Variables

EFI_SCREEN_DESCRIPTOR gPopupDimensions
 
LIST_ENTRY gUserSelectableOptions
 
EFI_STRING gMessageString
 
UINTN gMesStrLineNum
 
UINTN gMaxRowWidth
 

Detailed Description

Implementation for Hii Popup Protocol.

Copyright (c) 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Popup.c.

Function Documentation

◆ AddOneSelectableOption()

EFI_STATUS AddOneSelectableOption ( IN EFI_HII_POPUP_TYPE  PopupType,
IN EFI_HII_POPUP_SELECTION  OptionType,
IN CHAR16 *  OptionString,
IN UINTN  OptionCol,
IN UINTN  OptionRow 
)

Add one selectable option to option list. This is the work function for AddUserSelectableOptions.

Parameters
PopupTypeThe option need to be drew.
OptionTypeThe type of this selection option.
OptionStringPoint to the option string that to be shown.
OptionColThe column that the option need to be drew at.
OptionRowThe row that the option need to be drew at.
Return values
EFI_SUCCESSThis function implement successfully.
EFI_OUT_OF_RESOURCESThere are not enough resources available.

Definition at line 74 of file Popup.c.

◆ AddUserSelectableOptions()

EFI_STATUS AddUserSelectableOptions ( IN EFI_HII_POPUP_TYPE  PopupType)

Add user selectable options to option list for different types of Popup.

Parameters
PopupTypeType of the popup to display.
Return values
EFI_SUCCESSThis function implement successfully.
EFI_OUT_OF_RESOURCESThere are not enough resources available.

Definition at line 153 of file Popup.c.

◆ CalculatePopupPosition()

VOID CalculatePopupPosition ( IN EFI_HII_POPUP_TYPE  PopupType,
OUT EFI_SCREEN_DESCRIPTOR ScreenForPopup 
)

Calculate the position of the popup.

Parameters
PopupTypeType of the popup to display.
ScreenForPopupThe screen dimensions for the popup.

Definition at line 453 of file Popup.c.

◆ CreatePopup()

EFI_STATUS EFIAPI CreatePopup ( IN EFI_HII_POPUP_PROTOCOL This,
IN EFI_HII_POPUP_STYLE  PopupStyle,
IN EFI_HII_POPUP_TYPE  PopupType,
IN EFI_HII_HANDLE  HiiHandle,
IN EFI_STRING_ID  Message,
OUT EFI_HII_POPUP_SELECTION *UserSelection  OPTIONAL 
)

Displays a popup window.

Parameters
ThisA pointer to the EFI_HII_POPUP_PROTOCOL instance.
PopupStylePopup style to use.
PopupTypeType of the popup to display.
HiiHandleHII handle of the string pack containing Message
MessageA message to display in the popup box.
UserSelectionUser selection.
Return values
EFI_SUCCESSThe popup box was successfully displayed.
EFI_INVALID_PARAMETERHiiHandle and Message do not define a valid HII string.
EFI_INVALID_PARAMETERPopupType is not one of the values defined by this specification.
EFI_OUT_OF_RESOURCESThere are not enough resources available to display the popup box.

Definition at line 688 of file Popup.c.

◆ DisplayOneSelectableOption()

VOID DisplayOneSelectableOption ( IN USER_SELECTABLE_OPTION SelectableOption,
IN BOOLEAN  Highlight 
)

Display one selectable option.

Parameters
SelectableOptionThe selectable option need to be drew.
HighlightWhether the option need to be highlighted.

Definition at line 47 of file Popup.c.

◆ DrawMessageBox()

EFI_STATUS DrawMessageBox ( IN EFI_HII_POPUP_STYLE  PopupStyle)

Draw the Message box. +----------------------------------------—+

ERROR/WARNING/INFO
popup messages
user selectable options

+----------------------------------------—+

Parameters
PopupStylePopup style to use.

Definition at line 531 of file Popup.c.

◆ FreeSelectableOptions()

VOID FreeSelectableOptions ( LIST_ENTRY OptionList)

Free the user selectable option structure data.

Parameters
OptionListPoint to the selectable option list which need to be freed.

Definition at line 24 of file Popup.c.

◆ GetStringOffsetWithWidth()

VOID GetStringOffsetWithWidth ( IN CHAR16 *  String,
IN UINTN  MaxWidth,
OUT UINTN Offset 
)

Get the offset in the input string when the width reaches to a fixed one.

The input string may contain NARROW_CHAR and WIDE_CHAR. Notice: the input string doesn't contain line break characters.

Parameters
StringThe input string to be counted.
MaxWidthThe max length this function supported.
OffsetThe max index of the string can be show out. If string's width less than MaxWidth, offset will point to the "\0" of the string.

Definition at line 325 of file Popup.c.

◆ GetUserSelection()

VOID GetUserSelection ( IN EFI_HII_POPUP_TYPE  PopupType,
OUT EFI_HII_POPUP_SELECTION *  UserSelection 
)

Show selectable options to user and get the one that user select.

Parameters
PopupTypeType of the popup to display.
UserSelectionUser selection.

Definition at line 224 of file Popup.c.

◆ ParseMessageString()

UINTN ParseMessageString ( IN CHAR16 *  InputString,
OUT CHAR16 **  OutputString,
OUT UINTN OutputStrWidth,
IN OUT UINTN Index 
)

Parse the message to check if it contains line break characters. For once call, caller can get the string for one line and the width of the string. This function call be called recursively to parse the whole InputString.

(Notice: current implementation, it only checks \r,
characters, it deals \r,
,
\r same as \r
.)

Parameters
InputStringString description for this option.
OutputStringBuffer to copy the string into, caller is responsible for freeing the buffer.
OutputStrWidthThe width of OutputString.
IndexWhere in InputString to start the copy process
Returns
Returns the number of CHAR16 characters that were copied into the OutputString buffer, include the '\0' info.

Definition at line 374 of file Popup.c.

Variable Documentation

◆ gMaxRowWidth

UINTN gMaxRowWidth

Definition at line 15 of file Popup.c.

◆ gMessageString

EFI_STRING gMessageString

Definition at line 13 of file Popup.c.

◆ gMesStrLineNum

UINTN gMesStrLineNum

Definition at line 14 of file Popup.c.

◆ gPopupDimensions

EFI_SCREEN_DESCRIPTOR gPopupDimensions

Definition at line 11 of file Popup.c.

◆ gUserSelectableOptions

LIST_ENTRY gUserSelectableOptions

Definition at line 12 of file Popup.c.