]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QRef.h
Transfer Text::drawSelection() from InsetText::drawSelection() to InsetText::draw...
[lyx.git] / src / frontends / qt4 / QRef.h
1 // -*- C++ -*-
2 /**
3  * \file QRef.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 QREF_H
13 #define QREF_H
14
15 #include "QDialogView.h"
16
17 #include "ui_RefUi.h"
18
19 #include <QDialog>
20
21 #include <vector>
22
23 class QListWidgetItem;
24 class QCloseEvent;
25
26 namespace lyx {
27 namespace frontend {
28
29 class QRef;
30
31 class QRefDialog : public QDialog, public Ui::QRefUi {
32         Q_OBJECT
33 public:
34         QRefDialog(QRef * form);
35
36         virtual void show();
37
38 public Q_SLOTS:
39         void changed_adaptor();
40         void gotoClicked();
41         void refHighlighted(QListWidgetItem *);
42         void selectionChanged();
43         void refSelected(QListWidgetItem *);
44         void sortToggled(bool);
45         void updateClicked();
46
47 protected Q_SLOTS:
48         void reset_dialog();
49 protected:
50         void closeEvent(QCloseEvent * e);
51 private:
52         QRef * form_;
53 };
54
55
56 class ControlRef;
57
58 // full qualification because qt4 has also a ControlRef type
59 class QRef
60         : public QController<lyx::frontend::ControlRef, QView<QRefDialog> >
61 {
62 public:
63         friend class QRefDialog;
64
65         QRef(Dialog &);
66
67 protected:
68         virtual bool isValid();
69
70 private:
71         /// apply changes
72         virtual void apply();
73         /// build dialog
74         virtual void build_dialog();
75         /// update dialog
76         virtual void update_contents();
77
78         /// is name allowed for this ?
79         bool nameAllowed();
80
81         /// is type allowed for this ?
82         bool typeAllowed();
83
84         /// go to current reference
85         void gotoRef();
86
87         /// set go back button
88         void setGoBack();
89
90         /// set goto ref button
91         void setGotoRef();
92
93         /// re-enter references
94         void redoRefs();
95
96         /// update references
97         void updateRefs();
98
99         /// sort or not persistent state
100         bool sort_;
101
102         /// went to a reference ?
103         bool at_ref_;
104
105         /// the last reference entered or examined
106         QString last_reference_;
107
108         /// store the buffer settings
109         int restored_buffer_;
110
111         /// the references
112         std::vector<docstring> refs_;
113 };
114
115 } // namespace frontend
116 } // namespace lyx
117
118 #endif // QREF_H