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