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