]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiCommandBuffer.h
Move the buffer related part from GuiView::renameBuffer to Buffer::saveAs.
[lyx.git] / src / frontends / qt4 / GuiCommandBuffer.h
1 // -*- C++ -*-
2 /**
3  * \file GuiCommandBuffer.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 GUICOMMANDBUFFER_H
15 #define GUICOMMANDBUFFER_H
16
17 #include "support/docstring.h"
18
19 #include <QPushButton>
20 #include <QWidget>
21
22 #include <vector>
23
24 class QListWidgetItem;
25
26 namespace lyx {
27 namespace frontend {
28
29 class GuiView;
30 class GuiCommandEdit;
31
32 class GuiCommandBuffer : public QWidget
33 {
34         Q_OBJECT
35
36 public:
37         GuiCommandBuffer(GuiView * view);
38
39 public Q_SLOTS:
40         /// cancel command compose
41         void cancel();
42         /// dispatch a command
43         void dispatch();
44         /// tab-complete
45         void complete();
46         /// show history
47         void listHistoryUp();
48         /// called when an item in a list is selected
49         void itemSelected(QListWidgetItem *);
50         /// up
51         void up();
52         /// down
53         void down();
54         /// leave and hide the command buffer
55         void hideParent();
56 private:
57         /// owning view
58         GuiView * view_;
59         /// command widget
60         GuiCommandEdit * edit_;
61
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();
66
67         /// return the font and depth in the active BufferView as a message.
68         docstring const getCurrentState() const;
69
70         /// hide the command buffer.
71         void hide() const;
72
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;
77
78         /// return the possible completions
79         std::vector<std::string> const completions(std::string const & prefix,
80                                               std::string & new_prefix);
81
82         /// dispatch a command
83         void dispatch(std::string const & str);
84
85         /// available command names
86         std::vector<std::string> commands_;
87
88         /// command history
89         std::vector<std::string> history_;
90
91         /// current position in command history
92         std::vector<std::string>::const_iterator history_pos_;
93
94         /// the button up
95         QPushButton * upPB;
96
97         /// the button down
98         QPushButton * downPB;
99 };
100
101 } // namespace frontend
102 } // namespace lyx
103
104 #endif // GUICOMMANDBUFFER_H