2002-07-19 20:56:31 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file ControlCommandBuffer.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-07-19 20:56:31 +00:00
|
|
|
*
|
|
|
|
* \author Lars
|
|
|
|
* \author Asger and Juergen
|
2002-10-21 17:38:09 +00:00
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-07-19 20:56:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONTROLCOMMANDBUFFER_H
|
|
|
|
#define CONTROLCOMMANDBUFFER_H
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
2003-04-02 09:23:24 +00:00
|
|
|
class LyXView;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ControlCommandBuffer
|
|
|
|
*
|
|
|
|
* This provides methods for the use of a toolkit's
|
2002-10-21 17:38:09 +00:00
|
|
|
* minibuffer/command buffer
|
2002-07-19 20:56:31 +00:00
|
|
|
*/
|
|
|
|
class ControlCommandBuffer {
|
|
|
|
public:
|
2003-04-02 09:23:24 +00:00
|
|
|
ControlCommandBuffer(LyXView & lv);
|
2002-10-21 17:38:09 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// return the previous history entry if any
|
|
|
|
string const historyUp();
|
|
|
|
|
|
|
|
/// return the next history entry if any
|
|
|
|
string const historyDown();
|
|
|
|
|
2003-04-02 09:23:24 +00:00
|
|
|
/// return the font and depth in the active BufferView as a message.
|
|
|
|
string const getCurrentState() const;
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// return the possible completions
|
2002-10-21 17:38:09 +00:00
|
|
|
std::vector<string> const completions(string const & prefix,
|
|
|
|
string & new_prefix);
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// dispatch a command
|
|
|
|
void dispatch(string const & str);
|
|
|
|
private:
|
2003-04-02 09:23:24 +00:00
|
|
|
/// controlling LyXView
|
|
|
|
LyXView & lv_;
|
2002-10-21 17:38:09 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// available command names
|
|
|
|
std::vector<string> commands_;
|
2002-10-21 17:38:09 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// command history
|
|
|
|
std::vector<string> history_;
|
|
|
|
|
|
|
|
/// current position in command history
|
|
|
|
std::vector<string>::const_iterator history_pos_;
|
|
|
|
};
|
2002-10-21 17:38:09 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
#endif // CONTROLCOMMANDBUFFER_H
|