]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommandBuffer.h
move everything into namespace lyx
[lyx.git] / src / frontends / controllers / ControlCommandBuffer.h
1 // -*- C++ -*-
2 /**
3  * \file ControlCommandBuffer.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 CONTROLCOMMANDBUFFER_H
15 #define CONTROLCOMMANDBUFFER_H
16
17 #include <string>
18 #include <vector>
19
20
21 namespace lyx {
22
23 class LyXView;
24
25 namespace frontend {
26
27 /**
28  * ControlCommandBuffer
29  *
30  * This provides methods for the use of a toolkit's
31  * minibuffer/command buffer
32  */
33 class ControlCommandBuffer {
34 public:
35         ControlCommandBuffer(LyXView & lv);
36
37         /// return the previous history entry if any
38         std::string const historyUp();
39
40         /// return the next history entry if any
41         std::string const historyDown();
42
43         /// return the font and depth in the active BufferView as a message.
44         std::string const getCurrentState() const;
45
46         /// return the possible completions
47         std::vector<std::string> const completions(std::string const & prefix,
48                                               std::string & new_prefix);
49
50         /// dispatch a command
51         void dispatch(std::string const & str);
52 private:
53         /// controlling LyXView
54         LyXView & lv_;
55
56         /// available command names
57         std::vector<std::string> commands_;
58
59         /// command history
60         std::vector<std::string> history_;
61
62         /// current position in command history
63         std::vector<std::string>::const_iterator history_pos_;
64 };
65
66 } // namespace frontend
67 } // namespace lyx
68
69 #endif // CONTROLCOMMANDBUFFER_H