X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=menu%2Fmenu.h;h=b2e845c6fa45f81e45c365742e436f6263f2fb1c;hp=d827072248f9ad75a5249d2654a2b160a7aecd37;hb=460005b642d978c6d4b48810803514bd36a6245b;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/menu/menu.h b/menu/menu.h index d8270722..b2e845c6 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -28,9 +29,10 @@ /**************************************************************************** * Author: Juergen Pfeifer, 1995,1997 * - * Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en * ****************************************************************************/ +/* $Id: menu.h,v 1.24 2020/02/02 23:34:34 tom Exp $ */ + #ifndef ETI_MENU #define ETI_MENU @@ -55,17 +57,23 @@ typedef int Item_Options; #define O_IGNORECASE (0x08) #define O_SHOWMATCH (0x10) #define O_NONCYCLIC (0x20) +#define O_MOUSE_MENU (0x40) /* Item options: */ #define O_SELECTABLE (0x01) +#if !NCURSES_OPAQUE_MENU typedef struct { const char* str; unsigned short length; } TEXT; +#endif /* !NCURSES_OPAQUE_MENU */ + +struct tagMENU; typedef struct tagITEM +#if !NCURSES_OPAQUE_MENU { TEXT name; /* name of menu item */ TEXT description; /* description of item, optional in display */ @@ -77,16 +85,19 @@ typedef struct tagITEM short x; bool value; /* Selection value */ - struct tagITEM *left; /* neighbour items */ + struct tagITEM *left; /* neighbor items */ struct tagITEM *right; struct tagITEM *up; struct tagITEM *down; -} ITEM; +} +#endif /* !NCURSES_OPAQUE_MENU */ +ITEM; typedef void (*Menu_Hook)(struct tagMENU *); typedef struct tagMENU +#if 1 /* not yet: !NCURSES_OPAQUE_MENU */ { short height; /* Nr. of chars high */ short width; /* Nr. of chars wide */ @@ -127,8 +138,9 @@ typedef struct tagMENU Menu_Options opt; /* Menu options */ unsigned short status; /* Internal state of menu */ - -} MENU; +} +#endif /* !NCURSES_OPAQUE_MENU */ +MENU; /* Define keys */ @@ -216,23 +228,23 @@ extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); extern NCURSES_EXPORT(int) post_menu (MENU *); extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); -extern NCURSES_EXPORT(int) set_item_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); -extern NCURSES_EXPORT(int) set_item_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); -extern NCURSES_EXPORT(int) set_menu_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); -extern NCURSES_EXPORT(int) set_menu_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook); extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); extern NCURSES_EXPORT(int) set_top_row (MENU *,int); @@ -248,6 +260,10 @@ extern NCURSES_EXPORT(bool) item_visible (const ITEM *); extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); +#endif + #ifdef __cplusplus } #endif