mb/google/brya/var/orisa: Update Type C DisplayPort HPD Configuration
[coreboot2.git] / payloads / libpayload / curses / menu / menu.h
blob1df980c551437ae62ac77c61d24a5ce1a2425ecb
1 /****************************************************************************
2 * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. *
3 * *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
11 * *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
14 * *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22 * *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
26 * authorization. *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Juergen Pfeifer, 1995,1997 *
31 ****************************************************************************/
33 /* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */
35 #ifndef ETI_MENU
36 #define ETI_MENU
38 #ifdef AMIGA
39 #define TEXT TEXT_ncurses
40 #endif
42 #include <curses.h>
43 #include <eti.h>
44 #include <ncurses_cfg.h>
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
50 typedef int Menu_Options;
51 typedef int Item_Options;
53 /* Menu options: */
54 #define O_ONEVALUE (0x01)
55 #define O_SHOWDESC (0x02)
56 #define O_ROWMAJOR (0x04)
57 #define O_IGNORECASE (0x08)
58 #define O_SHOWMATCH (0x10)
59 #define O_NONCYCLIC (0x20)
61 /* Item options: */
62 #define O_SELECTABLE (0x01)
64 typedef struct
66 const char* str;
67 unsigned short length;
68 } TEXT;
70 typedef struct tagITEM
72 TEXT name; /* name of menu item */
73 TEXT description; /* description of item, optional in display */
74 struct tagMENU *imenu; /* Pointer to parent menu */
75 void *userptr; /* Pointer to user defined per item data */
76 Item_Options opt; /* Item options */
77 short index; /* Item number if connected to a menu */
78 short y; /* y and x location of item in menu */
79 short x;
80 bool value; /* Selection value */
82 struct tagITEM *left; /* neighbor items */
83 struct tagITEM *right;
84 struct tagITEM *up;
85 struct tagITEM *down;
87 } ITEM;
89 typedef void (*Menu_Hook)(struct tagMENU *);
91 typedef struct tagMENU
93 short height; /* Nr. of chars high */
94 short width; /* Nr. of chars wide */
95 short rows; /* Nr. of items high */
96 short cols; /* Nr. of items wide */
97 short frows; /* Nr. of formatted items high */
98 short fcols; /* Nr. of formatted items wide */
99 short arows; /* Nr. of items high (actual) */
100 short namelen; /* Max. name length */
101 short desclen; /* Max. description length */
102 short marklen; /* Length of mark, if any */
103 short itemlen; /* Length of one item */
104 short spc_desc; /* Spacing for descriptor */
105 short spc_cols; /* Spacing for columns */
106 short spc_rows; /* Spacing for rows */
107 char *pattern; /* Buffer to store match chars */
108 short pindex; /* Index into pattern buffer */
109 WINDOW *win; /* Window containing menu */
110 WINDOW *sub; /* Subwindow for menu display */
111 WINDOW *userwin; /* User's window */
112 WINDOW *usersub; /* User's subwindow */
113 ITEM **items; /* array of items */
114 short nitems; /* Nr. of items in menu */
115 ITEM *curitem; /* Current item */
116 short toprow; /* Top row of menu */
117 chtype fore; /* Selection attribute */
118 chtype back; /* Nonselection attribute */
119 chtype grey; /* Inactive attribute */
120 unsigned char pad; /* Pad character */
122 Menu_Hook menuinit; /* User hooks */
123 Menu_Hook menuterm;
124 Menu_Hook iteminit;
125 Menu_Hook itemterm;
127 void *userptr; /* Pointer to menus user data */
128 char *mark; /* Pointer to marker string */
130 Menu_Options opt; /* Menu options */
131 unsigned short status; /* Internal state of menu */
133 } MENU;
135 /* Define keys */
137 #define REQ_LEFT_ITEM (KEY_MAX + 1)
138 #define REQ_RIGHT_ITEM (KEY_MAX + 2)
139 #define REQ_UP_ITEM (KEY_MAX + 3)
140 #define REQ_DOWN_ITEM (KEY_MAX + 4)
141 #define REQ_SCR_ULINE (KEY_MAX + 5)
142 #define REQ_SCR_DLINE (KEY_MAX + 6)
143 #define REQ_SCR_DPAGE (KEY_MAX + 7)
144 #define REQ_SCR_UPAGE (KEY_MAX + 8)
145 #define REQ_FIRST_ITEM (KEY_MAX + 9)
146 #define REQ_LAST_ITEM (KEY_MAX + 10)
147 #define REQ_NEXT_ITEM (KEY_MAX + 11)
148 #define REQ_PREV_ITEM (KEY_MAX + 12)
149 #define REQ_TOGGLE_ITEM (KEY_MAX + 13)
150 #define REQ_CLEAR_PATTERN (KEY_MAX + 14)
151 #define REQ_BACK_PATTERN (KEY_MAX + 15)
152 #define REQ_NEXT_MATCH (KEY_MAX + 16)
153 #define REQ_PREV_MATCH (KEY_MAX + 17)
155 #define MIN_MENU_COMMAND (KEY_MAX + 1)
156 #define MAX_MENU_COMMAND (KEY_MAX + 17)
159 * Some AT&T code expects MAX_COMMAND to be out-of-band not
160 * just for menu commands but for forms ones as well.
162 #if defined(MAX_COMMAND)
163 # if (MAX_MENU_COMMAND > MAX_COMMAND)
164 # error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND
165 # elif (MAX_COMMAND != (KEY_MAX + 128))
166 # error Something is wrong -- MAX_COMMAND is already inconsistently defined.
167 # endif
168 #else
169 # define MAX_COMMAND (KEY_MAX + 128)
170 #endif
172 /* --------- prototypes for libmenu functions ----------------------------- */
174 extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *);
175 extern NCURSES_EXPORT(ITEM *) current_item (const MENU *);
176 extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *);
178 extern NCURSES_EXPORT(MENU *) new_menu (ITEM **);
180 extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *);
181 extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *);
183 extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *);
184 extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *);
185 extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *);
186 extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *);
188 extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *);
189 extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *);
191 extern NCURSES_EXPORT(const char *) item_description (const ITEM *);
192 extern NCURSES_EXPORT(const char *) item_name (const ITEM *);
193 extern NCURSES_EXPORT(const char *) menu_mark (const MENU *);
194 extern NCURSES_EXPORT(const char *) menu_request_name (int);
196 extern NCURSES_EXPORT(char *) menu_pattern (const MENU *);
198 extern NCURSES_EXPORT(void *) menu_userptr (const MENU *);
199 extern NCURSES_EXPORT(void *) item_userptr (const ITEM *);
201 extern NCURSES_EXPORT(chtype) menu_back (const MENU *);
202 extern NCURSES_EXPORT(chtype) menu_fore (const MENU *);
203 extern NCURSES_EXPORT(chtype) menu_grey (const MENU *);
205 extern NCURSES_EXPORT(int) free_item (ITEM *);
206 extern NCURSES_EXPORT(int) free_menu (MENU *);
207 extern NCURSES_EXPORT(int) item_count (const MENU *);
208 extern NCURSES_EXPORT(int) item_index (const ITEM *);
209 extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options);
210 extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options);
211 extern NCURSES_EXPORT(int) menu_driver (MENU *,int);
212 extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options);
213 extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options);
214 extern NCURSES_EXPORT(int) menu_pad (const MENU *);
215 extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *);
216 extern NCURSES_EXPORT(int) post_menu (MENU *);
217 extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *);
218 extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item);
219 extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook);
220 extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options);
221 extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook);
222 extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *);
223 extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool);
224 extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype);
225 extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype);
226 extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int);
227 extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype);
228 extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook);
229 extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **);
230 extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *);
231 extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options);
232 extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int);
233 extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *);
234 extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *);
235 extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook);
236 extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *);
237 extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *);
238 extern NCURSES_EXPORT(int) set_top_row (MENU *,int);
239 extern NCURSES_EXPORT(int) top_row (const MENU *);
240 extern NCURSES_EXPORT(int) unpost_menu (MENU *);
241 extern NCURSES_EXPORT(int) menu_request_by_name (const char *);
242 extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int);
243 extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *);
245 extern NCURSES_EXPORT(bool) item_value (const ITEM *);
246 extern NCURSES_EXPORT(bool) item_visible (const ITEM *);
248 extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *);
250 #if NCURSES_SP_FUNCS
251 extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **);
252 #endif
254 #ifdef __cplusplus
256 #endif
258 #endif /* ETI_MENU */