]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/InsetParamsWidget.h
Squash warning about unused variable
[lyx.git] / src / frontends / qt4 / InsetParamsWidget.h
1 // -*- C++ -*-\r
2 /**\r
3  * \file InsetParamsWidget.h\r
4  * This file is part of LyX, the document processor.\r
5  * Licence details can be found in the file COPYING.\r
6  *\r
7  * \author Abdelrazak Younes\r
8  *\r
9  * Full author contact details are available in file CREDITS.\r
10  */\r
11 \r
12 #ifndef INSET_PARAMS_WIDGET_H\r
13 #define INSET_PARAMS_WIDGET_H\r
14 \r
15 #include "insets/InsetCode.h"\r
16 \r
17 #include "FuncCode.h"\r
18 \r
19 #include "support/strfwd.h"\r
20 \r
21 #include <QWidget>\r
22 \r
23 class QLineEdit;\r
24 \r
25 namespace lyx {\r
26 \r
27 class Inset;\r
28 class InsetCommandParams;\r
29 \r
30 namespace frontend {\r
31 \r
32 /// CheckedWidget\r
33 // FIXME: Get rid of CheckedLineEdit in ButtonController and rename this one\r
34 // to it.\r
35 class CheckedWidget\r
36 {\r
37 public:\r
38         CheckedWidget(QLineEdit * input, QWidget * label = 0);\r
39         ///     \r
40         bool check() const;\r
41 \r
42 private:\r
43         // non-owned\r
44         QLineEdit * input_;\r
45         QWidget * label_;\r
46 };\r
47 \r
48 \r
49 typedef QList<CheckedWidget> CheckedWidgets;\r
50 \r
51 class InsetParamsWidget : public QWidget\r
52 {\r
53         Q_OBJECT\r
54 \r
55 Q_SIGNALS:\r
56         void changed();\r
57 public:\r
58         InsetParamsWidget(QWidget * parent);\r
59         /// This is a base class; destructor must exist and be virtual.\r
60         virtual ~InsetParamsWidget() {}\r
61         ///\r
62         virtual InsetCode insetCode() const = 0;\r
63         ///\r
64         virtual FuncCode creationCode() const = 0;\r
65         ///\r
66         virtual void paramsToDialog(Inset const *) = 0;\r
67         ///\r
68         virtual docstring dialogToParams() const = 0;\r
69         ///\r
70         virtual void paramsToDialog(InsetCommandParams const & /*params*/) {}\r
71         ///\r
72         virtual bool initialiseParams(std::string const & data);\r
73 \r
74         /// \return true if all CheckedWidgets are in a valid state.\r
75         virtual bool checkWidgets() const;\r
76 \r
77 protected:\r
78         /// Add a widget to the list of all widgets whose validity should\r
79         /// be checked explicitly when the buttons are refreshed.\r
80         void addCheckedWidget(QLineEdit * input, QWidget * label = 0);\r
81 private:\r
82         ///\r
83         CheckedWidgets checked_widgets_;\r
84 };\r
85 \r
86 } // namespace frontend\r
87 } // namespace lyx\r
88 \r
89 #endif // INSET_PARAMS_WIDGET_H\r