kakoune/src/input_handler.hh

51 lines
1.1 KiB
C++
Raw Normal View History

2012-10-17 13:14:03 +02:00
#ifndef input_handler_hh_INCLUDED
#define input_handler_hh_INCLUDED
#include "keys.hh"
#include "completion.hh"
2012-08-15 22:36:45 +02:00
#include "utils.hh"
#include "string.hh"
namespace Kakoune
{
class Editor;
class Context;
using MenuCallback = std::function<void (int, Context&)>;
using PromptCallback = std::function<void (const String&, Context&)>;
using KeyCallback = std::function<void (const Key&, Context&)>;
2012-10-17 13:14:03 +02:00
class InputMode;
enum class InsertMode : unsigned;
2012-09-24 19:39:40 +02:00
2012-10-17 13:14:03 +02:00
class InputHandler : public SafeCountable
{
public:
2012-10-17 13:14:03 +02:00
InputHandler();
~InputHandler();
void insert(Context& context, InsertMode mode);
void repeat_last_insert(Context& context);
2012-09-05 14:27:14 +02:00
void prompt(const String& prompt, Completer completer,
PromptCallback callback, Context& context);
void menu(const memoryview<String>& choices,
MenuCallback callback, Context& context);
void on_next_key(KeyCallback callback);
void handle_next_input(Context& context);
private:
2012-10-17 13:14:03 +02:00
friend class InputMode;
std::unique_ptr<InputMode> m_mode;
};
struct prompt_aborted {};
}
2012-10-17 13:14:03 +02:00
#endif // input_handler_hh_INCLUDED