2 * A collection of input filtering and validating functions for use in
3 * XForms dialogs. Mainly meant for filtering input boxes although may
4 * be extended to include other generally useful xforms-specific tools.
10 #include "lyx_forms.h"
11 #include "support/lstrings.h"
12 #include "input_validators.h"
14 #if defined(__cplusplus)
19 int fl_int_filter(FL_OBJECT * ob,
20 char const *, char const *, int c)
22 if (c == 0 /* final test before handing contents to app */
23 || strchr("0123456789+-", c)) {
24 if (isStrInt(fl_get_input(ob)))
27 return FL_INVALID|FL_RINGBELL;
31 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
32 char const *, char const *, int c)
34 if (c == 0 /* final test before handing contents to app */
35 || strchr("0123456789", c)) {
36 /* since we only accept numerals then it must be valid */
39 return FL_INVALID|FL_RINGBELL;
43 int fl_float_filter(FL_OBJECT * ob,
44 char const *, char const *, int c)
46 if (c == 0 /* final test before handing contents to app */
47 || strchr("0123456789.+-", c)) {
48 if (isStrDbl(fl_get_input(ob)))
51 return FL_INVALID|FL_RINGBELL;
55 int fl_unsigned_float_filter(FL_OBJECT * ob,
56 char const * /*not_used*/,
57 char const * /*unused*/,
60 if (c == 0 /* final test before handing contents to app */
61 || strchr("0123456789.", c)) {
62 if (isStrDbl(fl_get_input(ob)))
65 return FL_INVALID|FL_RINGBELL;
69 int fl_lowercase_filter(FL_OBJECT * /*ob*/,
70 char const * /*not_used*/,
71 char const * /*unused*/,
74 if (c == 0 /* final test before handing contents to app */
75 || strchr("abcdefghijklmnopqrstuvwxyz0123456789", c)) {
76 /* since we only accept numerals then it must be valid */
79 return FL_INVALID|FL_RINGBELL;
83 #if defined(__cplusplus)