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