]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/InsetParamsWidget.h
Migrate GuiHSPace to InsetParamsDialog.
[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 \r
29 namespace frontend {\r
30 \r
31 /// CheckedWidget\r
32 // FIXME: Get rid of CheckedLineEdit in ButtonController and rename this one\r
33 // to it.\r
34 class CheckedWidget\r
35 {\r
36 public:\r
37         CheckedWidget(QLineEdit * input, QWidget * label = 0);\r
38         ///     \r
39         bool check() const;\r
40 \r
41 private:\r
42         // non-owned\r
43         QLineEdit * input_;\r
44         QWidget * label_;\r
45 };\r
46 \r
47 \r
48 typedef QList<CheckedWidget> CheckedWidgets;\r
49 \r
50 class InsetParamsWidget : public QWidget\r
51 {\r
52         Q_OBJECT\r
53 \r
54 Q_SIGNALS:\r
55         void changed();\r
56 public:\r
57         InsetParamsWidget(QWidget * parent);\r
58         /// This is a base class; destructor must exist and be virtual.\r
59         virtual ~InsetParamsWidget() {}\r
60         ///\r
61         virtual InsetCode insetCode() const = 0;\r
62         ///\r
63         virtual FuncCode creationCode() const = 0;\r
64         ///\r
65         virtual void paramsToDialog(Inset const *) = 0;\r
66         ///\r
67         virtual docstring dialogToParams() const = 0;\r
68 \r
69         /// \return true if all CheckedWidgets are in a valid state.\r
70         virtual bool checkWidgets() const;\r
71 \r
72 protected:\r
73         /// Add a widget to the list of all widgets whose validity should\r
74         /// be checked explicitly when the buttons are refreshed.\r
75         void addCheckedWidget(QLineEdit * input, QWidget * label = 0);\r
76 private:\r
77         ///\r
78         CheckedWidgets checked_widgets_;\r
79 };\r
80 \r
81 } // namespace frontend\r
82 } // namespace lyx\r
83 \r
84 #endif // INSET_PARAMS_WIDGET_H\r