7f8bb70cff
input forms. It has the following simple fields: Text fields: Just titles, labels etc. Input fields: An editable text field that may or may not have an initial default value. Labelled input field: This is an input field that has an initial informative entry in it but it vanishes when you start editing the field. Toggle fields: These are fields with a pre-defined list of options which you cycle through using the space bar. Action fields: These are button type fields that call functions when they are selected. A simple demo is included in examples.
40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
/*
|
|
* Copyright (c) 1995 Paul Richards.
|
|
*
|
|
* All rights reserved.
|
|
*
|
|
* This software may be used, modified, copied, distributed, and
|
|
* sold, in both source and binary form provided that the above
|
|
* copyright and these terms are retained, verbatim, as the first
|
|
* lines of this file. Under no circumstances is the author
|
|
* responsible for the proper functioning of this software, nor does
|
|
* the author assume any responsibility for damages incurred with
|
|
* its use.
|
|
*/
|
|
|
|
#define F_UP keymap[0]
|
|
#define F_DOWN keymap[1]
|
|
#define F_RIGHT keymap[2]
|
|
#define F_LEFT keymap[3]
|
|
#define F_NEXT keymap[4]
|
|
#define F_CLEFT keymap[5]
|
|
#define F_CRIGHT keymap[6]
|
|
#define F_CHOME keymap[7]
|
|
#define F_CEND keymap[8]
|
|
#define F_CBS keymap[9]
|
|
#define F_CDEL keymap[10]
|
|
#define F_ACCEPT F_NEXT
|
|
|
|
/* Private function declarations */
|
|
static void show_form(struct form *);
|
|
static void disp_text(struct form *, int);
|
|
static void disp_menu(struct form *, int);
|
|
static void disp_action(struct form *, int);
|
|
static void disp_input(struct form *, int);
|
|
static void field_menu(struct form *);
|
|
static void field_input(struct form *);
|
|
static void field_action(struct form *);
|
|
static int print_string(WINDOW *, int, int, int, char *);
|
|
static void print_status(char *);
|
|
static int next_field(struct form *form, int);
|