]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiRef.h
Generalize starred cite commands
[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 #include "FancyLineEdit.h"
18
19 #include "insets/InsetCommandParams.h"
20
21 #include <vector>
22
23 class QTreeWidgetItem;
24
25 namespace lyx {
26 namespace frontend {
27
28 class GuiRef : public GuiDialog, public Ui::RefUi
29 {
30         Q_OBJECT
31
32 public:
33         GuiRef(GuiView & lv);
34         /// Dialog inherited methods
35         //@{
36         void enableView(bool enable);
37         //@}
38
39 private Q_SLOTS:
40         void changed_adaptor();
41         void gotoClicked();
42         void filterLabels();
43         void resetFilter();
44         void refHighlighted(QTreeWidgetItem *);
45         void selectionChanged();
46         void refTextChanged(QString const &);
47         void refSelected(QTreeWidgetItem *);
48         void sortToggled();
49         void groupToggled();
50         void updateClicked();
51         void resetDialog();
52         void dialogRejected();
53
54 private:
55         ///
56         bool isBufferDependent() const { return true; }
57         /** disconnect from the inset when the Apply button is pressed.
58          Allows easy insertion of multiple references. */
59         bool disconnectOnApply() const { return true; }
60         ///
61         void gotoRef(std::string const &);
62         ///
63         void gotoBookmark();
64         ///
65         void closeEvent(QCloseEvent * e);
66         ///
67         bool isValid();
68         /// apply changes
69         void applyView();
70         /// update dialog
71         void updateContents();
72
73         /// is name allowed for this ?
74         bool nameAllowed();
75         /// is type allowed for this ?
76         bool typeAllowed();
77         /// go to current reference
78         void gotoRef();
79         /// set go back button
80         void setGoBack();
81         /// set goto ref button
82         void setGotoRef();
83         /// re-enter references
84         void redoRefs();
85         /// update references
86         void updateRefs();
87         ///
88         bool initialiseParams(std::string const & data);
89         /// clean-up on hide.
90         void clearParams() { params_.clear(); }
91         /// clean-up on hide.
92         void dispatchParams();
93
94 private:
95         ///
96         InsetCommandParams params_;
97
98         /// contains the search box
99         FancyLineEdit * filter_;
100
101         /// went to a reference ?
102         bool at_ref_;
103         /// the last reference entered or examined
104         QString last_reference_;
105         /// store the buffer settings
106         int restored_buffer_;
107         /// store the last active buffer
108         int active_buffer_;
109         /// the references
110         std::vector<docstring> refs_;
111 };
112
113 } // namespace frontend
114 } // namespace lyx
115
116 #endif // GUIREF_H