]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/InsetParamsWidget.h
Move Inset.h include from .h to .cpp
[lyx.git] / src / frontends / qt / 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) : QWidget(parent) {}
58         /// This is a base class; destructor must exist and be virtual.
59         virtual ~InsetParamsWidget() {}
60         ///
61         virtual QString dialogTitle() const;
62         ///
63         virtual InsetCode insetCode() const = 0;
64         ///
65         virtual FuncCode creationCode() const = 0;
66         ///
67         virtual void paramsToDialog(Inset const *) = 0;
68         ///
69         virtual docstring dialogToParams() const = 0;
70         ///
71         virtual bool initialiseParams(std::string const & /*data*/)
72                 { return false; }
73
74         /// \return true if all CheckedWidgets are in a valid state.
75         virtual bool checkWidgets(bool readonly = false) const;
76
77 protected:
78         /// Add a widget to the list of all widgets whose validity should
79         /// be checked explicitly when the buttons are refreshed.
80         void addCheckedWidget(QLineEdit * input, QWidget * label = 0);
81 private:
82         ///
83         CheckedWidgets checked_widgets_;
84 };
85
86 } // namespace frontend
87 } // namespace lyx
88
89 #endif // INSET_PARAMS_WIDGET_H