frm_hook.c revision 76726
150276Speter/****************************************************************************
276726Speter * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
350276Speter *                                                                          *
450276Speter * Permission is hereby granted, free of charge, to any person obtaining a  *
550276Speter * copy of this software and associated documentation files (the            *
650276Speter * "Software"), to deal in the Software without restriction, including      *
750276Speter * without limitation the rights to use, copy, modify, merge, publish,      *
850276Speter * distribute, distribute with modifications, sublicense, and/or sell       *
950276Speter * copies of the Software, and to permit persons to whom the Software is    *
1050276Speter * furnished to do so, subject to the following conditions:                 *
1150276Speter *                                                                          *
1250276Speter * The above copyright notice and this permission notice shall be included  *
1350276Speter * in all copies or substantial portions of the Software.                   *
1450276Speter *                                                                          *
1550276Speter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1650276Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1750276Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
1850276Speter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
1950276Speter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2050276Speter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2150276Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2250276Speter *                                                                          *
2350276Speter * Except as contained in this notice, the name(s) of the above copyright   *
2450276Speter * holders shall not be used in advertising or otherwise to promote the     *
2550276Speter * sale, use or other dealings in this Software without prior written       *
2650276Speter * authorization.                                                           *
2750276Speter ****************************************************************************/
2850276Speter
2950276Speter/****************************************************************************
3050276Speter *   Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997            *
3150276Speter ****************************************************************************/
3250276Speter
3350276Speter#include "form.priv.h"
3450276Speter
3576726SpeterMODULE_ID("$Id: frm_hook.c,v 1.9 2000/12/10 02:09:37 tom Exp $")
3650276Speter
3750276Speter/* "Template" macro to generate function to set application specific hook */
3850276Speter#define GEN_HOOK_SET_FUNCTION( typ, name ) \
3976726SpeterNCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
4050276Speter{\
4150276Speter   (Normalize_Form( form ) -> typ ## name) = func ;\
4250276Speter   RETURN(E_OK);\
4350276Speter}
4450276Speter
4550276Speter/* "Template" macro to generate function to get application specific hook */
4650276Speter#define GEN_HOOK_GET_FUNCTION( typ, name ) \
4776726SpeterNCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
4850276Speter{\
4950276Speter   return ( Normalize_Form( form ) -> typ ## name );\
5050276Speter}
5150276Speter
5250276Speter/*---------------------------------------------------------------------------
5350276Speter|   Facility      :  libnform
5450276Speter|   Function      :  int set_field_init(FORM *form, Form_Hook f)
5550276Speter|
5650276Speter|   Description   :  Assigns an application defined initialization function
5750276Speter|                    to be called when the form is posted and just after
5850276Speter|                    the current field changes.
5950276Speter|
6050276Speter|   Return Values :  E_OK      - success
6150276Speter+--------------------------------------------------------------------------*/
6250276SpeterGEN_HOOK_SET_FUNCTION(field,init)
6350276Speter
6450276Speter/*---------------------------------------------------------------------------
6550276Speter|   Facility      :  libnform
6650276Speter|   Function      :  Form_Hook field_init(const FORM *form)
6750276Speter|
6850276Speter|   Description   :  Retrieve field initialization routine address.
6950276Speter|
7050276Speter|   Return Values :  The address or NULL if no hook defined.
7150276Speter+--------------------------------------------------------------------------*/
7250276SpeterGEN_HOOK_GET_FUNCTION(field,init)
7350276Speter
7450276Speter/*---------------------------------------------------------------------------
7550276Speter|   Facility      :  libnform
7650276Speter|   Function      :  int set_field_term(FORM *form, Form_Hook f)
7750276Speter|
7850276Speter|   Description   :  Assigns an application defined finalization function
7950276Speter|                    to be called when the form is unposted and just before
8050276Speter|                    the current field changes.
8150276Speter|
8250276Speter|   Return Values :  E_OK      - success
8350276Speter+--------------------------------------------------------------------------*/
8450276SpeterGEN_HOOK_SET_FUNCTION(field,term)
8550276Speter
8650276Speter/*---------------------------------------------------------------------------
8750276Speter|   Facility      :  libnform
8850276Speter|   Function      :  Form_Hook field_term(const FORM *form)
8950276Speter|
9050276Speter|   Description   :  Retrieve field finalization routine address.
9150276Speter|
9250276Speter|   Return Values :  The address or NULL if no hook defined.
9350276Speter+--------------------------------------------------------------------------*/
9450276SpeterGEN_HOOK_GET_FUNCTION(field,term)
9550276Speter
9650276Speter/*---------------------------------------------------------------------------
9750276Speter|   Facility      :  libnform
9850276Speter|   Function      :  int set_form_init(FORM *form, Form_Hook f)
9950276Speter|
10050276Speter|   Description   :  Assigns an application defined initialization function
10150276Speter|                    to be called when the form is posted and just after
10250276Speter|                    a page change.
10350276Speter|
10450276Speter|   Return Values :  E_OK       - success
10550276Speter+--------------------------------------------------------------------------*/
10650276SpeterGEN_HOOK_SET_FUNCTION(form,init)
10750276Speter
10850276Speter/*---------------------------------------------------------------------------
10950276Speter|   Facility      :  libnform
11050276Speter|   Function      :  Form_Hook form_init(const FORM *form)
11150276Speter|
11250276Speter|   Description   :  Retrieve form initialization routine address.
11350276Speter|
11450276Speter|   Return Values :  The address or NULL if no hook defined.
11550276Speter+--------------------------------------------------------------------------*/
11650276SpeterGEN_HOOK_GET_FUNCTION(form,init)
11750276Speter
11850276Speter/*---------------------------------------------------------------------------
11950276Speter|   Facility      :  libnform
12050276Speter|   Function      :  int set_form_term(FORM *form, Form_Hook f)
12150276Speter|
12250276Speter|   Description   :  Assigns an application defined finalization function
12350276Speter|                    to be called when the form is unposted and just before
12450276Speter|                    a page change.
12550276Speter|
12650276Speter|   Return Values :  E_OK       - success
12750276Speter+--------------------------------------------------------------------------*/
12850276SpeterGEN_HOOK_SET_FUNCTION(form,term)
12950276Speter
13050276Speter/*---------------------------------------------------------------------------
13150276Speter|   Facility      :  libnform
13250276Speter|   Function      :  Form_Hook form_term(const FORM *form)
13350276Speter|
13450276Speter|   Description   :  Retrieve form finalization routine address.
13550276Speter|
13650276Speter|   Return Values :  The address or NULL if no hook defined.
13750276Speter+--------------------------------------------------------------------------*/
13850276SpeterGEN_HOOK_GET_FUNCTION(form,term)
13950276Speter
14050276Speter/* frm_hook.c ends here */
141