]> git.lyx.org Git - features.git/blobdiff - src/frontends/xforms/input_validators.C
Baruch's graphics patch + some small tweaks to the buttoncontroller stuff
[features.git] / src / frontends / xforms / input_validators.C
index e511e10e59cce3400867108b64041bd5411ac540..f22740e67e859b685381454f0f939f129fdc5a67 100644 (file)
@@ -14,10 +14,20 @@ extern "C"
 {
 #endif
 
+int fl_int_filter(FL_OBJECT * ob,
+                 char const *, char const *, int c)
+{
+       if (c == 0 /* final test before handing contents to app */
+           || strchr("0123456789+-", c)) {
+               if (isStrInt(fl_get_input(ob)))
+                       return FL_VALID;
+       }
+       return FL_INVALID|FL_RINGBELL;
+}
+
+
 int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
-                          char const * /*not_used*/,
-                          char const * /*unused*/,
-                          int c)
+                          char const *, char const *, int c)
 {
        if (c == 0 /* final test before handing contents to app */
            || strchr("0123456789", c)) {
@@ -28,6 +38,18 @@ int fl_unsigned_int_filter(FL_OBJECT * /*ob*/,
 }
 
 
+int fl_float_filter(FL_OBJECT * ob,
+                   char const *, char const *, int c)
+{
+       if (c == 0 /* final test before handing contents to app */
+           || strchr("0123456789.+-", c)) {
+               if (isStrDbl(fl_get_input(ob)))
+                       return FL_VALID;
+       }
+       return FL_INVALID|FL_RINGBELL;
+}
+
+
 int fl_unsigned_float_filter(FL_OBJECT * ob,
                             char const * /*not_used*/,
                             char const * /*unused*/,
@@ -37,8 +59,6 @@ int fl_unsigned_float_filter(FL_OBJECT * ob,
            || strchr("0123456789.", c)) {
                if (isStrDbl(fl_get_input(ob)))
                        return FL_VALID;
-               else
-                       return FL_INVALID|FL_RINGBELL;
        }
        return FL_INVALID|FL_RINGBELL;
 }