]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiListings.h
Merge QController into individual dialogs. Also various cleanup
[lyx.git] / src / frontends / qt4 / GuiListings.h
1 // -*- C++ -*-
2 /**
3  * \file GuiListings.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bo Peng
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUILISTINGS_H
13 #define GUILISTINGS_H
14
15 #include "GuiDialogView.h"
16 #include "ControlListings.h"
17 #include "ui_ListingsUi.h"
18
19 #include <QDialog>
20
21 namespace lyx {
22 namespace frontend {
23
24 class GuiListings;
25
26 class GuiListingsDialog : public QDialog, public Ui::ListingsUi {
27         Q_OBJECT
28 public:
29         GuiListingsDialog(GuiListings * form);
30         /// get values from all the widgets and form a string
31         std::string construct_params();
32         /// validate listings parameters and return an error message, if any
33         docstring validate_listings_params();
34 protected Q_SLOTS:
35         virtual void change_adaptor();
36         /// AFAIK, QValidator only works for QLineEdit so
37         /// I have to validate listingsED (QTextEdit) manually.
38         /// This function displays a hint or error message returned by
39         /// validate_listings_params
40         void set_listings_msg();
41         /// turn off inline when float is clicked
42         void on_floatCB_stateChanged(int state);
43         /// turn off float when inline is clicked
44         void on_inlineCB_stateChanged(int state);
45         /// turn off numbering options when none is selected
46         void on_numberSideCO_currentIndexChanged(int);
47         /// show dialect when language is chosen
48         void on_languageCO_currentIndexChanged(int);
49 protected:
50         virtual void closeEvent(QCloseEvent * e);
51 private:
52         GuiListings * form_;
53 };
54
55
56 class GuiListings : public GuiView<GuiListingsDialog> {
57 public:
58         friend class GuiListingsDialog;
59
60         GuiListings(Dialog &);
61         /// parent controller
62         ControlListings & controller()
63         { return static_cast<ControlListings &>(this->getController()); }
64         /// parent controller
65         ControlListings const & controller() const
66         { return static_cast<ControlListings const &>(this->getController()); }
67 private:
68         /// Apply changes
69         virtual void apply();
70         /// update
71         virtual void update_contents();
72         /// build the dialog
73         virtual void build_dialog();
74 protected:
75         /// return false if validate_listings_params returns error
76         virtual bool isValid();
77 };
78
79 } // namespace frontend
80 } // namespace lyx
81
82 #endif // GUILISTINGS_H