Update copyright year to 2015.
[cboard.git] / src / input.h
blobf768b609b01c328c76d864b4d92b260ab2ba7386
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2002-2015 Ben Kibbey <bjk@luxsci.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef INPUT_H
20 #define INPUT_H
22 #define INPUT_WIDTH ((COLS / 4) * 3)
24 enum {
25 INPUT_HIST_ENGINE,
26 INPUT_HIST_CLOCK,
27 INPUT_HIST_FILE,
28 INPUT_HIST_MOVE_EXP,
29 INPUT_HIST_GAME_EXP,
30 #ifdef WITH_LIBPERL
31 INPUT_HIST_PERL,
32 #endif
33 INPUT_HIST_MAX
36 enum {
37 FIELD_TYPE_ALNUM, FIELD_TYPE_ALPHA, FIELD_TYPE_INTEGER,
38 FIELD_TYPE_NUMERIC, FIELD_TYPE_REGEXP, FIELD_TYPE_IPV4, FIELD_TYPE_ENUM,
39 FIELD_TYPE_PGN_TAG_NAME, FIELD_TYPE_PGN_DATE, FIELD_TYPE_PGN_ROUND,
40 FIELD_TYPE_PGN_RESULT
43 typedef void (input_func)(void *);
44 struct input_s {
45 char buf[MAX_PGN_LINE_LEN];
46 WINDOW *sw;
47 FIELD *fields[2];
48 FORM *f;
49 FIELDTYPE *ft;
50 int w;
51 int h;
52 int lines;
53 char *init;
54 char **extra;
55 input_func *func;
56 char *arg;
57 wint_t c;
58 void *data;
59 int reset;
60 int hist;
63 struct input_data_s {
64 void *data;
65 void *moredata;
66 char *str;
67 window_exit_func *efunc;
70 WIN *construct_input(const char *title, const char *init, int lines, int reset,
71 const char *extra_help, input_func *func, void *arg, wint_t key,
72 struct input_data_s *id, int history, int type, ...);
74 #endif