summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Include/Protocol/FormBrowserEx.h
blob: 3bb64c6ff9b2fa90304837c96b74d019a72f6f2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/** @file
  Extension Form Browser Protocol provides the services that can be used to 
  register the different hot keys for the standard Browser actions described in UEFI specification.

Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under 
the terms and conditions of the BSD License that accompanies this distribution.  
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.                                            

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef __FORM_BROWSER_EXTENSION_H__
#define __FORM_BROWSER_EXTENSION_H__

#define FORM_BROWSER_EXTENSION_PROTOCOL_GUID  \
  { 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 0xde, 0x6f, 0x80, 0x85, 0x5d, 0x7d, 0xa4 } }

typedef struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL   EFI_FORM_BROWSER_EXTENSION_PROTOCOL;

//
// Return value of SAVE_REMINDER() that describes whether the changed data is saved or discarded.
//
#define BROWSER_NO_CHANGES          0
#define BROWSER_SAVE_CHANGES        1
#define BROWSER_DISCARD_CHANGES     2
#define BROWSER_KEEP_CURRENT        3

//
// Browser actions. They can be cominbed together. 
// If more than one actions are specified, the action with low bit will be executed first. 
//
#define BROWSER_ACTION_UNREGISTER   0
#define BROWSER_ACTION_DISCARD      BIT0
#define BROWSER_ACTION_DEFAULT      BIT1
#define BROWSER_ACTION_SUBMIT       BIT2
#define BROWSER_ACTION_RESET        BIT3
#define BROWSER_ACTION_EXIT         BIT4

//
// Scope for Browser action. It may be Form, FormSet or System level.
//
typedef enum {
  FormLevel,
  FormSetLevel,
  SystemLevel,
  MaxLevel
} BROWSER_SETTING_SCOPE;

/**
  Configure what scope the hot key will impact.
  All hot keys have the same scope. The mixed hot keys with the different level are not supported.
  If no scope is set, the default scope will be FormSet level.
  After all registered hot keys are removed, previous Scope can reset to another level.
  
  @param[in] Scope               Scope level to be set. 
  
  @retval EFI_SUCCESS            Scope is set correctly.
  @retval EFI_INVALID_PARAMETER  Scope is not the valid value specified in BROWSER_SETTING_SCOPE. 
  @retval EFI_UNSPPORTED         Scope level is different from current one that the registered hot keys have.

**/
typedef
EFI_STATUS
(EFIAPI *SET_SCOPE) (
  IN BROWSER_SETTING_SCOPE Scope
  );

/**
  Register the hot key with its browser action, or unregistered the hot key.
  If the action value is zero, the hot key will be unregistered if it has been registered.
  If the same hot key has been registered, the new action and help string will override the previous ones.
  
  @param[in] KeyData     A pointer to a buffer that describes the keystroke
                         information for the hot key. Its type is EFI_INPUT_KEY to 
                         be supported by all ConsoleIn devices.
  @param[in] Action      Action value that describes what action will be trigged when the hot key is pressed. 
  @param[in] DefaultId   Specifies the type of defaults to retrieve, which is only for DEFAULT action.
  @param[in] HelpString  Help string that describes the hot key information.
                         Its value may be NULL for the unregistered hot key.
  
  @retval EFI_SUCCESS            Hot key is registered or unregistered.
  @retval EFI_INVALID_PARAMETER  KeyData is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *REGISTER_HOT_KEY) (
  IN EFI_INPUT_KEY *KeyData,
  IN UINT32        Action,
  IN UINT16        DefaultId,
  IN EFI_STRING    HelpString OPTIONAL
  );

/**
  This handler is responsbile for the left things on normal boot after all UI forms are closed.
  For example, it can continue to boot the first boot option. 

  It will be used only when EXIT action is trigged as system level.
**/
typedef
VOID
(EFIAPI *EXIT_HANDLER) (
  VOID
  );

/**
  Register Exit handler function. 
  When more than one handler function is registered, the latter one will override the previous one. 
  When NULL handler is specified, the previous Exit handler will be unregistered. 
  
  @param[in] Handler      Pointer to handler function. 

**/
typedef
VOID
(EFIAPI *REGISTER_EXIT_HANDLER) (
  IN EXIT_HANDLER Handler
  );

/**
  Create reminder to let user to choose save or discard the changed browser data.
  Caller can use it to actively check the changed browser data.

  @retval BROWSER_NO_CHANGES       No browser data is changed.
  @retval BROWSER_SAVE_CHANGES     The changed browser data is saved.
  @retval BROWSER_DISCARD_CHANGES  The changed browser data is discard.
  @retval BROWSER_KEEP_CURRENT     Browser keep current changes.

**/
typedef
UINT32
(EFIAPI *SAVE_REMINDER)(
  VOID
  );

struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL {
  SET_SCOPE              SetScope;
  REGISTER_HOT_KEY       RegisterHotKey;
  REGISTER_EXIT_HANDLER  RegiserExitHandler;
  SAVE_REMINDER          SaveReminder;
};

extern EFI_GUID gEfiFormBrowserExProtocolGuid;

#endif