Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

frm_hook.c

Go to the documentation of this file.
00001 /****************************************************************************
00002  * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
00003  *                                                                          *
00004  * Permission is hereby granted, free of charge, to any person obtaining a  *
00005  * copy of this software and associated documentation files (the            *
00006  * "Software"), to deal in the Software without restriction, including      *
00007  * without limitation the rights to use, copy, modify, merge, publish,      *
00008  * distribute, distribute with modifications, sublicense, and/or sell       *
00009  * copies of the Software, and to permit persons to whom the Software is    *
00010  * furnished to do so, subject to the following conditions:                 *
00011  *                                                                          *
00012  * The above copyright notice and this permission notice shall be included  *
00013  * in all copies or substantial portions of the Software.                   *
00014  *                                                                          *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
00016  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
00017  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
00018  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
00019  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
00020  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
00021  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
00022  *                                                                          *
00023  * Except as contained in this notice, the name(s) of the above copyright   *
00024  * holders shall not be used in advertising or otherwise to promote the     *
00025  * sale, use or other dealings in this Software without prior written       *
00026  * authorization.                                                           *
00027  ****************************************************************************/
00028 
00029 /****************************************************************************
00030  *   Author:  Juergen Pfeifer, 1995,1997                                    *
00031  ****************************************************************************/
00032 
00033 #include "form.priv.h"
00034 
00035 MODULE_ID("$Id: frm_hook.c,v 1.14 2004/12/25 22:37:27 tom Exp $")
00036 
00037 /* "Template" macro to generate function to set application specific hook */
00038 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
00039 NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
00040 {\
00041    T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\
00042    (Normalize_Form( form ) -> typ ## name) = func ;\
00043    RETURN(E_OK);\
00044 }
00045 
00046 /* "Template" macro to generate function to get application specific hook */
00047 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
00048 NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
00049 {\
00050    T((T_CALLED(#typ "_" #name "(%p)"), form));\
00051    returnFormHook( Normalize_Form( form ) -> typ ## name );\
00052 }
00053 
00054 /*---------------------------------------------------------------------------
00055 |   Facility      :  libnform
00056 |   Function      :  int set_field_init(FORM *form, Form_Hook f)
00057 |
00058 |   Description   :  Assigns an application defined initialization function
00059 |                    to be called when the form is posted and just after
00060 |                    the current field changes.
00061 |
00062 |   Return Values :  E_OK      - success
00063 +--------------------------------------------------------------------------*/
00064 GEN_HOOK_SET_FUNCTION(field, init)
00065 
00066 /*---------------------------------------------------------------------------
00067 |   Facility      :  libnform
00068 |   Function      :  Form_Hook field_init(const FORM *form)
00069 |
00070 |   Description   :  Retrieve field initialization routine address.
00071 |
00072 |   Return Values :  The address or NULL if no hook defined.
00073 +--------------------------------------------------------------------------*/
00074 GEN_HOOK_GET_FUNCTION(field, init)
00075 
00076 /*---------------------------------------------------------------------------
00077 |   Facility      :  libnform
00078 |   Function      :  int set_field_term(FORM *form, Form_Hook f)
00079 |
00080 |   Description   :  Assigns an application defined finalization function
00081 |                    to be called when the form is unposted and just before
00082 |                    the current field changes.
00083 |
00084 |   Return Values :  E_OK      - success
00085 +--------------------------------------------------------------------------*/
00086 GEN_HOOK_SET_FUNCTION(field, term)
00087 
00088 /*---------------------------------------------------------------------------
00089 |   Facility      :  libnform
00090 |   Function      :  Form_Hook field_term(const FORM *form)
00091 |
00092 |   Description   :  Retrieve field finalization routine address.
00093 |
00094 |   Return Values :  The address or NULL if no hook defined.
00095 +--------------------------------------------------------------------------*/
00096 GEN_HOOK_GET_FUNCTION(field, term)
00097 
00098 /*---------------------------------------------------------------------------
00099 |   Facility      :  libnform
00100 |   Function      :  int set_form_init(FORM *form, Form_Hook f)
00101 |
00102 |   Description   :  Assigns an application defined initialization function
00103 |                    to be called when the form is posted and just after
00104 |                    a page change.
00105 |
00106 |   Return Values :  E_OK       - success
00107 +--------------------------------------------------------------------------*/
00108 GEN_HOOK_SET_FUNCTION(form, init)
00109 
00110 /*---------------------------------------------------------------------------
00111 |   Facility      :  libnform
00112 |   Function      :  Form_Hook form_init(const FORM *form)
00113 |
00114 |   Description   :  Retrieve form initialization routine address.
00115 |
00116 |   Return Values :  The address or NULL if no hook defined.
00117 +--------------------------------------------------------------------------*/
00118 GEN_HOOK_GET_FUNCTION(form, init)
00119 
00120 /*---------------------------------------------------------------------------
00121 |   Facility      :  libnform
00122 |   Function      :  int set_form_term(FORM *form, Form_Hook f)
00123 |
00124 |   Description   :  Assigns an application defined finalization function
00125 |                    to be called when the form is unposted and just before
00126 |                    a page change.
00127 |
00128 |   Return Values :  E_OK       - success
00129 +--------------------------------------------------------------------------*/
00130 GEN_HOOK_SET_FUNCTION(form, term)
00131 
00132 /*---------------------------------------------------------------------------
00133 |   Facility      :  libnform
00134 |   Function      :  Form_Hook form_term(const FORM *form)
00135 |
00136 |   Description   :  Retrieve form finalization routine address.
00137 |
00138 |   Return Values :  The address or NULL if no hook defined.
00139 +--------------------------------------------------------------------------*/
00140 GEN_HOOK_GET_FUNCTION(form, term)
00141 
00142 /* frm_hook.c ends here */

© sourcejam.com 2005-2008