]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Base on the type field to get the width of value field for option opcode.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Ui.h
index 0acec825cfebb60ca2c844b892623cdc583865b9..ac016bbed828dc39bce8a316d36364b153dbc882 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private structure, MACRO and function definitions for User Interface related functionalities.\r
 \r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -33,17 +33,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 typedef enum {\r
   UiNoOperation,\r
-  UiDefault,\r
   UiSelect,\r
   UiUp,\r
   UiDown,\r
   UiLeft,\r
   UiRight,\r
   UiReset,\r
-  UiSave,\r
   UiPrevious,\r
   UiPageUp,\r
   UiPageDown,\r
+  UiHotKey,\r
   UiMaxOperation\r
 } UI_SCREEN_OPERATION;\r
 \r
@@ -64,10 +63,10 @@ typedef enum {
   CfUiPageUp,\r
   CfUiPageDown,\r
   CfUiDown,\r
-  CfUiSave,\r
   CfUiDefault,\r
   CfUiNoOperation,\r
   CfExit,\r
+  CfUiHotKey,\r
   CfMaxControlFlag\r
 } UI_CONTROL_FLAG;\r
 \r
@@ -161,6 +160,7 @@ struct _UI_MENU_LIST {
   UINTN           Signature;\r
   LIST_ENTRY      Link;\r
 \r
+  EFI_HII_HANDLE  HiiHandle;\r
   EFI_GUID        FormSetGuid;\r
   UINT16          FormId;\r
   UINT16          QuestionId;\r
@@ -234,6 +234,7 @@ UiFreeMenu (
   of the given parent menu.\r
 \r
   @param  Parent                 The parent of menu to be added.\r
+  @param  HiiHandle              Hii handle related to this formset.\r
   @param  FormSetGuid            The Formset Guid of menu to be added.\r
   @param  FormId                 The Form ID of menu to be added.\r
 \r
@@ -243,6 +244,7 @@ UiFreeMenu (
 UI_MENU_LIST *\r
 UiAddMenuList (\r
   IN OUT UI_MENU_LIST     *Parent,\r
+  IN EFI_HII_HANDLE       HiiHandle,\r
   IN EFI_GUID             *FormSetGuid,\r
   IN UINT16               FormId\r
   );\r
@@ -251,6 +253,7 @@ UiAddMenuList (
   Search Menu with given FormId in the parent menu and all its child menus.\r
 \r
   @param  Parent                 The parent of menu to search.\r
+  @param  FormSetGuid            The Formset GUID of the menu to search.  \r
   @param  FormId                 The Form ID of menu to search.\r
 \r
   @return A pointer to menu found or NULL if not found.\r
@@ -259,6 +262,7 @@ UiAddMenuList (
 UI_MENU_LIST *\r
 UiFindChildMenuList (\r
   IN UI_MENU_LIST         *Parent,\r
+  IN EFI_GUID             *FormSetGuid, \r
   IN UINT16               FormId\r
   );\r
 \r
@@ -291,6 +295,7 @@ UiFreeRefreshList (
 \r
   @param  String                 String description for this option.\r
   @param  Handle                 Hii handle for the package list.\r
+  @param  Form                   The form this statement belong to.\r
   @param  Statement              Statement of this Menu Option.\r
   @param  NumberOfLines          Display lines for this Menu Option.\r
   @param  MenuItemCount          The index for this Option in the Menu.\r
@@ -302,6 +307,7 @@ UI_MENU_OPTION *
 UiAddMenuOption (\r
   IN CHAR16                  *String,\r
   IN EFI_HII_HANDLE          Handle,\r
+  IN FORM_BROWSER_FORM       *Form,\r
   IN FORM_BROWSER_STATEMENT  *Statement,\r
   IN UINT16                  NumberOfLines,\r
   IN UINT16                  MenuItemCount\r
@@ -426,7 +432,7 @@ CreateMultiStringPopUp (
 \r
   @param  MenuOption        Pointer to the current input menu.\r
   @param  Prompt            The prompt string shown on popup window.\r
-  @param  StringPtr         Destination for use input string.\r
+  @param  StringPtr         Old user input and destination for use input string.\r
 \r
   @retval EFI_SUCCESS       If string input is read successfully\r
   @retval EFI_DEVICE_ERROR  If operation fails\r
@@ -434,9 +440,9 @@ CreateMultiStringPopUp (
 **/\r
 EFI_STATUS\r
 ReadString (\r
-  IN  UI_MENU_OPTION              *MenuOption,\r
-  IN  CHAR16                      *Prompt,\r
-  OUT CHAR16                      *StringPtr\r
+  IN     UI_MENU_OPTION              *MenuOption,\r
+  IN     CHAR16                      *Prompt,\r
+  IN OUT CHAR16                      *StringPtr\r
   );\r
 \r
 /**\r
@@ -572,6 +578,26 @@ SetArrayData (
   IN UINT64                   Value\r
   );\r
 \r
+/**\r
+  Check whether this value already in the array, if yes, return the index.\r
+\r
+  @param  Array                  The data array.\r
+  @param  Type                   Type of the data in this array.\r
+  @param  Value                  The value to be find.\r
+  @param  Index                  The index in the array which has same value with Value.\r
+  \r
+  @retval   TRUE Found the value in the array.\r
+  @retval   FALSE Not found the value.\r
+\r
+**/\r
+BOOLEAN \r
+FindArrayData (\r
+  IN VOID                     *Array,\r
+  IN UINT8                    Type,\r
+  IN UINT64                   Value,\r
+  OUT UINTN                   *Index OPTIONAL\r
+  );\r
+\r
 /**\r
   Process a Question's Option (whether selected or un-selected).\r
 \r
@@ -598,14 +624,16 @@ ProcessOptions (
 \r
   @param  StringPtr              The entire help string.\r
   @param  FormattedString        The oupput formatted string.\r
+  @param  EachLineWidth          The string length of each line in the formatted string.\r
   @param  RowCount               TRUE: if Question is selected.\r
 \r
 **/\r
-VOID\r
+UINTN\r
 ProcessHelpString (\r
-  IN  CHAR16                      *StringPtr,\r
-  OUT CHAR16                      **FormattedString,\r
-  IN  UINTN                       RowCount\r
+  IN  CHAR16  *StringPtr,\r
+  OUT CHAR16  **FormattedString,\r
+  OUT UINT16  *EachLineWidth,\r
+  IN  UINTN   RowCount\r
   );\r
 \r
 /**\r
@@ -666,10 +694,12 @@ GetStringWidth (
 /**\r
   Will copy LineWidth amount of a string in the OutputString buffer and return the\r
   number of CHAR16 characters that were copied into the OutputString buffer.\r
+  In the code, it deals \r,\n,\r\n same as \n\r, also it not process the \r or \g.\r
 \r
   @param  InputString            String description for this option.\r
   @param  LineWidth              Width of the desired string to extract in CHAR16\r
                                  characters\r
+  @param  GlyphWidth             The glyph width of the beging char in the string.\r
   @param  Index                  Where in InputString to start the copy process\r
   @param  OutputString           Buffer to copy the string into\r
 \r
@@ -680,6 +710,7 @@ UINT16
 GetLineByWidth (\r
   IN      CHAR16                      *InputString,\r
   IN      UINT16                      LineWidth,\r
+  IN OUT  UINT16                      *GlyphWidth,\r
   IN OUT  UINTN                       *Index,\r
   OUT     CHAR16                      **OutputString\r
   );\r
@@ -735,6 +766,67 @@ ResetScopeStack (
   VOID\r
   );\r
 \r
+/**\r
+  Push the expression options onto the Stack.\r
+\r
+  @param  Pointer                Pointer to the current expression.\r
+  @param  Level                  Which type this expression belong to. Form, \r
+                                 statement or option?\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PushConditionalExpression (\r
+  IN FORM_EXPRESSION     *Pointer,\r
+  IN EXPRESS_LEVEL               Level\r
+  );\r
+\r
+/**\r
+  Pop the expression options from the Stack\r
+\r
+  @param  Level                  Which type this expression belong to. Form, \r
+                                 statement or option?\r
+\r
+  @retval EFI_SUCCESS            The value was pushed onto the stack.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enough system memory to grow the stack.\r
+\r
+**/\r
+EFI_STATUS\r
+PopConditionalExpression (\r
+  IN  EXPRESS_LEVEL      Level\r
+  );\r
+  \r
+/**\r
+  Get the expression Buffer pointer.\r
+  \r
+  @param  Level                  Which type this expression belong to. Form, \r
+                                 statement or option?\r
+\r
+  @retval  The start pointer of the expression buffer or NULL.\r
+\r
+**/\r
+FORM_EXPRESSION **\r
+GetConditionalExpressionList (\r
+  IN EXPRESS_LEVEL       Level\r
+  );\r
+\r
+/**\r
+  Get the expression list count.\r
+  \r
+  @param  Level                  Which type this expression belong to. Form, \r
+                                 statement or option?\r
+\r
+  @retval >=0                    The expression count\r
+  @retval -1                     Input parameter error.\r
+\r
+**/\r
+INTN \r
+GetConditionalExpressionCount (\r
+  IN EXPRESS_LEVEL       Level\r
+  );\r
+\r
 /**\r
   Push an Operand onto the Stack\r
 \r
@@ -889,18 +981,21 @@ ExtendValueToU64 (
 \r
   @param  Value1                 Expression value to compare on left-hand.\r
   @param  Value2                 Expression value to compare on right-hand.\r
+  @param  Result                 Return value after compare.\r
+                                 retval 0                      Two operators equal.\r
+                                 return Positive value if Value1 is greater than Value2.\r
+                                 retval Negative value if Value1 is less than Value2.\r
   @param  HiiHandle              Only required for string compare.\r
 \r
-  @retval EFI_INVALID_PARAMETER  Could not perform comparation on two values.\r
-  @retval 0                      Two operators equeal.\r
-  @return Positive value if Value1 is greater than Value2.\r
-  @retval Negative value if Value1 is less than Value2.\r
+  @retval other                  Could not perform compare on two values.\r
+  @retval EFI_SUCCESS            Compare the value success.\r
 \r
 **/\r
-INTN\r
+EFI_STATUS\r
 CompareHiiValue (\r
   IN  EFI_HII_VALUE   *Value1,\r
   IN  EFI_HII_VALUE   *Value2,\r
+  OUT INTN            *Result,\r
   IN  EFI_HII_HANDLE  HiiHandle OPTIONAL\r
   );\r
 \r
@@ -929,4 +1024,41 @@ EvaluateExpression (
   IN OUT FORM_EXPRESSION   *Expression\r
   );\r
 \r
+/**\r
+  Return the result of the expression list. Check the expression list and \r
+  return the highest priority express result.  \r
+  Priority: DisableIf > SuppressIf > GrayOutIf > FALSE\r
+\r
+  @param  ExpList             The input expression list.\r
+  @param  Evaluate            Whether need to evaluate the expression first.\r
+  @param  FormSet             FormSet associated with this expression. Only \r
+                              needed when Evaluate is TRUE\r
+  @param  Form                Form associated with this expression. Only \r
+                              needed when Evaluate is TRUE \r
+\r
+  @retval EXPRESS_RESULT      Return the higher priority express result. \r
+                              DisableIf > SuppressIf > GrayOutIf > FALSE\r
+\r
+**/\r
+EXPRESS_RESULT \r
+EvaluateExpressionList (\r
+  IN FORM_EXPRESSION_LIST *ExpList,\r
+  IN BOOLEAN              Evaluate,\r
+  IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL\r
+  IN FORM_BROWSER_FORM    *Form OPTIONAL\r
+  );\r
+\r
+/**\r
+  Transfer the device path string to binary format.\r
+\r
+  @param   StringPtr     The device path string info.\r
+\r
+  @retval  Device path binary info.\r
+\r
+**/\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+ConvertDevicePathFromText (\r
+  IN CHAR16  *StringPtr\r
+  );\r
+\r
 #endif // _UI_H\r