]> git.lyx.org Git - features.git/blob - src/frontends/controllers/ControlCommandBuffer.h
8cd968aa9d969d047d45202c16c4fa24b0dc6f13
[features.git] / src / frontends / controllers / ControlCommandBuffer.h
1 // -*- C++ -*-
2 /**
3  * \file ControlCommandBuffer.h
4  * Copyright 1995-2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Lars
8  * \author Asger and Juergen
9  * \author John Levon <levon@movementarian.org>
10  */
11
12 #ifndef CONTROLCOMMANDBUFFER_H
13 #define CONTROLCOMMANDBUFFER_H
14
15 #include "LString.h"
16
17 #include <vector>
18
19 #ifdef __GNUG__
20 #pragma interface
21 #endif
22
23 class LyXFunc;
24
25 /**
26  * ControlCommandBuffer
27  *
28  * This provides methods for the use of a toolkit's
29  * minibuffer/command buffer 
30  */
31 class ControlCommandBuffer {
32 public:
33         ControlCommandBuffer(LyXFunc & lf);
34         
35         /// return the previous history entry if any
36         string const historyUp();
37
38         /// return the next history entry if any
39         string const historyDown();
40
41         /// return the possible completions
42         std::vector<string> const completions(string const & prefix, string & new_prefix);
43  
44         /// dispatch a command
45         void dispatch(string const & str);
46  
47 private:
48         /// controlling lyxfunc
49         LyXFunc & lyxfunc_;
50         
51         /// available command names
52         std::vector<string> commands_;
53  
54         /// command history
55         std::vector<string> history_;
56
57         /// current position in command history
58         std::vector<string>::const_iterator history_pos_;
59 };
60  
61 #endif // CONTROLCOMMANDBUFFER_H