frm_hook.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /****************************************************************************
  2. * Copyright (c) 1998 Free Software Foundation, Inc. *
  3. * *
  4. * Permission is hereby granted, free of charge, to any person obtaining a *
  5. * copy of this software and associated documentation files (the *
  6. * "Software"), to deal in the Software without restriction, including *
  7. * without limitation the rights to use, copy, modify, merge, publish, *
  8. * distribute, distribute with modifications, sublicense, and/or sell *
  9. * copies of the Software, and to permit persons to whom the Software is *
  10. * furnished to do so, subject to the following conditions: *
  11. * *
  12. * The above copyright notice and this permission notice shall be included *
  13. * in all copies or substantial portions of the Software. *
  14. * *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  16. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  18. * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  19. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  20. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  21. * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  22. * *
  23. * Except as contained in this notice, the name(s) of the above copyright *
  24. * holders shall not be used in advertising or otherwise to promote the *
  25. * sale, use or other dealings in this Software without prior written *
  26. * authorization. *
  27. ****************************************************************************/
  28. /****************************************************************************
  29. * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
  30. ****************************************************************************/
  31. #include "form.priv.h"
  32. MODULE_ID("$Id$")
  33. /* "Template" macro to generate function to set application specific hook */
  34. #define GEN_HOOK_SET_FUNCTION( typ, name ) \
  35. int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
  36. {\
  37. (Normalize_Form( form ) -> typ ## name) = func ;\
  38. RETURN(E_OK);\
  39. }
  40. /* "Template" macro to generate function to get application specific hook */
  41. #define GEN_HOOK_GET_FUNCTION( typ, name ) \
  42. Form_Hook typ ## _ ## name ( const FORM *form )\
  43. {\
  44. return ( Normalize_Form( form ) -> typ ## name );\
  45. }
  46. /*---------------------------------------------------------------------------
  47. | Facility : libnform
  48. | Function : int set_field_init(FORM *form, Form_Hook f)
  49. |
  50. | Description : Assigns an application defined initialization function
  51. | to be called when the form is posted and just after
  52. | the current field changes.
  53. |
  54. | Return Values : E_OK - success
  55. +--------------------------------------------------------------------------*/
  56. GEN_HOOK_SET_FUNCTION(field,init)
  57. /*---------------------------------------------------------------------------
  58. | Facility : libnform
  59. | Function : Form_Hook field_init(const FORM *form)
  60. |
  61. | Description : Retrieve field initialization routine address.
  62. |
  63. | Return Values : The address or NULL if no hook defined.
  64. +--------------------------------------------------------------------------*/
  65. GEN_HOOK_GET_FUNCTION(field,init)
  66. /*---------------------------------------------------------------------------
  67. | Facility : libnform
  68. | Function : int set_field_term(FORM *form, Form_Hook f)
  69. |
  70. | Description : Assigns an application defined finalization function
  71. | to be called when the form is unposted and just before
  72. | the current field changes.
  73. |
  74. | Return Values : E_OK - success
  75. +--------------------------------------------------------------------------*/
  76. GEN_HOOK_SET_FUNCTION(field,term)
  77. /*---------------------------------------------------------------------------
  78. | Facility : libnform
  79. | Function : Form_Hook field_term(const FORM *form)
  80. |
  81. | Description : Retrieve field finalization routine address.
  82. |
  83. | Return Values : The address or NULL if no hook defined.
  84. +--------------------------------------------------------------------------*/
  85. GEN_HOOK_GET_FUNCTION(field,term)
  86. /*---------------------------------------------------------------------------
  87. | Facility : libnform
  88. | Function : int set_form_init(FORM *form, Form_Hook f)
  89. |
  90. | Description : Assigns an application defined initialization function
  91. | to be called when the form is posted and just after
  92. | a page change.
  93. |
  94. | Return Values : E_OK - success
  95. +--------------------------------------------------------------------------*/
  96. GEN_HOOK_SET_FUNCTION(form,init)
  97. /*---------------------------------------------------------------------------
  98. | Facility : libnform
  99. | Function : Form_Hook form_init(const FORM *form)
  100. |
  101. | Description : Retrieve form initialization routine address.
  102. |
  103. | Return Values : The address or NULL if no hook defined.
  104. +--------------------------------------------------------------------------*/
  105. GEN_HOOK_GET_FUNCTION(form,init)
  106. /*---------------------------------------------------------------------------
  107. | Facility : libnform
  108. | Function : int set_form_term(FORM *form, Form_Hook f)
  109. |
  110. | Description : Assigns an application defined finalization function
  111. | to be called when the form is unposted and just before
  112. | a page change.
  113. |
  114. | Return Values : E_OK - success
  115. +--------------------------------------------------------------------------*/
  116. GEN_HOOK_SET_FUNCTION(form,term)
  117. /*---------------------------------------------------------------------------
  118. | Facility : libnform
  119. | Function : Form_Hook form_term(const FORM *form)
  120. |
  121. | Description : Retrieve form finalization routine address.
  122. |
  123. | Return Values : The address or NULL if no hook defined.
  124. +--------------------------------------------------------------------------*/
  125. GEN_HOOK_GET_FUNCTION(form,term)
  126. /* frm_hook.c ends here */