home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / stubfe / stubform.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.8 KB  |  200 lines

  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* 
  20.    stubform.c --- stub functions dealing with front-end
  21.                   handling of form elements.
  22. */
  23.  
  24. #include "stubform.h"
  25.  
  26. /*
  27. ** FE_GetFormElementInfo - create the FE representation of a form
  28. ** element.
  29. **
  30. ** Note : This method can be called more than once for the same front
  31. ** end form element.
  32. ** 
  33. ** In those cases we don't reallocate the FEData*, and also don't
  34. ** recreate the widget, but we do set the form and context pointers in
  35. ** FEData, and we call the get_size method.
  36. **
  37. ** Two cases I know of where layout calls this function more than once
  38. ** are: 1) when laying out a table with form elements in it -- layout
  39. ** moves our fe data over to a new LO_FormElementStruct.  So, you
  40. ** should always sync up pointers to the LO_FormElementStruct
  41. ** contained in your fe data.  2) when we're on a page with frames in
  42. ** it and the user goes back and forth.  In this case, the context is
  43. ** different, so you always need to sync that up as well.
  44. **
  45. ** Also, layout could have told us to hide the widget without freeing
  46. ** our fe_data* (this happens when hide is TRUE in
  47. ** FE_GetFormElementValue.)  In this case, we need to do anything
  48. ** necessary to show the widget again.
  49. **
  50. ** Also, this routine is responsible for setting the initial value of
  51. ** the form element.
  52. **
  53. ** yuck.  :)
  54. */
  55. void 
  56. STUBFE_GetFormElementInfo (MWContext * context,
  57.                LO_FormElementStruct * form_element)
  58. {
  59. }
  60.  
  61.  
  62. /*
  63. ** FE_GetFormElementValue - copy the value inside the fe
  64. ** representation into the FormElementStruct.
  65. ** 
  66. ** if hide is TRUE, hide the form element after doing the copy.  In
  67. ** the XFE, hide is taken to mean "delete" - so, if hide is TRUE, the
  68. ** XFE deletes the form element widget.  This is not strictly
  69. ** necessary, as you are guaranteed to have FE_FreeFormElement if the
  70. ** form element is *really* going away.
  71. **
  72. ** But, given that this is called with hide == TRUE in the face of
  73. ** going back and forth in frame documents, it's probably safer to
  74. ** always delete the widget when hide == TRUE, as the widget's parent
  75. ** is destroyed and recreated.
  76. */
  77. void 
  78. STUBFE_GetFormElementValue (MWContext * context,
  79.                 LO_FormElementStruct * form_element,
  80.                 XP_Bool hide)
  81. {
  82. }
  83.  
  84. /*
  85. ** FE_ResetFormElement - reset the value of the form element to the default
  86. ** value stored in the LO_FormElementStruct.
  87. */
  88. void 
  89. STUBFE_ResetFormElement (MWContext * context,
  90.              LO_FormElementStruct * form_element)
  91. {
  92. }
  93.  
  94. /* 
  95. ** FE_SetFormElementToggle - set the toggle or radio button's state to
  96. ** the toggle parameter.
  97. **
  98. ** only called on CHECKBOX and RADIO form elements.
  99. */
  100. void 
  101. STUBFE_SetFormElementToggle (MWContext * context,
  102.                  LO_FormElementStruct * form_element,
  103.                  XP_Bool toggle)
  104. {
  105. }
  106.  
  107. /*
  108. ** FE_FreeFormElement - free up all memory associated with the front
  109. ** end representation for this form element.
  110. */
  111. void
  112. FE_FreeFormElement(MWContext *context,
  113.            LO_FormElementData *form)
  114. {
  115. }
  116.  
  117. /*
  118. ** FE_BlurInputElement - force input to be defocused from the given
  119. ** element.  It's ok if the element didn't have the input focus.
  120. */
  121. void
  122. FE_BlurInputElement(MWContext *context,
  123.             LO_Element *element)
  124. {
  125. }
  126.  
  127. /*
  128. ** FE_FocusInputElement - force input to be focused on the given element.
  129. ** It's ok if the element already has the input focus.
  130. */
  131. void
  132. FE_FocusInputElement(MWContext *context,
  133.              LO_Element *element)
  134. {
  135. }
  136.  
  137. /*
  138. ** FE_SelectInputElement - select the contents of a form element.
  139. **
  140. ** Only called on TEXT, TEXTAREA, PASSWORD, and FILE form elements (anything
  141. ** with text in it.)
  142. **
  143. ** This function should select the entire text contained in the FE widget.
  144. */
  145. void
  146. FE_SelectInputElement(MWContext *context,
  147.               LO_Element *element)
  148. {
  149. }
  150.  
  151. /*
  152. ** FE_ClickInputElement - Simulate a click on a form element.
  153. **
  154. ** Note: This function also handles clicks on HREF anchored LO_IMAGE
  155. ** and LO_TEXT LO_Elements.  In these cases, this function should
  156. ** simulate a user clicking on the LO_Element in question.
  157. */
  158. void
  159. FE_ClickInputElement(MWContext *context,
  160.              LO_Element *element)
  161. {
  162. }
  163.  
  164. /*
  165. ** FE_ChangeInputElement - handle change in form element value(s)
  166. **
  167. ** This function should update the front end value for a given form
  168. ** element, including (in the case of TEXT-like elements) just the
  169. ** value, or (in the case of SELECT elements) both the list of
  170. ** allowable values as well as the selected value.
  171. */
  172. void
  173. FE_ChangeInputElement(MWContext *context,
  174.               LO_Element *element)
  175. {
  176. }
  177.  
  178. /*
  179. ** FE_SubmitInputElement -
  180. **
  181. ** Tell the FE that a form is being submitted without a UI gesture indicating
  182. ** that fact, i.e., in a Mocha-automated fashion ("document.myform.submit()").
  183. ** The FE is responsible for emulating whatever happens when the user hits the
  184. ** submit button, or auto-submits by typing Enter in a single-field form.
  185. */
  186. void
  187. FE_SubmitInputElement(MWContext *context,
  188.               LO_Element *element)
  189. {
  190. }
  191.  
  192. int
  193. FE_ClickAnyElement(MWContext *context,
  194.            LO_Element *element,
  195.            int haveXY,
  196.            int32 xx,
  197.            int32 yy)
  198. {
  199. }
  200.