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 EFIAPI
54 MenuBarInit (
55   IN CONST EDITOR_MENU_ITEM  *Items
56   );
57 
58 /**
59   Initialize the control hot-key with the specified items.
60 
61   @param[in] Items              The hot-key functions.
62 
63   @retval EFI_SUCCESS           The initialization was correct.
64 **/
65 EFI_STATUS
66 EFIAPI
67 ControlHotKeyInit (
68   IN MENU_ITEM_FUNCTION  *Items
69   );
70 
71 /**
72   Cleanup function for a menu bar.  frees all allocated memory.
73 **/
74 VOID
75 EFIAPI
76 MenuBarCleanup (
77   VOID
78   );
79 
80 /**
81   Refresh function for the menu bar.
82 
83   @param[in] LastRow            The last printable row.
84   @param[in] LastCol            The last printable column.
85 
86   @retval EFI_SUCCESS           The refresh was successful.
87 **/
88 EFI_STATUS
89 EFIAPI
90 MenuBarRefresh (
91   IN CONST UINTN LastRow,
92   IN CONST UINTN LastCol
93   );
94 
95 /**
96   Function to dispatch the correct function based on a function key (F1...)
97 
98   @param[in] Key                The pressed key.
99 
100   @retval EFI_NOT_FOUND         The key was not a valid function key
101                                 (an error was sent to the status bar).
102   @return The return value from the called dispatch function.
103 **/
104 EFI_STATUS
105 EFIAPI
106 MenuBarDispatchFunctionKey (
107   IN CONST EFI_INPUT_KEY   *Key
108   );
109 
110 /**
111   Function to dispatch the correct function based on a control-based key (ctrl+o...)
112 
113   @param[in] Key                The pressed key.
114 
115   @retval EFI_NOT_FOUND         The key was not a valid control-based key
116                                 (an error was sent to the status bar).
117   @return EFI_SUCCESS.
118 **/
119 EFI_STATUS
120 EFIAPI
121 MenuBarDispatchControlHotKey (
122   IN CONST EFI_INPUT_KEY   *Key
123   );
124 
125 #endif
126