home/src/client.hh
2012-09-26 20:07:06 +02:00

51 lines
1.0 KiB
C++

#ifndef client_hh_INCLUDED
#define client_hh_INCLUDED
#include "keys.hh"
#include "completion.hh"
#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&)>;
class ClientMode;
enum class InsertMode : unsigned;
class Client : public SafeCountable
{
public:
Client();
~Client();
void insert(Context& context, InsertMode mode);
void repeat_last_insert(Context& context);
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:
friend class ClientMode;
std::unique_ptr<ClientMode> m_mode;
};
struct prompt_aborted {};
}
#endif // client_hh_INCLUDED