3 * \file GuiCommandBuffer.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Asger and Jürgen
11 * Full author contact details are available in file CREDITS.
14 #ifndef GUICOMMANDBUFFER_H
15 #define GUICOMMANDBUFFER_H
17 #include "support/docstring.h"
19 #include <QPushButton>
24 class QListWidgetItem;
32 class GuiCommandBuffer : public QWidget
37 GuiCommandBuffer(GuiView * view);
40 /// cancel command compose
42 /// dispatch a command
48 /// called when an item in a list is selected
49 void itemSelected(QListWidgetItem *);
54 /// leave and hide the command buffer
60 GuiCommandEdit * edit_;
62 /// return the previous history entry if any
63 std::string const historyUp();
64 /// return the next history entry if any
65 std::string const historyDown();
67 /// return the font and depth in the active BufferView as a message.
68 docstring const getCurrentState() const;
70 /// hide the command buffer.
73 /// open a listbox and show the contents of the list. When reversed
74 /// is true, the contents of the list is filled bottom-up.
75 void showList(std::vector<std::string> const & list,
76 QPoint const & pos, bool reversed = false) const;
78 /// return the possible completions
79 std::vector<std::string> const completions(std::string const & prefix,
80 std::string & new_prefix);
82 /// dispatch a command
83 void dispatch(std::string const & str);
85 /// available command names
86 std::vector<std::string> commands_;
89 std::vector<std::string> history_;
91 /// current position in command history
92 std::vector<std::string>::const_iterator history_pos_;
101 } // namespace frontend
104 #endif // GUICOMMANDBUFFER_H