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