]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/checkedwidgets.h
merge booktabs branch
[lyx.git] / src / frontends / xforms / checkedwidgets.h
1 // -*- C++ -*-
2 /**
3  * \file xforms/checkedwidgets.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef CHECKEDWIDGETS_H
13 #define CHECKEDWIDGETS_H
14
15 #include "BCView.h"
16 #include "forms_fwd.h"
17
18 namespace lyx {
19 namespace frontend {
20
21 class CheckedLyXLength;
22 class CheckedGlueLength;
23 class CheckedPath;
24
25
26 //
27 CheckedLyXLength &
28 addCheckedLyXLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label = 0);
29
30 CheckedGlueLength &
31 addCheckedGlueLength(BCView & bcview, FL_OBJECT * input, FL_OBJECT * label = 0);
32
33 CheckedPath &
34 addCheckedPath(BCView & bcview, bool acceptable_if_empty,
35                FL_OBJECT * input, FL_OBJECT * label = 0);
36
37
38 class CheckedLyXLength : public CheckedWidget {
39 public:
40         /** The label widget's label will be turned red if input
41          *  does not make a valid LyXLength.
42          *  If label == 0, then the label of input will be used.
43          */
44         CheckedLyXLength(FL_OBJECT * input, FL_OBJECT * label = 0);
45
46 private:
47         ///
48         virtual bool check() const;
49
50         ///
51         FL_OBJECT * input_;
52         FL_OBJECT * label_;
53 };
54
55
56 class CheckedGlueLength : public CheckedWidget {
57 public:
58         /** The label widget's label will be turned red if input
59          *  does not make a valid LyXGlueLength.
60          *  If label == 0, then the label of input will be used.
61          */
62         CheckedGlueLength(FL_OBJECT * input, FL_OBJECT * label = 0);
63
64 private:
65         ///
66         virtual bool check() const;
67
68         ///
69         FL_OBJECT * input_;
70         FL_OBJECT * label_;
71 };
72
73 } // namespace frontend
74 } // namespace lyx
75
76
77 // Forward declarations
78 class LyXRC;
79
80 namespace lyx {
81 namespace frontend {
82
83 class KernelDocType;
84
85
86 class CheckedPath : public CheckedWidget {
87 public:
88         /** The label widget's label will be turned red if input
89          *  does not make a valid file path.
90          *  If label == 0, then the label of input will be used.
91          *  If @c acceptable_if_empty is @c true then an empty path
92          *  is regarded as acceptable.
93          */
94         CheckedPath(bool acceptable_if_empty,
95                     FL_OBJECT * input, FL_OBJECT * label = 0);
96
97         /** Define now to perform the check.
98          *  @param doc_type checks are activated only for @c LATEX docs.
99          *  @param lyxrc contains a @c tex_allows_spaces member that
100          *  is used to define what is legal.
101          */
102         void setChecker(lyx::frontend::KernelDocType const & doc_type,
103                         LyXRC const & lyxrc);
104
105 private:
106         ///
107         virtual bool check() const;
108
109         ///
110         FL_OBJECT * input_;
111         FL_OBJECT * label_;
112
113         bool acceptable_if_empty_;
114         bool latex_doc_;
115         bool tex_allows_spaces_;
116 };
117
118 } // namespace frontend
119 } // namespace lyx
120
121 #endif // CHECKEDWIDGETS_H