frm_hook.c revision 166124
150276Speter/**************************************************************************** 2166124Srafan * Copyright (c) 1998-2003,2004 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/**************************************************************************** 30166124Srafan * Author: Juergen Pfeifer, 1995,1997 * 3150276Speter ****************************************************************************/ 3250276Speter 3350276Speter#include "form.priv.h" 3450276Speter 35166124SrafanMODULE_ID("$Id: frm_hook.c,v 1.14 2004/12/25 22:37:27 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{\ 41166124Srafan T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\ 4250276Speter (Normalize_Form( form ) -> typ ## name) = func ;\ 4350276Speter RETURN(E_OK);\ 4450276Speter} 4550276Speter 4650276Speter/* "Template" macro to generate function to get application specific hook */ 4750276Speter#define GEN_HOOK_GET_FUNCTION( typ, name ) \ 4876726SpeterNCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\ 4950276Speter{\ 50166124Srafan T((T_CALLED(#typ "_" #name "(%p)"), form));\ 51166124Srafan returnFormHook( Normalize_Form( form ) -> typ ## name );\ 5250276Speter} 53166124Srafan 5450276Speter/*--------------------------------------------------------------------------- 55166124Srafan| Facility : libnform 5650276Speter| Function : int set_field_init(FORM *form, Form_Hook f) 57166124Srafan| 5850276Speter| Description : Assigns an application defined initialization function 5950276Speter| to be called when the form is posted and just after 6050276Speter| the current field changes. 6150276Speter| 6250276Speter| Return Values : E_OK - success 6350276Speter+--------------------------------------------------------------------------*/ 64166124SrafanGEN_HOOK_SET_FUNCTION(field, init) 6550276Speter 6650276Speter/*--------------------------------------------------------------------------- 67166124Srafan| Facility : libnform 6850276Speter| Function : Form_Hook field_init(const FORM *form) 69166124Srafan| 7050276Speter| Description : Retrieve field initialization routine address. 7150276Speter| 7250276Speter| Return Values : The address or NULL if no hook defined. 7350276Speter+--------------------------------------------------------------------------*/ 74166124SrafanGEN_HOOK_GET_FUNCTION(field, init) 7550276Speter 7650276Speter/*--------------------------------------------------------------------------- 77166124Srafan| Facility : libnform 7850276Speter| Function : int set_field_term(FORM *form, Form_Hook f) 79166124Srafan| 8050276Speter| Description : Assigns an application defined finalization function 8150276Speter| to be called when the form is unposted and just before 8250276Speter| the current field changes. 8350276Speter| 8450276Speter| Return Values : E_OK - success 8550276Speter+--------------------------------------------------------------------------*/ 86166124SrafanGEN_HOOK_SET_FUNCTION(field, term) 8750276Speter 8850276Speter/*--------------------------------------------------------------------------- 89166124Srafan| Facility : libnform 9050276Speter| Function : Form_Hook field_term(const FORM *form) 91166124Srafan| 9250276Speter| Description : Retrieve field finalization routine address. 9350276Speter| 9450276Speter| Return Values : The address or NULL if no hook defined. 9550276Speter+--------------------------------------------------------------------------*/ 96166124SrafanGEN_HOOK_GET_FUNCTION(field, term) 9750276Speter 9850276Speter/*--------------------------------------------------------------------------- 99166124Srafan| Facility : libnform 10050276Speter| Function : int set_form_init(FORM *form, Form_Hook f) 101166124Srafan| 10250276Speter| Description : Assigns an application defined initialization function 10350276Speter| to be called when the form is posted and just after 10450276Speter| a page change. 10550276Speter| 10650276Speter| Return Values : E_OK - success 10750276Speter+--------------------------------------------------------------------------*/ 108166124SrafanGEN_HOOK_SET_FUNCTION(form, init) 10950276Speter 11050276Speter/*--------------------------------------------------------------------------- 111166124Srafan| Facility : libnform 11250276Speter| Function : Form_Hook form_init(const FORM *form) 113166124Srafan| 11450276Speter| Description : Retrieve form initialization routine address. 11550276Speter| 11650276Speter| Return Values : The address or NULL if no hook defined. 11750276Speter+--------------------------------------------------------------------------*/ 118166124SrafanGEN_HOOK_GET_FUNCTION(form, init) 11950276Speter 12050276Speter/*--------------------------------------------------------------------------- 121166124Srafan| Facility : libnform 12250276Speter| Function : int set_form_term(FORM *form, Form_Hook f) 123166124Srafan| 12450276Speter| Description : Assigns an application defined finalization function 12550276Speter| to be called when the form is unposted and just before 12650276Speter| a page change. 12750276Speter| 12850276Speter| Return Values : E_OK - success 12950276Speter+--------------------------------------------------------------------------*/ 130166124SrafanGEN_HOOK_SET_FUNCTION(form, term) 13150276Speter 13250276Speter/*--------------------------------------------------------------------------- 133166124Srafan| Facility : libnform 13450276Speter| Function : Form_Hook form_term(const FORM *form) 135166124Srafan| 13650276Speter| Description : Retrieve form finalization routine address. 13750276Speter| 13850276Speter| Return Values : The address or NULL if no hook defined. 13950276Speter+--------------------------------------------------------------------------*/ 140166124SrafanGEN_HOOK_GET_FUNCTION(form, term) 14150276Speter 14250276Speter/* frm_hook.c ends here */ 143