1 /** @file
2   Declares menubar interface functions.
3 
4   Copyright (c) 2005 - 2011, 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 _LIB_MENU_BAR_H_
16 #define _LIB_MENU_BAR_H_
17 
18 #define SCAN_CONTROL_E  5
19 #define SCAN_CONTROL_F  6
20 #define SCAN_CONTROL_G  7
21 #define SCAN_CONTROL_K  11
22 #define SCAN_CONTROL_O  15
23 #define SCAN_CONTROL_Q  17
24 #define SCAN_CONTROL_R  18
25 #define SCAN_CONTROL_S  19
26 #define SCAN_CONTROL_T  20
27 #define SCAN_CONTROL_U  21
28 #define SCAN_CONTROL_W  23
29 #define SCAN_CONTROL_Z  26
30 
31 
32 typedef
33 EFI_STATUS
34 (*MENU_ITEM_FUNCTION) (
35   VOID
36   );
37 
38 typedef struct _EDITOR_MENU_ITEM {
39   EFI_STRING_ID           NameToken;
40   CHAR16                  FunctionKeyToken;
41   MENU_ITEM_FUNCTION  Function;
42 } EDITOR_MENU_ITEM;
43 
44 /**
45   Initializa the menu bar with the specified items.
46 
47   @param[in] Items              The items to display and their functions.
48 
49   @retval EFI_SUCCESS           The initialization was correct.
50   @retval EFI_OUT_OF_RESOURCES  A memory allocation failed.
51 **/
52 EFI_STATUS
53 MenuBarInit (
54   IN CONST EDITOR_MENU_ITEM  *Items
55   );
56 
57 /**
58   Initialize the control hot-key with the specified items.
59 
60   @param[in] Items              The hot-key functions.
61 
62   @retval EFI_SUCCESS           The initialization was correct.
63 **/
64 EFI_STATUS
65 ControlHotKeyInit (
66   IN MENU_ITEM_FUNCTION  *Items
67   );
68 
69 /**
70   Cleanup function for a menu bar.  frees all allocated memory.
71 **/
72 VOID
73 MenuBarCleanup (
74   VOID
75   );
76 
77 /**
78   Refresh function for the menu bar.
79 
80   @param[in] LastRow            The last printable row.
81   @param[in] LastCol            The last printable column.
82 
83   @retval EFI_SUCCESS           The refresh was successful.
84 **/
85 EFI_STATUS
86 MenuBarRefresh (
87   IN CONST UINTN LastRow,
88   IN CONST UINTN LastCol
89   );
90 
91 /**
92   Function to dispatch the correct function based on a function key (F1...)
93 
94   @param[in] Key                The pressed key.
95 
96   @retval EFI_NOT_FOUND         The key was not a valid function key
97                                 (an error was sent to the status bar).
98   @return The return value from the called dispatch function.
99 **/
100 EFI_STATUS
101 MenuBarDispatchFunctionKey (
102   IN CONST EFI_INPUT_KEY   *Key
103   );
104 
105 /**
106   Function to dispatch the correct function based on a control-based key (ctrl+o...)
107 
108   @param[in] Key                The pressed key.
109 
110   @retval EFI_NOT_FOUND         The key was not a valid control-based key
111                                 (an error was sent to the status bar).
112   @return EFI_SUCCESS.
113 **/
114 EFI_STATUS
115 MenuBarDispatchControlHotKey (
116   IN CONST EFI_INPUT_KEY   *Key
117   );
118 
119 #endif
120