]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Update the browser logic, make the storage as browser level instead of form set level.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Ui.h
CommitLineData
7936fb6a 1/** @file\r
2Private structure, MACRO and function definitions for User Interface related functionalities.\r
3\r
80a047f0 4Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5This program and the accompanying materials\r
7936fb6a 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _UI_H_\r
16#define _UI_H_\r
17\r
7936fb6a 18//\r
19// Globals\r
20//\r
21#define REGULAR_NUMERIC 0\r
22#define TIME_NUMERIC 1\r
23#define DATE_NUMERIC 2\r
24\r
25#define SUBTITLE_INDENT 2\r
26\r
40a06b0c 27\r
28//\r
29// It take 23 characters including the NULL to print a 64 bits number with "[" and "]".\r
30// pow(2, 64) = [18446744073709551616]\r
31//\r
32#define MAX_NUMERIC_INPUT_WIDTH 23\r
33\r
7936fb6a 34typedef enum {\r
35 UiNoOperation,\r
7936fb6a 36 UiSelect,\r
37 UiUp,\r
38 UiDown,\r
39 UiLeft,\r
40 UiRight,\r
41 UiReset,\r
7936fb6a 42 UiPrevious,\r
43 UiPageUp,\r
44 UiPageDown,\r
48a9d5f7 45 UiHotKey,\r
7936fb6a 46 UiMaxOperation\r
47} UI_SCREEN_OPERATION;\r
48\r
49typedef enum {\r
50 CfInitialization,\r
51 CfCheckSelection,\r
52 CfRepaint,\r
53 CfRefreshHighLight,\r
54 CfUpdateHelpString,\r
55 CfPrepareToReadKey,\r
56 CfReadKey,\r
57 CfScreenOperation,\r
7936fb6a 58 CfUiSelect,\r
59 CfUiReset,\r
60 CfUiLeft,\r
61 CfUiRight,\r
62 CfUiUp,\r
63 CfUiPageUp,\r
64 CfUiPageDown,\r
65 CfUiDown,\r
7936fb6a 66 CfUiDefault,\r
67 CfUiNoOperation,\r
68 CfExit,\r
48a9d5f7 69 CfUiHotKey,\r
7936fb6a 70 CfMaxControlFlag\r
71} UI_CONTROL_FLAG;\r
72\r
73#define UI_ACTION_NONE 0\r
74#define UI_ACTION_REFRESH_FORM 1\r
75#define UI_ACTION_REFRESH_FORMSET 2\r
76#define UI_ACTION_EXIT 3\r
77\r
b18e7050
ED
78typedef struct _UI_MENU_LIST UI_MENU_LIST;\r
79\r
7936fb6a 80typedef struct {\r
81 EFI_HII_HANDLE Handle;\r
82\r
83 //\r
84 // Target formset/form/Question information\r
85 //\r
86 EFI_GUID FormSetGuid;\r
87 UINT16 FormId;\r
88 UINT16 QuestionId;\r
d88ca2c9 89 UINTN Sequence; // used for time/date only.\r
7936fb6a 90\r
91 UINTN TopRow;\r
92 UINTN BottomRow;\r
93 UINTN PromptCol;\r
94 UINTN OptionCol;\r
95 UINTN CurrentRow;\r
96\r
97 //\r
98 // Ation for Browser to taken:\r
99 // UI_ACTION_NONE - navigation inside a form\r
100 // UI_ACTION_REFRESH_FORM - re-evaluate expressions and repaint form\r
101 // UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary\r
102 //\r
103 UINTN Action;\r
104\r
105 //\r
106 // Current selected fomset/form/Question\r
107 //\r
108 FORM_BROWSER_FORMSET *FormSet;\r
109 FORM_BROWSER_FORM *Form;\r
110 FORM_BROWSER_STATEMENT *Statement;\r
8b0fc5c1 111\r
112 //\r
113 // Whether the Form is editable\r
114 //\r
115 BOOLEAN FormEditable;\r
b18e7050
ED
116\r
117 UI_MENU_LIST *CurrentMenu;\r
7936fb6a 118} UI_MENU_SELECTION;\r
119\r
f3f2e05d 120#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')\r
121#define UI_MENU_LIST_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'l')\r
7936fb6a 122\r
123typedef struct {\r
124 UINTN Signature;\r
125 LIST_ENTRY Link;\r
126\r
127 EFI_HII_HANDLE Handle;\r
128 FORM_BROWSER_STATEMENT *ThisTag;\r
129 UINT16 EntryNumber;\r
130\r
131 UINTN Row;\r
132 UINTN Col;\r
133 UINTN OptCol;\r
134 CHAR16 *Description;\r
135 UINTN Skip; // Number of lines\r
136\r
137 //\r
138 // Display item sequence for date/time\r
139 // Date: Month/Day/Year\r
140 // Sequence: 0 1 2\r
141 //\r
142 // Time: Hour : Minute : Second\r
143 // Sequence: 0 1 2\r
144 //\r
145 //\r
146 UINTN Sequence;\r
147\r
148 BOOLEAN GrayOut;\r
149 BOOLEAN ReadOnly;\r
8b0fc5c1 150\r
151 //\r
152 // Whether user could change value of this item\r
153 //\r
154 BOOLEAN IsQuestion;\r
7936fb6a 155} UI_MENU_OPTION;\r
156\r
157#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)\r
158\r
d66e6c16 159struct _UI_MENU_LIST {\r
7936fb6a 160 UINTN Signature;\r
d66e6c16 161 LIST_ENTRY Link;\r
7936fb6a 162\r
b2e444aa 163 EFI_HII_HANDLE HiiHandle;\r
d66e6c16 164 EFI_GUID FormSetGuid;\r
7936fb6a 165 UINT16 FormId;\r
166 UINT16 QuestionId;\r
d88ca2c9 167 UINTN Sequence; // used for time/date only.\r
d66e6c16 168\r
169 UI_MENU_LIST *Parent;\r
170 LIST_ENTRY ChildListHead;\r
171};\r
172\r
173#define UI_MENU_LIST_FROM_LINK(a) CR (a, UI_MENU_LIST, Link, UI_MENU_LIST_SIGNATURE)\r
7936fb6a 174\r
1ccdbf2a 175typedef struct _MENU_REFRESH_ENTRY MENU_REFRESH_ENTRY;\r
176struct _MENU_REFRESH_ENTRY {\r
177 MENU_REFRESH_ENTRY *Next;\r
7936fb6a 178 UI_MENU_OPTION *MenuOption; // Describes the entry needing an update\r
179 UI_MENU_SELECTION *Selection;\r
180 UINTN CurrentColumn;\r
181 UINTN CurrentRow;\r
182 UINTN CurrentAttribute;\r
211cc6e5 183 EFI_EVENT Event;\r
1ccdbf2a 184};\r
7936fb6a 185\r
186typedef struct {\r
187 UINT16 ScanCode;\r
188 UI_SCREEN_OPERATION ScreenOperation;\r
189} SCAN_CODE_TO_SCREEN_OPERATION;\r
190\r
191typedef struct {\r
192 UI_SCREEN_OPERATION ScreenOperation;\r
193 UI_CONTROL_FLAG ControlFlag;\r
194} SCREEN_OPERATION_T0_CONTROL_FLAG;\r
195\r
196\r
ce6d12cc 197extern LIST_ENTRY gMenuOption;\r
c40bd442 198extern LIST_ENTRY gMenuList;\r
7936fb6a 199extern MENU_REFRESH_ENTRY *gMenuRefreshHead;\r
200extern UI_MENU_SELECTION *gCurrentSelection;\r
8d00a0f1 201extern BOOLEAN mHiiPackageListUpdated;\r
7936fb6a 202\r
203//\r
204// Global Functions\r
205//\r
206/**\r
207 Initialize Menu option list.\r
208\r
209**/\r
210VOID\r
211UiInitMenu (\r
212 VOID\r
ed66e1bc 213 );\r
7936fb6a 214\r
215/**\r
216 Initialize Menu option list.\r
217\r
218**/\r
219VOID\r
220UiInitMenuList (\r
221 VOID\r
ed66e1bc 222 );\r
7936fb6a 223\r
224/**\r
d66e6c16 225 Free Menu option linked list.\r
7936fb6a 226\r
227**/\r
228VOID\r
d66e6c16 229UiFreeMenu (\r
230 VOID\r
ed66e1bc 231 );\r
7936fb6a 232\r
233/**\r
d66e6c16 234 Create a menu with specified formset GUID and form ID, and add it as a child\r
235 of the given parent menu.\r
236\r
237 @param Parent The parent of menu to be added.\r
b2e444aa 238 @param HiiHandle Hii handle related to this formset.\r
d66e6c16 239 @param FormSetGuid The Formset Guid of menu to be added.\r
240 @param FormId The Form ID of menu to be added.\r
241\r
242 @return A pointer to the newly added menu or NULL if memory is insufficient.\r
7936fb6a 243\r
244**/\r
d66e6c16 245UI_MENU_LIST *\r
246UiAddMenuList (\r
247 IN OUT UI_MENU_LIST *Parent,\r
b2e444aa 248 IN EFI_HII_HANDLE HiiHandle,\r
d66e6c16 249 IN EFI_GUID *FormSetGuid,\r
250 IN UINT16 FormId\r
ed66e1bc 251 );\r
7936fb6a 252\r
253/**\r
c40bd442 254 Search Menu with given FormId, FormSetGuid and Handle in all cached menu list.\r
7936fb6a 255\r
d66e6c16 256 @param Parent The parent of menu to search.\r
c40bd442 257 @param Handle Hii handle related to this formset.\r
b2e444aa 258 @param FormSetGuid The Formset GUID of the menu to search. \r
d66e6c16 259 @param FormId The Form ID of menu to search.\r
260\r
261 @return A pointer to menu found or NULL if not found.\r
7936fb6a 262\r
263**/\r
d66e6c16 264UI_MENU_LIST *\r
265UiFindChildMenuList (\r
266 IN UI_MENU_LIST *Parent,\r
c40bd442 267 IN EFI_HII_HANDLE Handle,\r
b2e444aa 268 IN EFI_GUID *FormSetGuid, \r
d66e6c16 269 IN UINT16 FormId\r
270 );\r
271\r
272/**\r
c40bd442 273 Search Menu with given Handle, FormSetGuid and FormId in all cached menu list.\r
d66e6c16 274\r
c40bd442 275 @param Handle Hii handle related to this formset.\r
993d22eb 276 @param FormSetGuid The Formset GUID of the menu to search.\r
d66e6c16 277 @param FormId The Form ID of menu to search.\r
278\r
279 @return A pointer to menu found or NULL if not found.\r
280\r
281**/\r
282UI_MENU_LIST *\r
283UiFindMenuList (\r
c40bd442 284 IN EFI_HII_HANDLE Handle,\r
d66e6c16 285 IN EFI_GUID *FormSetGuid,\r
286 IN UINT16 FormId\r
ed66e1bc 287 );\r
7936fb6a 288\r
c40bd442
ED
289/**\r
290 Free Menu list linked list.\r
291\r
292 @param MenuListHead One Menu list point in the menu list.\r
293\r
294**/\r
295VOID\r
296UiFreeMenuList (\r
297 LIST_ENTRY *MenuListHead\r
298 );\r
299\r
7936fb6a 300/**\r
301 Free Menu option linked list.\r
302\r
303**/\r
304VOID\r
d66e6c16 305UiFreeRefreshList (\r
7936fb6a 306 VOID\r
ed66e1bc 307 );\r
7936fb6a 308\r
309/**\r
310 Add one menu option by specified description and context.\r
311\r
312 @param String String description for this option.\r
313 @param Handle Hii handle for the package list.\r
f67c4382 314 @param Form The form this statement belong to.\r
7936fb6a 315 @param Statement Statement of this Menu Option.\r
316 @param NumberOfLines Display lines for this Menu Option.\r
317 @param MenuItemCount The index for this Option in the Menu.\r
318\r
8b0fc5c1 319 @retval Pointer Pointer to the added Menu Option.\r
320\r
7936fb6a 321**/\r
8b0fc5c1 322UI_MENU_OPTION *\r
7936fb6a 323UiAddMenuOption (\r
324 IN CHAR16 *String,\r
325 IN EFI_HII_HANDLE Handle,\r
f67c4382 326 IN FORM_BROWSER_FORM *Form,\r
7936fb6a 327 IN FORM_BROWSER_STATEMENT *Statement,\r
328 IN UINT16 NumberOfLines,\r
329 IN UINT16 MenuItemCount\r
ed66e1bc 330 );\r
7936fb6a 331\r
332/**\r
333 Display menu and wait for user to select one menu option, then return it.\r
334 If AutoBoot is enabled, then if user doesn't select any option,\r
335 after period of time, it will automatically return the first menu option.\r
336\r
337 @param Selection Menu selection.\r
338\r
339 @return Return the pointer of the menu which selected,\r
340 @return otherwise return NULL.\r
341\r
342**/\r
343EFI_STATUS\r
344UiDisplayMenu (\r
345 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 346 );\r
7936fb6a 347\r
348/**\r
349 Free up the resource allocated for all strings required\r
350 by Setup Browser.\r
351\r
352**/\r
353VOID\r
354FreeBrowserStrings (\r
355 VOID\r
ed66e1bc 356 );\r
7936fb6a 357\r
8ca6180f
ED
358/**\r
359 Process the goto op code, update the info in the selection structure.\r
360\r
361 @param Statement The statement belong to goto op code.\r
362 @param Selection The selection info.\r
363 @param Repaint Whether need to repaint the menu.\r
364 @param NewLine Whether need to create new line.\r
365\r
366 @retval EFI_SUCCESS The menu process successfully.\r
367 @return Other value if the process failed.\r
368**/\r
369EFI_STATUS\r
370ProcessGotoOpCode (\r
371 IN OUT FORM_BROWSER_STATEMENT *Statement,\r
372 IN OUT UI_MENU_SELECTION *Selection,\r
373 OUT BOOLEAN *Repaint,\r
374 OUT BOOLEAN *NewLine\r
375 );\r
376\r
377\r
7936fb6a 378/**\r
379 The worker function that send the displays to the screen. On output,\r
380 the selection made by user is returned.\r
381\r
382 @param Selection On input, Selection tell setup browser the information\r
383 about the Selection, form and formset to be displayed.\r
384 On output, Selection return the screen item that is selected\r
385 by user.\r
386\r
387 @retval EFI_SUCCESS The page is displayed successfully.\r
388 @return Other value if the page failed to be diplayed.\r
389\r
390**/\r
391EFI_STATUS\r
392SetupBrowser (\r
393 IN OUT UI_MENU_SELECTION *Selection\r
ed66e1bc 394 );\r
7936fb6a 395\r
7936fb6a 396/**\r
397 Set Buffer to Value for Size bytes.\r
398\r
399 @param Buffer Memory to set.\r
400 @param Size Number of bytes to set\r
401 @param Value Value of the set operation.\r
402\r
403**/\r
404VOID\r
405SetUnicodeMem (\r
406 IN VOID *Buffer,\r
407 IN UINTN Size,\r
408 IN CHAR16 Value\r
ed66e1bc 409 );\r
7936fb6a 410\r
411/**\r
412 Wait for a given event to fire, or for an optional timeout to expire.\r
413\r
414 @param Event The event to wait for\r
415 @param Timeout An optional timeout value in 100 ns units.\r
416 @param RefreshInterval Menu refresh interval (in seconds).\r
417\r
418 @retval EFI_SUCCESS Event fired before Timeout expired.\r
419 @retval EFI_TIME_OUT Timout expired before Event fired.\r
420\r
421**/\r
422EFI_STATUS\r
423UiWaitForSingleEvent (\r
424 IN EFI_EVENT Event,\r
425 IN UINT64 Timeout, OPTIONAL\r
426 IN UINT8 RefreshInterval OPTIONAL\r
ed66e1bc 427 );\r
7936fb6a 428\r
429/**\r
430 Draw a pop up windows based on the dimension, number of lines and\r
431 strings specified.\r
432\r
7064c0a5 433 @param ScreenWidth The width of the pop-up.\r
7936fb6a 434 @param NumberOfLines The number of lines.\r
7936fb6a 435 @param ... A series of text strings that displayed in the pop-up.\r
436\r
437**/\r
438VOID\r
8091267c 439EFIAPI\r
3ebb9bdb 440CreateMultiStringPopUp (\r
7936fb6a 441 IN UINTN ScreenWidth,\r
442 IN UINTN NumberOfLines,\r
7936fb6a 443 ...\r
ed66e1bc 444 );\r
7936fb6a 445\r
446/**\r
447 Get string or password input from user.\r
448\r
449 @param MenuOption Pointer to the current input menu.\r
450 @param Prompt The prompt string shown on popup window.\r
da588638 451 @param StringPtr Old user input and destination for use input string.\r
7936fb6a 452\r
453 @retval EFI_SUCCESS If string input is read successfully\r
454 @retval EFI_DEVICE_ERROR If operation fails\r
455\r
456**/\r
457EFI_STATUS\r
458ReadString (\r
da588638
ED
459 IN UI_MENU_OPTION *MenuOption,\r
460 IN CHAR16 *Prompt,\r
461 IN OUT CHAR16 *StringPtr\r
ed66e1bc 462 );\r
7936fb6a 463\r
464/**\r
465 Get selection for OneOf and OrderedList (Left/Right will be ignored).\r
466\r
467 @param Selection Pointer to current selection.\r
468 @param MenuOption Pointer to the current input menu.\r
469\r
470 @retval EFI_SUCCESS If Option input is processed successfully\r
471 @retval EFI_DEVICE_ERROR If operation fails\r
472\r
473**/\r
474EFI_STATUS\r
475GetSelectionInputPopUp (\r
476 IN UI_MENU_SELECTION *Selection,\r
477 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 478 );\r
7936fb6a 479\r
480/**\r
481 This routine reads a numeric value from the user input.\r
482\r
483 @param Selection Pointer to current selection.\r
484 @param MenuOption Pointer to the current input menu.\r
485\r
486 @retval EFI_SUCCESS If numerical input is read successfully\r
487 @retval EFI_DEVICE_ERROR If operation fails\r
488\r
489**/\r
490EFI_STATUS\r
491GetNumericInput (\r
492 IN UI_MENU_SELECTION *Selection,\r
493 IN UI_MENU_OPTION *MenuOption\r
ed66e1bc 494 );\r
7936fb6a 495\r
496/**\r
497 Update status bar on the bottom of menu.\r
498\r
b18e7050 499 @param Selection Current selection info.\r
7936fb6a 500 @param MessageType The type of message to be shown.\r
501 @param Flags The flags in Question header.\r
502 @param State Set or clear.\r
503\r
504**/\r
505VOID\r
506UpdateStatusBar (\r
b18e7050 507 IN UI_MENU_SELECTION *Selection,\r
7936fb6a 508 IN UINTN MessageType,\r
509 IN UINT8 Flags,\r
510 IN BOOLEAN State\r
ed66e1bc 511 );\r
7936fb6a 512\r
513/**\r
514 Process Question Config.\r
515\r
516 @param Selection The UI menu selection.\r
517 @param Question The Question to be peocessed.\r
518\r
519 @retval EFI_SUCCESS Question Config process success.\r
520 @retval Other Question Config process fail.\r
521\r
522**/\r
523EFI_STATUS\r
524ProcessQuestionConfig (\r
525 IN UI_MENU_SELECTION *Selection,\r
526 IN FORM_BROWSER_STATEMENT *Question\r
ed66e1bc 527 );\r
7936fb6a 528\r
529/**\r
530 Print Question Value according to it's storage width and display attributes.\r
531\r
532 @param Question The Question to be printed.\r
533 @param FormattedNumber Buffer for output string.\r
534 @param BufferSize The FormattedNumber buffer size in bytes.\r
535\r
536 @retval EFI_SUCCESS Print success.\r
537 @retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.\r
538\r
539**/\r
540EFI_STATUS\r
541PrintFormattedNumber (\r
542 IN FORM_BROWSER_STATEMENT *Question,\r
543 IN OUT CHAR16 *FormattedNumber,\r
544 IN UINTN BufferSize\r
ed66e1bc 545 );\r
7936fb6a 546\r
547/**\r
548 Search an Option of a Question by its value.\r
549\r
550 @param Question The Question\r
551 @param OptionValue Value for Option to be searched.\r
552\r
553 @retval Pointer Pointer to the found Option.\r
554 @retval NULL Option not found.\r
555\r
556**/\r
557QUESTION_OPTION *\r
558ValueToOption (\r
559 IN FORM_BROWSER_STATEMENT *Question,\r
560 IN EFI_HII_VALUE *OptionValue\r
ed66e1bc 561 );\r
7936fb6a 562\r
d02847d3 563/**\r
564 Return data element in an Array by its Index.\r
565\r
566 @param Array The data array.\r
567 @param Type Type of the data in this array.\r
568 @param Index Zero based index for data in this array.\r
569\r
570 @retval Value The data to be returned\r
571\r
572**/\r
573UINT64\r
574GetArrayData (\r
575 IN VOID *Array,\r
576 IN UINT8 Type,\r
577 IN UINTN Index\r
578 );\r
579\r
580/**\r
581 Set value of a data element in an Array by its Index.\r
582\r
583 @param Array The data array.\r
584 @param Type Type of the data in this array.\r
585 @param Index Zero based index for data in this array.\r
586 @param Value The value to be set.\r
587\r
588**/\r
589VOID\r
590SetArrayData (\r
591 IN VOID *Array,\r
592 IN UINT8 Type,\r
593 IN UINTN Index,\r
594 IN UINT64 Value\r
595 );\r
596\r
82612023
ED
597/**\r
598 Check whether this value already in the array, if yes, return the index.\r
599\r
600 @param Array The data array.\r
601 @param Type Type of the data in this array.\r
602 @param Value The value to be find.\r
603 @param Index The index in the array which has same value with Value.\r
604 \r
605 @retval TRUE Found the value in the array.\r
606 @retval FALSE Not found the value.\r
607\r
608**/\r
609BOOLEAN \r
610FindArrayData (\r
611 IN VOID *Array,\r
612 IN UINT8 Type,\r
613 IN UINT64 Value,\r
614 OUT UINTN *Index OPTIONAL\r
615 );\r
616\r
7936fb6a 617/**\r
618 Process a Question's Option (whether selected or un-selected).\r
619\r
620 @param Selection Pointer to UI_MENU_SELECTION.\r
621 @param MenuOption The MenuOption for this Question.\r
622 @param Selected TRUE: if Question is selected.\r
623 @param OptionString Pointer of the Option String to be displayed.\r
624\r
625 @retval EFI_SUCCESS Question Option process success.\r
626 @retval Other Question Option process fail.\r
627\r
628**/\r
629EFI_STATUS\r
630ProcessOptions (\r
631 IN UI_MENU_SELECTION *Selection,\r
632 IN UI_MENU_OPTION *MenuOption,\r
633 IN BOOLEAN Selected,\r
634 OUT CHAR16 **OptionString\r
ed66e1bc 635 );\r
7936fb6a 636\r
637/**\r
638 Process the help string: Split StringPtr to several lines of strings stored in\r
639 FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.\r
640\r
641 @param StringPtr The entire help string.\r
642 @param FormattedString The oupput formatted string.\r
6c310dfb 643 @param EachLineWidth The string length of each line in the formatted string.\r
7936fb6a 644 @param RowCount TRUE: if Question is selected.\r
645\r
646**/\r
ba46ab94 647UINTN\r
7936fb6a 648ProcessHelpString (\r
6c310dfb
ED
649 IN CHAR16 *StringPtr,\r
650 OUT CHAR16 **FormattedString,\r
651 OUT UINT16 *EachLineWidth,\r
652 IN UINTN RowCount\r
ed66e1bc 653 );\r
7936fb6a 654\r
655/**\r
656 Update key's help imformation.\r
657\r
8b0fc5c1 658 @param Selection Tell setup browser the information about the Selection\r
7936fb6a 659 @param MenuOption The Menu option\r
660 @param Selected Whether or not a tag be selected\r
661\r
662**/\r
663VOID\r
664UpdateKeyHelp (\r
8b0fc5c1 665 IN UI_MENU_SELECTION *Selection,\r
7936fb6a 666 IN UI_MENU_OPTION *MenuOption,\r
667 IN BOOLEAN Selected\r
ed66e1bc 668 );\r
7936fb6a 669\r
670/**\r
671 Clear retangle with specified text attribute.\r
672\r
673 @param LeftColumn Left column of retangle.\r
674 @param RightColumn Right column of retangle.\r
675 @param TopRow Start row of retangle.\r
676 @param BottomRow End row of retangle.\r
677 @param TextAttribute The character foreground and background.\r
678\r
679**/\r
680VOID\r
681ClearLines (\r
8b0fc5c1 682 IN UINTN LeftColumn,\r
683 IN UINTN RightColumn,\r
684 IN UINTN TopRow,\r
685 IN UINTN BottomRow,\r
686 IN UINTN TextAttribute\r
ed66e1bc 687 );\r
7936fb6a 688\r
689/**\r
690 Count the storage space of a Unicode string.\r
691\r
692 This function handles the Unicode string with NARROW_CHAR\r
693 and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR\r
d66e6c16 694 does not count in the resultant output. If a WIDE_CHAR is\r
7936fb6a 695 hit, then 2 Unicode character will consume an output storage\r
696 space with size of CHAR16 till a NARROW_CHAR is hit.\r
697\r
771ececd
LG
698 If String is NULL, then ASSERT ().\r
699\r
7936fb6a 700 @param String The input string to be counted.\r
701\r
702 @return Storage space for the input string.\r
703\r
704**/\r
705UINTN\r
706GetStringWidth (\r
8b0fc5c1 707 IN CHAR16 *String\r
ed66e1bc 708 );\r
7936fb6a 709\r
710/**\r
711 Will copy LineWidth amount of a string in the OutputString buffer and return the\r
712 number of CHAR16 characters that were copied into the OutputString buffer.\r
6c310dfb 713 In the code, it deals \r,\n,\r\n same as \n\r, also it not process the \r or \g.\r
7936fb6a 714\r
715 @param InputString String description for this option.\r
716 @param LineWidth Width of the desired string to extract in CHAR16\r
717 characters\r
6c310dfb 718 @param GlyphWidth The glyph width of the beging char in the string.\r
7936fb6a 719 @param Index Where in InputString to start the copy process\r
720 @param OutputString Buffer to copy the string into\r
721\r
722 @return Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
723\r
724**/\r
725UINT16\r
726GetLineByWidth (\r
727 IN CHAR16 *InputString,\r
728 IN UINT16 LineWidth,\r
6c310dfb 729 IN OUT UINT16 *GlyphWidth,\r
7936fb6a 730 IN OUT UINTN *Index,\r
731 OUT CHAR16 **OutputString\r
ed66e1bc 732 );\r
7936fb6a 733\r
734/**\r
735 Get the supported width for a particular op-code\r
736\r
737 @param Statement The FORM_BROWSER_STATEMENT structure passed in.\r
738 @param Handle The handle in the HII database being used\r
739\r
740 @return Returns the number of CHAR16 characters that is support.\r
741\r
742**/\r
743UINT16\r
744GetWidth (\r
745 IN FORM_BROWSER_STATEMENT *Statement,\r
746 IN EFI_HII_HANDLE Handle\r
ed66e1bc 747 );\r
7936fb6a 748\r
749/**\r
750 Concatenate a narrow string to another string.\r
751\r
752 @param Destination The destination string.\r
753 @param Source The source string. The string to be concatenated.\r
754 to the end of Destination.\r
755\r
756**/\r
757VOID\r
758NewStrCat (\r
8b0fc5c1 759 IN OUT CHAR16 *Destination,\r
760 IN CHAR16 *Source\r
ed66e1bc 761 );\r
7936fb6a 762\r
763/**\r
764 Wait for a key to be pressed by user.\r
765\r
766 @param Key The key which is pressed by user.\r
767\r
768 @retval EFI_SUCCESS The function always completed successfully.\r
769\r
770**/\r
771EFI_STATUS\r
772WaitForKeyStroke (\r
773 OUT EFI_INPUT_KEY *Key\r
ed66e1bc 774 );\r
7936fb6a 775\r
776/**\r
777 Reset stack pointer to begin of the stack.\r
778\r
779**/\r
780VOID\r
781ResetScopeStack (\r
782 VOID\r
ed66e1bc 783 );\r
7936fb6a 784\r
31585af4
ED
785/**\r
786 Push the expression options onto the Stack.\r
787\r
788 @param Pointer Pointer to the current expression.\r
789 @param Level Which type this expression belong to. Form, \r
790 statement or option?\r
791\r
792 @retval EFI_SUCCESS The value was pushed onto the stack.\r
793 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
794\r
795**/\r
796EFI_STATUS\r
797PushConditionalExpression (\r
798 IN FORM_EXPRESSION *Pointer,\r
799 IN EXPRESS_LEVEL Level\r
800 );\r
801\r
802/**\r
803 Pop the expression options from the Stack\r
804\r
805 @param Level Which type this expression belong to. Form, \r
806 statement or option?\r
807\r
808 @retval EFI_SUCCESS The value was pushed onto the stack.\r
809 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
810\r
811**/\r
812EFI_STATUS\r
813PopConditionalExpression (\r
814 IN EXPRESS_LEVEL Level\r
815 );\r
816 \r
817/**\r
818 Get the expression Buffer pointer.\r
819 \r
820 @param Level Which type this expression belong to. Form, \r
821 statement or option?\r
822\r
823 @retval The start pointer of the expression buffer or NULL.\r
824\r
825**/\r
826FORM_EXPRESSION **\r
827GetConditionalExpressionList (\r
828 IN EXPRESS_LEVEL Level\r
829 );\r
830\r
831/**\r
832 Get the expression list count.\r
833 \r
834 @param Level Which type this expression belong to. Form, \r
835 statement or option?\r
836\r
837 @retval >=0 The expression count\r
838 @retval -1 Input parameter error.\r
839\r
840**/\r
841INTN \r
842GetConditionalExpressionCount (\r
843 IN EXPRESS_LEVEL Level\r
844 );\r
845\r
7936fb6a 846/**\r
847 Push an Operand onto the Stack\r
848\r
849 @param Operand Operand to push.\r
850\r
851 @retval EFI_SUCCESS The value was pushed onto the stack.\r
852 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
853 stack.\r
854\r
855**/\r
856EFI_STATUS\r
857PushScope (\r
858 IN UINT8 Operand\r
ed66e1bc 859 );\r
7936fb6a 860\r
861/**\r
862 Pop an Operand from the Stack\r
863\r
864 @param Operand Operand to pop.\r
865\r
866 @retval EFI_SUCCESS The value was pushed onto the stack.\r
867 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
868 stack.\r
869\r
870**/\r
871EFI_STATUS\r
872PopScope (\r
873 OUT UINT8 *Operand\r
ed66e1bc 874 );\r
7936fb6a 875\r
2573712e
LG
876/**\r
877 Reset stack pointer to begin of the stack.\r
878\r
879**/\r
880VOID\r
881ResetCurrentExpressionStack (\r
882 VOID\r
883 );\r
884\r
885/**\r
886 Push current expression onto the Stack\r
887\r
888 @param Pointer Pointer to current expression.\r
889\r
890 @retval EFI_SUCCESS The value was pushed onto the stack.\r
891 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
892\r
893**/\r
894EFI_STATUS\r
895PushCurrentExpression (\r
896 IN VOID *Pointer\r
897 );\r
898\r
899/**\r
900 Pop current expression from the Stack\r
901\r
902 @param Pointer Pointer to current expression to be pop.\r
903\r
904 @retval EFI_SUCCESS The value was pushed onto the stack.\r
905 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
906\r
907**/\r
908EFI_STATUS\r
909PopCurrentExpression (\r
910 OUT VOID **Pointer\r
911 );\r
912\r
913/**\r
914 Reset stack pointer to begin of the stack.\r
915\r
916**/\r
917VOID\r
918ResetMapExpressionListStack (\r
919 VOID\r
920 );\r
921\r
922/**\r
923 Push the list of map expression onto the Stack\r
924\r
925 @param Pointer Pointer to the list of map expression to be pushed.\r
926\r
927 @retval EFI_SUCCESS The value was pushed onto the stack.\r
928 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
929\r
930**/\r
931EFI_STATUS\r
932PushMapExpressionList (\r
933 IN VOID *Pointer\r
934 );\r
935\r
936/**\r
937 Pop the list of map expression from the Stack\r
938\r
939 @param Pointer Pointer to the list of map expression to be pop.\r
940\r
941 @retval EFI_SUCCESS The value was pushed onto the stack.\r
942 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.\r
943\r
944**/\r
945EFI_STATUS\r
946PopMapExpressionList (\r
947 OUT VOID **Pointer\r
948 );\r
949\r
7936fb6a 950/**\r
951 Get Form given its FormId.\r
952\r
953 @param FormSet The formset which contains this form.\r
954 @param FormId Id of this form.\r
955\r
956 @retval Pointer The form.\r
957 @retval NULL Specified Form is not found in the formset.\r
958\r
959**/\r
960FORM_BROWSER_FORM *\r
961IdToForm (\r
962 IN FORM_BROWSER_FORMSET *FormSet,\r
963 IN UINT16 FormId\r
ed66e1bc 964 );\r
7936fb6a 965\r
966/**\r
967 Search a Question in Formset scope using its QuestionId.\r
968\r
969 @param FormSet The formset which contains this form.\r
970 @param Form The form which contains this Question.\r
971 @param QuestionId Id of this Question.\r
972\r
973 @retval Pointer The Question.\r
974 @retval NULL Specified Question not found in the form.\r
975\r
976**/\r
977FORM_BROWSER_STATEMENT *\r
978IdToQuestion (\r
979 IN FORM_BROWSER_FORMSET *FormSet,\r
980 IN FORM_BROWSER_FORM *Form,\r
981 IN UINT16 QuestionId\r
ed66e1bc 982 );\r
7936fb6a 983\r
984/**\r
985 Zero extend integer/boolean/date/time to UINT64 for comparing.\r
986\r
987 @param Value HII Value to be converted.\r
988\r
989**/\r
990VOID\r
991ExtendValueToU64 (\r
992 IN EFI_HII_VALUE *Value\r
ed66e1bc 993 );\r
7936fb6a 994\r
995/**\r
996 Compare two Hii value.\r
997\r
998 @param Value1 Expression value to compare on left-hand.\r
999 @param Value2 Expression value to compare on right-hand.\r
8f420676
ED
1000 @param Result Return value after compare.\r
1001 retval 0 Two operators equal.\r
1002 return Positive value if Value1 is greater than Value2.\r
1003 retval Negative value if Value1 is less than Value2.\r
7936fb6a 1004 @param HiiHandle Only required for string compare.\r
1005\r
8f420676
ED
1006 @retval other Could not perform compare on two values.\r
1007 @retval EFI_SUCCESS Compare the value success.\r
7936fb6a 1008\r
1009**/\r
8f420676 1010EFI_STATUS\r
7936fb6a 1011CompareHiiValue (\r
1012 IN EFI_HII_VALUE *Value1,\r
1013 IN EFI_HII_VALUE *Value2,\r
8f420676 1014 OUT INTN *Result,\r
7936fb6a 1015 IN EFI_HII_HANDLE HiiHandle OPTIONAL\r
ed66e1bc 1016 );\r
7936fb6a 1017\r
1018/**\r
1019 Evaluate the result of a HII expression\r
1020\r
3018ca2d 1021 If Expression is NULL, then ASSERT.\r
1022\r
7936fb6a 1023 @param FormSet FormSet associated with this expression.\r
1024 @param Form Form associated with this expression.\r
1025 @param Expression Expression to be evaluated.\r
1026\r
1027 @retval EFI_SUCCESS The expression evaluated successfuly\r
1028 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId\r
1029 could not be found.\r
1030 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the\r
1031 stack.\r
1032 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack\r
1033 @retval EFI_INVALID_PARAMETER Syntax error with the Expression\r
1034\r
1035**/\r
1036EFI_STATUS\r
1037EvaluateExpression (\r
1038 IN FORM_BROWSER_FORMSET *FormSet,\r
1039 IN FORM_BROWSER_FORM *Form,\r
1040 IN OUT FORM_EXPRESSION *Expression\r
ed66e1bc 1041 );\r
7936fb6a 1042\r
31585af4
ED
1043/**\r
1044 Return the result of the expression list. Check the expression list and \r
1045 return the highest priority express result. \r
1046 Priority: DisableIf > SuppressIf > GrayOutIf > FALSE\r
1047\r
1048 @param ExpList The input expression list.\r
1049 @param Evaluate Whether need to evaluate the expression first.\r
1050 @param FormSet FormSet associated with this expression. Only \r
1051 needed when Evaluate is TRUE\r
1052 @param Form Form associated with this expression. Only \r
1053 needed when Evaluate is TRUE \r
1054\r
1055 @retval EXPRESS_RESULT Return the higher priority express result. \r
1056 DisableIf > SuppressIf > GrayOutIf > FALSE\r
1057\r
1058**/\r
1059EXPRESS_RESULT \r
1060EvaluateExpressionList (\r
1061 IN FORM_EXPRESSION_LIST *ExpList,\r
1062 IN BOOLEAN Evaluate,\r
1063 IN FORM_BROWSER_FORMSET *FormSet, OPTIONAL\r
1064 IN FORM_BROWSER_FORM *Form OPTIONAL\r
1065 );\r
1066\r
7936fb6a 1067#endif // _UI_H\r