]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Validator.h
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / Validator.h
index 81e46b0f571d175bc716272093775bfbff3a29e7..22e8d484d3d4b7ab02c3c50a817886eca23bd536 100644 (file)
@@ -62,6 +62,7 @@ public:
        void setBottom(Length const &);
        void setBottom(GlueLength const &);
        Length bottom() const { return b_; }
+       void setUnsigned(bool const u) { unsigned_ = u; }
        //@}
 
 private:
@@ -69,12 +70,20 @@ private:
        GlueLength g_;
        bool no_bottom_;
        bool glue_length_;
+       bool unsigned_;
 };
 
 
 /// @returns a new @c LengthValidator that does not accept negative lengths.
 LengthValidator * unsignedLengthValidator(QLineEdit *);
 
+
+/** @returns a new @c LengthValidator that does not accept negative lengths.
+ *  but glue lengths.
+ */
+LengthValidator * unsignedGlueLengthValidator(QLineEdit *);
+
+
 /** A class to ascertain whether the data passed to the @c validate()
  *  member function can be interpretted as a GlueLength or is @param autotext.
  */
@@ -83,7 +92,7 @@ class LengthAutoValidator : public LengthValidator
        Q_OBJECT
 public:
        /// Define a validator for widget @c parent.
-       LengthAutoValidator(QWidget * parent, QString const autotext);
+       LengthAutoValidator(QWidget * parent, QString const autotext);
 
        /** @returns QValidator::Acceptable if @c data is a GlueLength
                * or is "auto". If not, returns QValidator::Intermediate.
@@ -95,7 +104,7 @@ private:
 };
 
 /// @returns a new @c LengthAutoValidator that does not accept negative lengths.
-LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit *, QString const autotext);
+LengthAutoValidator * unsignedLengthAutoValidator(QLineEdit *, QString const autotext);
 
 
 /**
@@ -107,7 +116,7 @@ class DoubleAutoValidator : public QDoubleValidator
 {
        Q_OBJECT
 public:
-       DoubleAutoValidator(QWidget * parent, QString const autotext);
+       DoubleAutoValidator(QWidget * parent, QString const autotext);
        DoubleAutoValidator(double bottom, double top, int decimals,
                QObject * parent);
        QValidator::State validate(QString & input, int & pos) const;
@@ -117,6 +126,18 @@ private:
 };
 
 
+// A class to ascertain that no newline characters are passed.
+class NoNewLineValidator : public QValidator
+{
+       Q_OBJECT
+public:
+       // Define a validator.
+       NoNewLineValidator(QWidget *);
+       // Remove newline characters from input.
+       QValidator::State validate(QString &, int &) const;
+};
+
+
 /** A class to ascertain whether the data passed to the @c validate()
  *  member function is a valid file path.
  *  The test is active only when the path is to be stored in a LaTeX