Forms 3.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* Copyright 1997 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/***************************************************/
/* File   : Forms.h                                */
17
/*                                                 */
18
/* Purpose: Functions to manage HTML forms.        */
19
/*                                                 */
20 21
/* Author : Merlyn Kline for Customer browser     */
/*          This source adapted by A.D.Hodgkinson  */
22 23
/*                                                 */
/* History: 28-Jan-97: Created.                    */
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
/***************************************************/

/* Various definitions */

typedef enum form_fieldtype
{
  form_text,
  form_password,
  form_checkbox,
  form_radio,
  form_select,
  form_textarea,
  form_image,
  form_submit,
  form_reset,
39 40
  form_button,
  form_file,
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
  form_hidden

} form_fieldtype;

typedef struct fv_select
{
  int  scroll;
  char selection[4];

} fv_select;

typedef union
{
  char      text[4];
  int       checked;
  fv_select select;

} form_field_value;

60 61 62 63
/* Miscellaneous definitions */

#define FE_PassCode "****************************************"

64 65 66 67 68 69 70 71 72 73 74 75 76 77
/* Function prototypes */

_kernel_oserror  * form_new_form              (browser_data * b, HStream * token);
_kernel_oserror  * form_discard               (browser_data * b);
_kernel_oserror  * form_put_field             (browser_data * b, HStream * token, char * value, int update);
_kernel_oserror  * form_new_field             (browser_data * b, HStream * token, form_fieldtype type, char * value);

form_field_value * form_get_field             (browser_data * b, HStream * token);
char             * form_get_field_text        (browser_data * b, HStream * token);
void               form_get_linesize          (BBox * fontbox, int * lh, int * lb);
void               form_abandon_menu          (void);

int                form_give_focus            (browser_data * b);

Kevin Bracey's avatar
Kevin Bracey committed
78
_kernel_oserror  * form_click_field           (browser_data * b, HStream * token, int mode, int x, int y);
79 80
_kernel_oserror  * form_cancel_edit           (browser_data * b);
_kernel_oserror  * form_finish_edit           (browser_data * b);
Kevin Bracey's avatar
Kevin Bracey committed
81
const char       * form_button_text           (HStream * tp);
82 83 84 85
int                form_token_cursor_editable (browser_data * b, HStream * token);
_kernel_oserror  * form_process_key           (browser_data * b, int * key);
void               form_select_menu_event     (WimpPollBlock * e);
void               form_check_caret           (browser_data * b);
86
void               form_caret_may_need_moving (browser_data * b);
87 88

void               form_textarea_redraw       (browser_data * b, HStream * token, BBox * box, BBox * gw, int fh, int multiline, int password);