1 /*-----------------------------------------------------------------------------+
2 | The ncurses menu library is Copyright (C) 1995-1997 |
3 | by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> |
4 | All Rights Reserved. |
6 | Permission to use, copy, modify, and distribute this software and its |
7 | documentation for any purpose and without fee is hereby granted, provided |
8 | that the above copyright notice appear in all copies and that both that |
9 | copyright notice and this permission notice appear in supporting |
10 | documentation, and that the name of the above listed copyright holder(s) not |
11 | be used in advertising or publicity pertaining to distribution of the |
12 | software without specific, written prior permission. |
14 | THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO |
15 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- |
16 | NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR |
17 | ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- |
18 | SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
19 | NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH |
20 | THE USE OR PERFORMANCE OF THIS SOFTWARE. |
21 +-----------------------------------------------------------------------------*/
23 /***************************************************************************
25 * Assign application specific routines for automatic invocation by menus *
26 ***************************************************************************/
28 #include "menu.priv.h"
30 MODULE_ID("$Id: m_hook.c,v 1.4 1997/05/01 16:47:26 juergen Exp $")
32 /* "Template" macro to generate function to set application specific hook */
33 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
34 int set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\
36 (Normalize_Menu(menu) -> typ ## name = func );\
40 /* "Template" macro to generate function to get application specific hook */
41 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
42 Menu_Hook typ ## _ ## name ( const MENU *menu )\
44 return (Normalize_Menu(menu) -> typ ## name);\
47 /*---------------------------------------------------------------------------
49 | Function : int set_menu_init(MENU *menu, void (*f)(MENU *))
51 | Description : Set user-exit which is called when menu is posted
52 | or just after the top row changes.
54 | Return Values : E_OK - success
55 +--------------------------------------------------------------------------*/
56 GEN_HOOK_SET_FUNCTION( menu, init )
58 /*---------------------------------------------------------------------------
60 | Function : void (*)(MENU *) menu_init(const MENU *menu)
62 | Description : Return address of user-exit function which is called
63 | when a menu is posted or just after the top row
66 | Return Values : Menu init function address or NULL
67 +--------------------------------------------------------------------------*/
68 GEN_HOOK_GET_FUNCTION( menu, init )
70 /*---------------------------------------------------------------------------
72 | Function : int set_menu_term (MENU *menu, void (*f)(MENU *))
74 | Description : Set user-exit which is called when menu is unposted
75 | or just before the top row changes.
77 | Return Values : E_OK - success
78 +--------------------------------------------------------------------------*/
79 GEN_HOOK_SET_FUNCTION( menu, term )
81 /*---------------------------------------------------------------------------
83 | Function : void (*)(MENU *) menu_term(const MENU *menu)
85 | Description : Return address of user-exit function which is called
86 | when a menu is unposted or just before the top row
89 | Return Values : Menu finalization function address or NULL
90 +--------------------------------------------------------------------------*/
91 GEN_HOOK_GET_FUNCTION( menu, term )
93 /*---------------------------------------------------------------------------
95 | Function : int set_item_init (MENU *menu, void (*f)(MENU *))
97 | Description : Set user-exit which is called when menu is posted
98 | or just after the current item changes.
100 | Return Values : E_OK - success
101 +--------------------------------------------------------------------------*/
102 GEN_HOOK_SET_FUNCTION( item, init )
104 /*---------------------------------------------------------------------------
105 | Facility : libnmenu
106 | Function : void (*)(MENU *) item_init (const MENU *menu)
108 | Description : Return address of user-exit function which is called
109 | when a menu is posted or just after the current item
112 | Return Values : Item init function address or NULL
113 +--------------------------------------------------------------------------*/
114 GEN_HOOK_GET_FUNCTION( item, init )
116 /*---------------------------------------------------------------------------
117 | Facility : libnmenu
118 | Function : int set_item_term (MENU *menu, void (*f)(MENU *))
120 | Description : Set user-exit which is called when menu is unposted
121 | or just before the current item changes.
123 | Return Values : E_OK - success
124 +--------------------------------------------------------------------------*/
125 GEN_HOOK_SET_FUNCTION( item, term )
127 /*---------------------------------------------------------------------------
128 | Facility : libnmenu
129 | Function : void (*)(MENU *) item_init (const MENU *menu)
131 | Description : Return address of user-exit function which is called
132 | when a menu is unposted or just before the current item
135 | Return Values : Item finalization function address or NULL
136 +--------------------------------------------------------------------------*/
137 GEN_HOOK_GET_FUNCTION( item, term )
139 /* m_hook.c ends here */