]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiRef.h
start dissolving frontends/controllers. 40 steps to go.
[lyx.git] / src / frontends / qt4 / GuiRef.h
1 // -*- C++ -*-
2 /**
3  * \file GuiRef.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 GUIREF_H
13 #define GUIREF_H
14
15 #include "GuiDialog.h"
16 #include "Dialog.h"
17 #include "ui_RefUi.h"
18 #include "insets/InsetCommandParams.h"
19
20 #include <vector>
21
22 class QListWidgetItem;
23
24 namespace lyx {
25 namespace frontend {
26
27 class GuiRef : public GuiDialog, public Ui::RefUi, public Controller
28 {
29         Q_OBJECT
30
31 public:
32         GuiRef(LyXView & lv);
33
34 private Q_SLOTS:
35         void changed_adaptor();
36         void gotoClicked();
37         void refHighlighted(QListWidgetItem *);
38         void selectionChanged();
39         void refSelected(QListWidgetItem *);
40         void sortToggled(bool);
41         void updateClicked();
42         void reset_dialog();
43
44 private:
45         ///
46         bool initialiseParams(std::string const & data);
47         /// clean-up on hide.
48         void clearParams();
49         /// clean-up on hide.
50         void dispatchParams();
51         ///
52         bool isBufferDependent() const { return true; }
53
54         /** disconnect from the inset when the Apply button is pressed.
55          Allows easy insertion of multiple references. */
56         bool disconnectOnApply() const { return true; }
57         ///
58         void gotoRef(std::string const &);
59         ///
60         void gotoBookmark();
61         ///
62         int bufferNum() const;
63
64         ///
65         void closeEvent(QCloseEvent * e);
66         /// parent controller
67         Controller & controller() { return *static_cast<Controller*>(this); }
68         ///
69         bool isValid();
70         /// apply changes
71         void applyView();
72         /// update dialog
73         void updateContents();
74
75         /// is name allowed for this ?
76         bool nameAllowed();
77         /// is type allowed for this ?
78         bool typeAllowed();
79         /// go to current reference
80         void gotoRef();
81         /// set go back button
82         void setGoBack();
83         /// set goto ref button
84         void setGotoRef();
85         /// re-enter references
86         void redoRefs();
87         /// update references
88         void updateRefs();
89
90         /// sort or not persistent state
91         bool sort_;
92         /// went to a reference ?
93         bool at_ref_;
94         /// the last reference entered or examined
95         QString last_reference_;
96         /// store the buffer settings
97         int restored_buffer_;
98         /// the references
99         std::vector<docstring> refs_;
100
101         ///
102         InsetCommandParams params_;
103 };
104
105 } // namespace frontend
106 } // namespace lyx
107
108 #endif // GUIREF_H