X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2Fcheckedwidgets.h;fp=src%2Ffrontends%2Fxforms%2Fcheckedwidgets.h;h=27885a1b01b3b0372ef5d0ebde42ac99196762aa;hb=36c3528db849127813db4441421130e2647ec5c2;hp=1088bbcaa999eefbdabb4c6c39009cc4edc6012d;hpb=270bb796aa63d72740101b41a688db7fbf7a81c6;p=lyx.git diff --git a/src/frontends/xforms/checkedwidgets.h b/src/frontends/xforms/checkedwidgets.h index 1088bbcaa9..27885a1b01 100644 --- a/src/frontends/xforms/checkedwidgets.h +++ b/src/frontends/xforms/checkedwidgets.h @@ -18,11 +18,22 @@ namespace lyx { namespace frontend { -void addCheckedLyXLength(BCView & bcview, - FL_OBJECT * input, FL_OBJECT * label = 0); +class CheckedLyXLength; +class CheckedGlueLength; +class CheckedPath; + + +// +CheckedLyXLength & +addCheckedLyXLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label = 0); + +CheckedGlueLength & +addCheckedGlueLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label = 0); + +CheckedPath & +addCheckedPath(BCView & bcview, bool acceptable_if_empty, + FL_OBJECT * input, FL_OBJECT * label = 0); -void addCheckedGlueLength(BCView & bcview, - FL_OBJECT * input, FL_OBJECT * label = 0); class CheckedLyXLength : public CheckedWidget { public: @@ -62,4 +73,49 @@ private: } // namespace frontend } // namespace lyx + +// Forward declarations +class LyXRC; + +namespace lyx { +namespace frontend { + +class KernelDocType; + + +class CheckedPath : public CheckedWidget { +public: + /** The label widget's label will be turned red if input + * does not make a valid file path. + * If label == 0, then the label of input will be used. + * If @c acceptable_if_empty is @c true then an empty path + * is regarded as acceptable. + */ + CheckedPath(bool acceptable_if_empty, + FL_OBJECT * input, FL_OBJECT * label = 0); + + /** Define now to perform the check. + * @param doc_type checks are activated only for @c LATEX docs. + * @param lyxrc contains a @c tex_allows_spaces member that + * is used to define what is legal. + */ + void setChecker(lyx::frontend::KernelDocType const & doc_type, + LyXRC const & lyxrc); + +private: + /// + virtual bool check() const; + + /// + FL_OBJECT * input_; + FL_OBJECT * label_; + + bool acceptable_if_empty_; + bool latex_doc_; + bool tex_allows_spaces_; +}; + +} // namespace frontend +} // namespace lyx + #endif // CHECKEDWIDGETS_H