]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiInclude.h
Merge QController into individual dialogs. Also various cleanup
[lyx.git] / src / frontends / qt4 / GuiInclude.h
1 // -*- C++ -*-
2 /**
3  * \file GuiInclude.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUIINCLUDE_H
13 #define GUIINCLUDE_H
14
15 #include "GuiDialogView.h"
16 #include "ControlInclude.h"
17 #include "ui_IncludeUi.h"
18
19 #include <QDialog>
20
21 namespace lyx {
22 namespace frontend {
23
24 class GuiInclude;
25
26 class GuiIncludeDialog : public QDialog, public Ui::IncludeUi {
27         Q_OBJECT
28 public:
29         GuiIncludeDialog(GuiInclude * form);
30
31         void updateLists();
32
33         virtual void show();
34         /// validate listings parameters and return an error message, if any
35         docstring validate_listings_params();
36 protected Q_SLOTS:
37         virtual void change_adaptor();
38         virtual void editClicked();
39         virtual void browseClicked();
40         virtual void typeChanged(int v);
41         /// AFAIK, QValidator only works for QLineEdit so
42         /// I have to validate listingsED (QTextEdit) manually.
43         /// This function displays a hint or error message returned by
44         /// validate_listings_params
45         void set_listings_msg();
46 protected:
47         virtual void closeEvent(QCloseEvent * e);
48 private:
49         GuiInclude * form_;
50 };
51
52
53 class GuiInclude : public GuiView<GuiIncludeDialog>
54 {
55 public:
56         ///
57         friend class GuiIncludeDialog;
58         ///
59         GuiInclude(Dialog &);
60         /// parent controller
61         ControlInclude & controller()
62         { return static_cast<ControlInclude &>(this->getController()); }
63         /// parent controller
64         ControlInclude const & controller() const
65         { return static_cast<ControlInclude const &>(this->getController()); }
66 protected:
67         virtual bool isValid();
68 private:
69         /// Apply changes
70         virtual void apply();
71         /// update
72         virtual void update_contents();
73         /// build the dialog
74         virtual void build_dialog();
75
76         /// edit the child document, .lyx file will be opened in lyx
77         /// other formats will be edited by external applications.
78         void edit();
79
80         /// browse for a file
81         void browse();
82 };
83
84 } // namespace frontend
85 } // namespace lyx
86
87 #endif // GUIINCLUDE_H