]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiCommandBuffer.h
Some more cosmetics and removal of unused methods in GuiView.
[lyx.git] / src / frontends / qt4 / GuiCommandBuffer.h
1 // -*- C++ -*-
2 /**
3  * \file GuiCommandBuffer.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars
8  * \author Asger and Jürgen
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUICOMMANDBUFFER_H
15 #define GUICOMMANDBUFFER_H
16
17 #include "support/docstring.h"
18
19 #include <QWidget>
20
21 #include <vector>
22
23 class QListWidgetItem;
24
25 namespace lyx {
26 namespace frontend {
27
28 class GuiView;
29 class GuiCommandEdit;
30
31 class GuiCommandBuffer : public QWidget
32 {
33         Q_OBJECT
34
35 public:
36         GuiCommandBuffer(GuiView * view);
37
38 public Q_SLOTS:
39         /// cancel command compose
40         void cancel();
41         /// dispatch a command
42         void dispatch();
43         /// tab-complete
44         void complete();
45         /// select-complete
46         void complete_selected(QListWidgetItem *);
47         /// up
48         void up();
49         /// down
50         void down();
51         /// leave and hide the command buffer
52         void hideParent();
53 private:
54         /// owning view
55         GuiView * view_;
56         /// command widget
57         GuiCommandEdit * edit_;
58
59         /// return the previous history entry if any
60         std::string const historyUp();
61         /// return the next history entry if any
62         std::string const historyDown();
63
64         /// return the font and depth in the active BufferView as a message.
65         docstring const getCurrentState() const;
66
67         /// hide the command buffer.
68         void hide() const;
69
70         /// return the possible completions
71         std::vector<std::string> const completions(std::string const & prefix,
72                                               std::string & new_prefix);
73
74         /// dispatch a command
75         void dispatch(std::string const & str);
76
77         /// available command names
78         std::vector<std::string> commands_;
79
80         /// command history
81         std::vector<std::string> history_;
82
83         /// current position in command history
84         std::vector<std::string>::const_iterator history_pos_;
85 };
86
87 } // namespace frontend
88 } // namespace lyx
89
90 #endif // GUICOMMANDBUFFER_H