]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiRef.h
merge GuiCommand into its users.
[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 "ui_RefUi.h"
17
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
28 {
29         Q_OBJECT
30
31 public:
32         GuiRef(GuiView & 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 isBufferDependent() const { return true; }
47         /** disconnect from the inset when the Apply button is pressed.
48          Allows easy insertion of multiple references. */
49         bool disconnectOnApply() const { return true; }
50         ///
51         void gotoRef(std::string const &);
52         ///
53         void gotoBookmark();
54         ///
55         void closeEvent(QCloseEvent * e);
56         ///
57         bool isValid();
58         /// apply changes
59         void applyView();
60         /// update dialog
61         void updateContents();
62
63         /// is name allowed for this ?
64         bool nameAllowed();
65         /// is type allowed for this ?
66         bool typeAllowed();
67         /// go to current reference
68         void gotoRef();
69         /// set go back button
70         void setGoBack();
71         /// set goto ref button
72         void setGotoRef();
73         /// re-enter references
74         void redoRefs();
75         /// update references
76         void updateRefs();
77         ///
78         bool initialiseParams(std::string const & data);
79         /// clean-up on hide.
80         void clearParams() { params_.clear(); }
81         /// clean-up on hide.
82         void dispatchParams();
83
84 private:
85         ///
86         InsetCommandParams params_;
87
88         /// sort or not persistent state
89         bool sort_;
90         /// went to a reference ?
91         bool at_ref_;
92         /// the last reference entered or examined
93         QString last_reference_;
94         /// store the buffer settings
95         int restored_buffer_;
96         /// the references
97         std::vector<docstring> refs_;
98 };
99
100 } // namespace frontend
101 } // namespace lyx
102
103 #endif // GUIREF_H