]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommandBuffer.h
next one
[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 "support/docstring.h"
18
19 #include <vector>
20
21
22 namespace lyx {
23 namespace frontend {
24
25 class LyXView;
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         docstring const getCurrentState() const;
45
46         /// hide the command buffer.
47         void hide() const;
48
49         /// return the possible completions
50         std::vector<std::string> const completions(std::string const & prefix,
51                                               std::string & new_prefix);
52
53         /// dispatch a command
54         void dispatch(std::string const & str);
55 private:
56         /// controlling LyXView
57         LyXView & lv_;
58
59         /// available command names
60         std::vector<std::string> commands_;
61
62         /// command history
63         std::vector<std::string> history_;
64
65         /// current position in command history
66         std::vector<std::string>::const_iterator history_pos_;
67 };
68
69 } // namespace frontend
70 } // namespace lyx
71
72 #endif // CONTROLCOMMANDBUFFER_H