File indexing completed on 2025-01-18 10:02:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifndef ETI_MENU
0037 #define ETI_MENU
0038
0039 #ifdef AMIGA
0040 #define TEXT TEXT_ncurses
0041 #endif
0042
0043 #include <ncursesw/curses.h>
0044 #include <ncursesw/eti.h>
0045
0046 #ifdef __cplusplus
0047 extern "C"
0048 {
0049 #endif
0050
0051 #if defined(BUILDING_MENU)
0052 # define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
0053 #else
0054 # define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
0055 #endif
0056
0057 #define MENU_WRAPPED_VAR(type,name) extern MENU_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
0058
0059 #define MENU_EXPORT(type) MENU_IMPEXP type NCURSES_API
0060 #define MENU_EXPORT_VAR(type) MENU_IMPEXP type
0061
0062 typedef int Menu_Options;
0063 typedef int Item_Options;
0064
0065
0066 #define O_ONEVALUE (0x01)
0067 #define O_SHOWDESC (0x02)
0068 #define O_ROWMAJOR (0x04)
0069 #define O_IGNORECASE (0x08)
0070 #define O_SHOWMATCH (0x10)
0071 #define O_NONCYCLIC (0x20)
0072 #define O_MOUSE_MENU (0x40)
0073
0074
0075 #define O_SELECTABLE (0x01)
0076
0077 #if !NCURSES_OPAQUE_MENU
0078 typedef struct
0079 {
0080 const char *str;
0081 unsigned short length;
0082 }
0083 TEXT;
0084 #endif
0085
0086 struct tagMENU;
0087
0088 typedef struct tagITEM
0089 #if !NCURSES_OPAQUE_MENU
0090 {
0091 TEXT name;
0092 TEXT description;
0093 struct tagMENU *imenu;
0094 void *userptr;
0095 Item_Options opt;
0096 short index;
0097 short y;
0098 short x;
0099 bool value;
0100
0101 struct tagITEM *left;
0102 struct tagITEM *right;
0103 struct tagITEM *up;
0104 struct tagITEM *down;
0105
0106 }
0107 #endif
0108 ITEM;
0109
0110 typedef void (*Menu_Hook) (struct tagMENU *);
0111
0112 typedef struct tagMENU
0113 #if 1
0114 {
0115 short height;
0116 short width;
0117 short rows;
0118 short cols;
0119 short frows;
0120 short fcols;
0121 short arows;
0122 short namelen;
0123 short desclen;
0124 short marklen;
0125 short itemlen;
0126 short spc_desc;
0127 short spc_cols;
0128 short spc_rows;
0129 char *pattern;
0130 short pindex;
0131 WINDOW *win;
0132 WINDOW *sub;
0133 WINDOW *userwin;
0134 WINDOW *usersub;
0135 ITEM **items;
0136 short nitems;
0137 ITEM *curitem;
0138 short toprow;
0139 chtype fore;
0140 chtype back;
0141 chtype grey;
0142 unsigned char pad;
0143
0144 Menu_Hook menuinit;
0145 Menu_Hook menuterm;
0146 Menu_Hook iteminit;
0147 Menu_Hook itemterm;
0148
0149 void *userptr;
0150 char *mark;
0151
0152 Menu_Options opt;
0153 unsigned short status;
0154 }
0155 #endif
0156 MENU;
0157
0158
0159
0160 #define REQ_LEFT_ITEM (KEY_MAX + 1)
0161 #define REQ_RIGHT_ITEM (KEY_MAX + 2)
0162 #define REQ_UP_ITEM (KEY_MAX + 3)
0163 #define REQ_DOWN_ITEM (KEY_MAX + 4)
0164 #define REQ_SCR_ULINE (KEY_MAX + 5)
0165 #define REQ_SCR_DLINE (KEY_MAX + 6)
0166 #define REQ_SCR_DPAGE (KEY_MAX + 7)
0167 #define REQ_SCR_UPAGE (KEY_MAX + 8)
0168 #define REQ_FIRST_ITEM (KEY_MAX + 9)
0169 #define REQ_LAST_ITEM (KEY_MAX + 10)
0170 #define REQ_NEXT_ITEM (KEY_MAX + 11)
0171 #define REQ_PREV_ITEM (KEY_MAX + 12)
0172 #define REQ_TOGGLE_ITEM (KEY_MAX + 13)
0173 #define REQ_CLEAR_PATTERN (KEY_MAX + 14)
0174 #define REQ_BACK_PATTERN (KEY_MAX + 15)
0175 #define REQ_NEXT_MATCH (KEY_MAX + 16)
0176 #define REQ_PREV_MATCH (KEY_MAX + 17)
0177
0178 #define MIN_MENU_COMMAND (KEY_MAX + 1)
0179 #define MAX_MENU_COMMAND (KEY_MAX + 17)
0180
0181
0182
0183
0184
0185 #if defined(MAX_COMMAND)
0186 # if (MAX_MENU_COMMAND > MAX_COMMAND)
0187 # error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND
0188 # elif (MAX_COMMAND != (KEY_MAX + 128))
0189 # error Something is wrong -- MAX_COMMAND is already inconsistently defined.
0190 # endif
0191 #else
0192 # define MAX_COMMAND (KEY_MAX + 128)
0193 #endif
0194
0195
0196
0197 extern MENU_EXPORT(ITEM **) menu_items(const MENU *);
0198 extern MENU_EXPORT(ITEM *) current_item(const MENU *);
0199 extern MENU_EXPORT(ITEM *) new_item(const char *, const char *);
0200
0201 extern MENU_EXPORT(MENU *) new_menu(ITEM **);
0202
0203 extern MENU_EXPORT(Item_Options) item_opts(const ITEM *);
0204 extern MENU_EXPORT(Menu_Options) menu_opts(const MENU *);
0205
0206 extern MENU_EXPORT(Menu_Hook) item_init(const MENU *);
0207 extern MENU_EXPORT(Menu_Hook) item_term(const MENU *);
0208 extern MENU_EXPORT(Menu_Hook) menu_init(const MENU *);
0209 extern MENU_EXPORT(Menu_Hook) menu_term(const MENU *);
0210
0211 extern MENU_EXPORT(WINDOW *) menu_sub(const MENU *);
0212 extern MENU_EXPORT(WINDOW *) menu_win(const MENU *);
0213
0214 extern MENU_EXPORT(const char *) item_description(const ITEM *);
0215 extern MENU_EXPORT(const char *) item_name(const ITEM *);
0216 extern MENU_EXPORT(const char *) menu_mark(const MENU *);
0217 extern MENU_EXPORT(const char *) menu_request_name(int);
0218
0219 extern MENU_EXPORT(char *) menu_pattern(const MENU *);
0220
0221 extern MENU_EXPORT(void *) menu_userptr(const MENU *);
0222 extern MENU_EXPORT(void *) item_userptr(const ITEM *);
0223
0224 extern MENU_EXPORT(chtype) menu_back(const MENU *);
0225 extern MENU_EXPORT(chtype) menu_fore(const MENU *);
0226 extern MENU_EXPORT(chtype) menu_grey(const MENU *);
0227
0228 extern MENU_EXPORT(int) free_item(ITEM *);
0229 extern MENU_EXPORT(int) free_menu(MENU *);
0230 extern MENU_EXPORT(int) item_count(const MENU *);
0231 extern MENU_EXPORT(int) item_index(const ITEM *);
0232 extern MENU_EXPORT(int) item_opts_off(ITEM *, Item_Options);
0233 extern MENU_EXPORT(int) item_opts_on(ITEM *, Item_Options);
0234 extern MENU_EXPORT(int) menu_driver(MENU *, int);
0235 extern MENU_EXPORT(int) menu_opts_off(MENU *, Menu_Options);
0236 extern MENU_EXPORT(int) menu_opts_on(MENU *, Menu_Options);
0237 extern MENU_EXPORT(int) menu_pad(const MENU *);
0238 extern MENU_EXPORT(int) pos_menu_cursor(const MENU *);
0239 extern MENU_EXPORT(int) post_menu(MENU *);
0240 extern MENU_EXPORT(int) scale_menu(const MENU *, int *, int *);
0241 extern MENU_EXPORT(int) set_current_item(MENU *menu, ITEM *item);
0242 extern MENU_EXPORT(int) set_item_init(MENU *, Menu_Hook);
0243 extern MENU_EXPORT(int) set_item_opts(ITEM *, Item_Options);
0244 extern MENU_EXPORT(int) set_item_term(MENU *, Menu_Hook);
0245 extern MENU_EXPORT(int) set_item_userptr(ITEM *, void *);
0246 extern MENU_EXPORT(int) set_item_value(ITEM *, bool);
0247 extern MENU_EXPORT(int) set_menu_back(MENU *, chtype);
0248 extern MENU_EXPORT(int) set_menu_fore(MENU *, chtype);
0249 extern MENU_EXPORT(int) set_menu_format(MENU *, int, int);
0250 extern MENU_EXPORT(int) set_menu_grey(MENU *, chtype);
0251 extern MENU_EXPORT(int) set_menu_init(MENU *, Menu_Hook);
0252 extern MENU_EXPORT(int) set_menu_items(MENU *, ITEM **);
0253 extern MENU_EXPORT(int) set_menu_mark(MENU *, const char *);
0254 extern MENU_EXPORT(int) set_menu_opts(MENU *, Menu_Options);
0255 extern MENU_EXPORT(int) set_menu_pad(MENU *, int);
0256 extern MENU_EXPORT(int) set_menu_pattern(MENU *, const char *);
0257 extern MENU_EXPORT(int) set_menu_sub(MENU *, WINDOW *);
0258 extern MENU_EXPORT(int) set_menu_term(MENU *, Menu_Hook);
0259 extern MENU_EXPORT(int) set_menu_userptr(MENU *, void *);
0260 extern MENU_EXPORT(int) set_menu_win(MENU *, WINDOW *);
0261 extern MENU_EXPORT(int) set_top_row(MENU *, int);
0262 extern MENU_EXPORT(int) top_row(const MENU *);
0263 extern MENU_EXPORT(int) unpost_menu(MENU *);
0264 extern MENU_EXPORT(int) menu_request_by_name(const char *);
0265 extern MENU_EXPORT(int) set_menu_spacing(MENU *, int, int, int);
0266 extern MENU_EXPORT(int) menu_spacing(const MENU *, int *, int *, int *);
0267
0268 extern MENU_EXPORT(bool) item_value(const ITEM *);
0269 extern MENU_EXPORT(bool) item_visible(const ITEM *);
0270
0271 extern MENU_EXPORT(void) menu_format(const MENU *, int *, int *);
0272
0273 #if NCURSES_SP_FUNCS
0274 extern MENU_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN *, ITEM **);
0275 #endif
0276
0277 #ifdef __cplusplus
0278 }
0279 #endif
0280
0281 #endif