]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/input_validators.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / input_validators.C
1 /* input_validators.C
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.
5  */
6
7 #include <config.h>
8
9
10 #include FORMS_H_LOCATION
11 #include "support/lstrings.h"
12 #include "input_validators.h"
13
14 #if defined(__cplusplus)
15 extern "C"
16 {
17 #endif
18
19 int fl_int_filter(FL_OBJECT * ob,
20                   char const *, char const *, int c)
21 {
22         if (c == 0 /* final test before handing contents to app */
23             || strchr("0123456789+-", c)) {
24                 if (isStrInt(fl_get_input(ob)))
25                         return FL_VALID;
26         }
27         return FL_INVALID|FL_RINGBELL;
28 }
29
30
31 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
32                            char const *, char const *, int c)
33 {
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 */
37                 return FL_VALID;
38         }
39         return FL_INVALID|FL_RINGBELL;
40 }
41
42
43 int fl_float_filter(FL_OBJECT * ob,
44                     char const *, char const *, int c)
45 {
46         if (c == 0 /* final test before handing contents to app */
47             || strchr("0123456789.+-", c)) {
48                 if (isStrDbl(fl_get_input(ob)))
49                         return FL_VALID;
50         }
51         return FL_INVALID|FL_RINGBELL;
52 }
53
54
55 int fl_unsigned_float_filter(FL_OBJECT * ob,
56                              char const * /*not_used*/,
57                              char const * /*unused*/,
58                              int c)
59 {
60         if (c == 0 /* final test before handing contents to app */
61             || strchr("0123456789.", c)) {
62                 if (isStrDbl(fl_get_input(ob)))
63                         return FL_VALID;
64         }
65         return FL_INVALID|FL_RINGBELL;
66 }
67
68
69 int fl_lowercase_filter(FL_OBJECT * /*ob*/,
70                         char const * /*not_used*/,
71                         char const * /*unused*/,
72                         int c)
73 {
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 */
77                 return FL_VALID;
78         }
79         return FL_INVALID|FL_RINGBELL;
80 }
81
82
83 #if defined(__cplusplus)
84 }
85 #endif