2 * \file input_validators.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
13 #include "lyx_forms.h"
14 #include "support/lstrings.h"
15 #include "input_validators.h"
17 using namespace lyx::support;
19 #if defined(__cplusplus)
24 int fl_int_filter(FL_OBJECT * ob,
25 char const *, char const *, int c)
27 if (c == 0 /* final test before handing contents to app */
28 || strchr("0123456789+-", c)) {
29 if (isStrInt(fl_get_input(ob)))
32 return FL_INVALID|FL_RINGBELL;
36 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
37 char const *, char const *, int c)
39 if (c == 0 /* final test before handing contents to app */
40 || strchr("0123456789", c)) {
41 /* since we only accept numerals then it must be valid */
44 return FL_INVALID|FL_RINGBELL;
48 int fl_float_filter(FL_OBJECT * ob,
49 char const *, char const *, int c)
51 if (c == 0 /* final test before handing contents to app */
52 || strchr("0123456789.+-", c)) {
53 if (isStrDbl(fl_get_input(ob)))
56 return FL_INVALID|FL_RINGBELL;
60 int fl_unsigned_float_filter(FL_OBJECT * ob,
61 char const * /*not_used*/,
62 char const * /*unused*/,
65 if (c == 0 /* final test before handing contents to app */
66 || strchr("0123456789.", c)) {
67 if (isStrDbl(fl_get_input(ob)))
70 return FL_INVALID|FL_RINGBELL;
74 int fl_lowercase_filter(FL_OBJECT * /*ob*/,
75 char const * /*not_used*/,
76 char const * /*unused*/,
79 if (c == 0 /* final test before handing contents to app */
80 || strchr("abcdefghijklmnopqrstuvwxyz0123456789", c)) {
81 /* since we only accept numerals then it must be valid */
84 return FL_INVALID|FL_RINGBELL;
88 #if defined(__cplusplus)