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 using namespace lyx::support;
16 #if defined(__cplusplus)
21 int fl_int_filter(FL_OBJECT * ob,
22 char const *, char const *, int c)
24 if (c == 0 /* final test before handing contents to app */
25 || strchr("0123456789+-", c)) {
26 if (isStrInt(fl_get_input(ob)))
29 return FL_INVALID|FL_RINGBELL;
33 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
34 char const *, char const *, int c)
36 if (c == 0 /* final test before handing contents to app */
37 || strchr("0123456789", c)) {
38 /* since we only accept numerals then it must be valid */
41 return FL_INVALID|FL_RINGBELL;
45 int fl_float_filter(FL_OBJECT * ob,
46 char const *, char const *, int c)
48 if (c == 0 /* final test before handing contents to app */
49 || strchr("0123456789.+-", c)) {
50 if (isStrDbl(fl_get_input(ob)))
53 return FL_INVALID|FL_RINGBELL;
57 int fl_unsigned_float_filter(FL_OBJECT * ob,
58 char const * /*not_used*/,
59 char const * /*unused*/,
62 if (c == 0 /* final test before handing contents to app */
63 || strchr("0123456789.", c)) {
64 if (isStrDbl(fl_get_input(ob)))
67 return FL_INVALID|FL_RINGBELL;
71 int fl_lowercase_filter(FL_OBJECT * /*ob*/,
72 char const * /*not_used*/,
73 char const * /*unused*/,
76 if (c == 0 /* final test before handing contents to app */
77 || strchr("abcdefghijklmnopqrstuvwxyz0123456789", c)) {
78 /* since we only accept numerals then it must be valid */
81 return FL_INVALID|FL_RINGBELL;
85 #if defined(__cplusplus)