1 /** @file
2   This library class defines a set of interfaces to customize Display module
3 
4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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 __CUSTOMIZED_DISPLAY_LIB_H__
16 #define __CUSTOMIZED_DISPLAY_LIB_H__
17 
18 #include <Protocol/DisplayProtocol.h>
19 
20 /**
21 +------------------------------------------------------------------------------+
22 |                                 Setup Page                                   |
23 +------------------------------------------------------------------------------+
24 
25 Statement
26 Statement
27 Statement
28 
29 
30 
31 
32 
33 +------------------------------------------------------------------------------+
34 |                                F9=Reset to Defaults        F10=Save          |
35 | ^"=Move Highlight          <Spacebar> Toggles Checkbox     Esc=Exit          |
36 +------------------------------------------------------------------------------+
37   StatusBar
38 **/
39 
40 /**
41   This funtion defines Page Frame and Backgroud.
42 
43   Based on the above layout, it will be responsible for HeaderHeight, FooterHeight,
44   StatusBarHeight and Backgroud. And, it will reserve Screen for Statement.
45 
46   @param[in]  FormData             Form Data to be shown in Page.
47   @param[out] ScreenForStatement   Screen to be used for Statement. (Prompt, Value and Help)
48 
49   @return Status
50 **/
51 EFI_STATUS
52 EFIAPI
53 DisplayPageFrame (
54   IN FORM_DISPLAY_ENGINE_FORM       *FormData,
55   OUT EFI_SCREEN_DESCRIPTOR         *ScreenForStatement
56   );
57 
58 /**
59   Clear Screen to the initial state.
60 **/
61 VOID
62 EFIAPI
63 ClearDisplayPage (
64   VOID
65   );
66 
67 /**
68   This function updates customized key panel's help information.
69   The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-.
70   and arrange them in Footer panel.
71 
72   @param[in]  FormData       Form Data to be shown in Page. FormData has the highlighted statement.
73   @param[in]  Statement      The statement current selected.
74   @param[in]  Selected       Whether or not a tag be selected. TRUE means Enter has hit this question.
75 **/
76 VOID
77 EFIAPI
78 RefreshKeyHelp (
79   IN FORM_DISPLAY_ENGINE_FORM      *FormData,
80   IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
81   IN  BOOLEAN                      Selected
82   );
83 
84 /**
85   Update status bar.
86 
87   This function updates the status bar on the bottom of menu screen. It just shows StatusBar.
88   Original logic in this function should be splitted out.
89 
90   @param[in]  MessageType            The type of message to be shown. InputError or Configuration Changed.
91   @param[in]  State                  Show or Clear Message.
92 **/
93 VOID
94 EFIAPI
95 UpdateStatusBar (
96   IN  UINTN                  MessageType,
97   IN  BOOLEAN                State
98   );
99 
100 /**
101   Create popup window.
102 
103   This function draws OEM/Vendor specific pop up windows.
104 
105   @param[out]  Key    User Input Key
106   @param       ...    String to be shown in Popup. The variable argument list is terminated by a NULL.
107 
108 **/
109 VOID
110 EFIAPI
111 CreateDialog (
112   OUT EFI_INPUT_KEY  *Key,        OPTIONAL
113   ...
114   );
115 
116 /**
117   Confirm how to handle the changed data.
118 
119   @return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values.
120 **/
121 UINTN
122 EFIAPI
123 ConfirmDataChange (
124   VOID
125   );
126 
127 /**
128   OEM specifies whether Setup exits Page by ESC key.
129 
130   This function customized the behavior that whether Setup exits Page so that
131   system able to boot when configuration is not changed.
132 
133   @retval  TRUE     Exits FrontPage
134   @retval  FALSE    Don't exit FrontPage.
135 **/
136 BOOLEAN
137 EFIAPI
138 FormExitPolicy (
139   VOID
140   );
141 
142 /**
143   Set Timeout value for a ceratain Form to get user response.
144 
145   This function allows to set timeout value on a ceratain form if necessary.
146   If timeout is not zero, the form will exit if user has no response in timeout.
147 
148   @param[in]  FormData   Form Data to be shown in Page
149 
150   @return 0     No timeout for this form.
151   @return > 0   Timeout value in 100 ns units.
152 **/
153 UINT64
154 EFIAPI
155 FormExitTimeout (
156   IN FORM_DISPLAY_ENGINE_FORM      *FormData
157   );
158 
159 //
160 // Print Functions
161 //
162 /**
163   Prints a unicode string to the default console, at
164   the supplied cursor position, using L"%s" format.
165 
166   @param  Column     The cursor position to print the string at. When it is -1, use current Position.
167   @param  Row        The cursor position to print the string at. When it is -1, use current Position.
168   @param  String     String pointer.
169 
170   @return Length of string printed to the console
171 
172 **/
173 UINTN
174 EFIAPI
175 PrintStringAt (
176   IN UINTN     Column,
177   IN UINTN     Row,
178   IN CHAR16    *String
179   );
180 
181 
182 /**
183   Prints a unicode string with the specified width to the default console, at
184   the supplied cursor position, using L"%s" format.
185 
186   @param  Column     The cursor position to print the string at. When it is -1, use current Position.
187   @param  Row        The cursor position to print the string at. When it is -1, use current Position.
188   @param  String     String pointer.
189   @param  Width      Width for String to be printed. If the print length of String < Width,
190                      Space char (L' ') will be used to append String.
191 
192   @return Length of string printed to the console
193 
194 **/
195 UINTN
196 EFIAPI
197 PrintStringAtWithWidth (
198   IN UINTN     Column,
199   IN UINTN     Row,
200   IN CHAR16    *String,
201   IN UINTN     Width
202   );
203 
204 /**
205   Prints a character to the default console, at
206   the supplied cursor position, using L"%c" format.
207 
208   @param  Column     The cursor position to print the string at. When it is -1, use current Position.
209   @param  Row        The cursor position to print the string at. When it is -1, use current Position.
210   @param  Character  Character to print.
211 
212   @return Length of string printed to the console.
213 
214 **/
215 UINTN
216 EFIAPI
217 PrintCharAt (
218   IN UINTN     Column,
219   IN UINTN     Row,
220   CHAR16       Character
221   );
222 
223 /**
224   Clear retangle with specified text attribute.
225 
226   @param  LeftColumn     Left column of retangle.
227   @param  RightColumn    Right column of retangle.
228   @param  TopRow         Start row of retangle.
229   @param  BottomRow      End row of retangle.
230   @param  TextAttribute  The character foreground and background.
231 
232 **/
233 VOID
234 EFIAPI
235 ClearLines (
236   IN UINTN               LeftColumn,
237   IN UINTN               RightColumn,
238   IN UINTN               TopRow,
239   IN UINTN               BottomRow,
240   IN UINTN               TextAttribute
241   );
242 
243 //
244 // Color Setting Functions
245 //
246 /**
247   Get OEM/Vendor specific popup attribute colors.
248 
249   @retval  Byte code color setting for popup color.
250 **/
251 UINT8
252 EFIAPI
253 GetPopupColor (
254   VOID
255   );
256 
257 /**
258   Get OEM/Vendor specific popup attribute colors.
259 
260   @retval  Byte code color setting for popup inverse color.
261 **/
262 UINT8
263 EFIAPI
264 GetPopupInverseColor (
265   VOID
266   );
267 
268 /**
269   Get OEM/Vendor specific PickList color attribute.
270 
271   @retval  Byte code color setting for pick list color.
272 **/
273 UINT8
274 EFIAPI
275 GetPickListColor (
276   VOID
277   );
278 
279 /**
280   Get OEM/Vendor specific arrow color attribute.
281 
282   @retval  Byte code color setting for arrow color.
283 **/
284 UINT8
285 EFIAPI
286 GetArrowColor (
287   VOID
288   );
289 
290 /**
291   Get OEM/Vendor specific info text color attribute.
292 
293   @retval  Byte code color setting for info text color.
294 **/
295 UINT8
296 EFIAPI
297 GetInfoTextColor (
298   VOID
299   );
300 
301 /**
302   Get OEM/Vendor specific help text color attribute.
303 
304   @retval  Byte code color setting for help text color.
305 **/
306 UINT8
307 EFIAPI
308 GetHelpTextColor (
309   VOID
310   );
311 
312 /**
313   Get OEM/Vendor specific grayed out text color attribute.
314 
315   @retval  Byte code color setting for grayed out text color.
316 **/
317 UINT8
318 EFIAPI
319 GetGrayedTextColor (
320   VOID
321   );
322 
323 /**
324   Get OEM/Vendor specific highlighted text color attribute.
325 
326   @retval  Byte code color setting for highlight text color.
327 **/
328 UINT8
329 EFIAPI
330 GetHighlightTextColor (
331   VOID
332   );
333 
334 /**
335   Get OEM/Vendor specific field text color attribute.
336 
337   @retval  Byte code color setting for field text color.
338 **/
339 UINT8
340 EFIAPI
341 GetFieldTextColor (
342   VOID
343   );
344 
345 /**
346   Get OEM/Vendor specific subtitle text color attribute.
347 
348   @retval  Byte code color setting for subtitle text color.
349 **/
350 UINT8
351 EFIAPI
352 GetSubTitleTextColor (
353   VOID
354   );
355 
356 #endif
357