]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiRef.h
Some comments and cosmetics.
[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 // FIXME This could, and therefore, should inherit from
28 // GuiCommand. Note, e.g., that the definitions of the first
29 // three private functions all just replicate what's there.
30 class GuiRef : public GuiDialog, public Ui::RefUi
31 {
32         Q_OBJECT
33
34 public:
35         GuiRef(LyXView & lv);
36
37 private Q_SLOTS:
38         void changed_adaptor();
39         void gotoClicked();
40         void refHighlighted(QListWidgetItem *);
41         void selectionChanged();
42         void refSelected(QListWidgetItem *);
43         void sortToggled(bool);
44         void updateClicked();
45         void reset_dialog();
46
47 private:
48         ///
49         bool initialiseParams(std::string const & data);
50         /// clean-up on hide.
51         void clearParams();
52         /// clean-up on hide.
53         void dispatchParams();
54         ///
55         bool isBufferDependent() const { return true; }
56
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         ///
66         void closeEvent(QCloseEvent * e);
67         ///
68         bool isValid();
69         /// apply changes
70         void applyView();
71         /// update dialog
72         void updateContents();
73
74         /// is name allowed for this ?
75         bool nameAllowed();
76         /// is type allowed for this ?
77         bool typeAllowed();
78         /// go to current reference
79         void gotoRef();
80         /// set go back button
81         void setGoBack();
82         /// set goto ref button
83         void setGotoRef();
84         /// re-enter references
85         void redoRefs();
86         /// update references
87         void updateRefs();
88
89         /// sort or not persistent state
90         bool sort_;
91         /// went to a reference ?
92         bool at_ref_;
93         /// the last reference entered or examined
94         QString last_reference_;
95         /// store the buffer settings
96         int restored_buffer_;
97         /// the references
98         std::vector<docstring> refs_;
99
100         ///
101         InsetCommandParams params_;
102 };
103
104 } // namespace frontend
105 } // namespace lyx
106
107 #endif // GUIREF_H