]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiRef.h
rename a few view functions from foo() to fooView()
[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 "GuiDialogView.h"
16 #include "ControlRef.h"
17 #include "ui_RefUi.h"
18
19 #include <QDialog>
20
21 #include <vector>
22
23 class QListWidgetItem;
24
25 namespace lyx {
26 namespace frontend {
27
28 class GuiRef;
29
30 class GuiRefDialog : public QDialog, public Ui::RefUi {
31         Q_OBJECT
32 public:
33         GuiRefDialog(GuiRef * form);
34
35         virtual void showView();
36
37 public 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
46 protected Q_SLOTS:
47         void reset_dialog();
48 protected:
49         void closeEvent(QCloseEvent * e);
50 private:
51         GuiRef * form_;
52 };
53
54
55 class GuiRef : public GuiView<GuiRefDialog>
56 {
57 public:
58         friend class GuiRefDialog;
59
60         GuiRef(GuiDialog &);
61
62         /// parent controller
63         ControlRef & controller()
64         { return static_cast<ControlRef &>(this->getController()); }
65         /// parent controller
66         ControlRef const & controller() const
67         { return static_cast<ControlRef const &>(this->getController()); }
68 protected:
69         virtual bool isValid();
70
71 private:
72         /// apply changes
73         virtual void applyView();
74         /// build dialog
75         virtual void build_dialog();
76         /// update dialog
77         virtual void update_contents();
78
79         /// is name allowed for this ?
80         bool nameAllowed();
81         /// is type allowed for this ?
82         bool typeAllowed();
83         /// go to current reference
84         void gotoRef();
85         /// set go back button
86         void setGoBack();
87         /// set goto ref button
88         void setGotoRef();
89         /// re-enter references
90         void redoRefs();
91         /// update references
92         void updateRefs();
93
94         /// sort or not persistent state
95         bool sort_;
96         /// went to a reference ?
97         bool at_ref_;
98         /// the last reference entered or examined
99         QString last_reference_;
100         /// store the buffer settings
101         int restored_buffer_;
102         /// the references
103         std::vector<docstring> refs_;
104 };
105
106 } // namespace frontend
107 } // namespace lyx
108
109 #endif // GUIREF_H