2012-09-24 19:24:27 +02:00
|
|
|
#ifndef user_interface_hh_INCLUDED
|
|
|
|
#define user_interface_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "memoryview.hh"
|
|
|
|
#include "keys.hh"
|
|
|
|
#include "units.hh"
|
2012-09-26 14:13:04 +02:00
|
|
|
#include "utils.hh"
|
2013-04-04 13:53:47 +02:00
|
|
|
#include "color.hh"
|
2012-09-24 19:24:27 +02:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class String;
|
2012-10-20 20:15:20 +02:00
|
|
|
class DisplayBuffer;
|
2013-02-18 14:00:43 +01:00
|
|
|
struct DisplayCoord;
|
2012-09-30 15:18:37 +02:00
|
|
|
|
|
|
|
enum class MenuStyle
|
|
|
|
{
|
|
|
|
Prompt,
|
|
|
|
Inline
|
|
|
|
};
|
2012-09-24 19:24:27 +02:00
|
|
|
|
2013-01-11 19:17:21 +01:00
|
|
|
using InputCallback = std::function<void()>;
|
|
|
|
|
2012-09-26 14:13:04 +02:00
|
|
|
class UserInterface : public SafeCountable
|
2012-09-24 19:24:27 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~UserInterface() {}
|
2012-09-24 19:39:40 +02:00
|
|
|
virtual void print_status(const String& status, CharCount cursor_pos = -1) = 0;
|
2012-12-14 19:04:34 +01:00
|
|
|
|
2012-09-30 15:18:37 +02:00
|
|
|
virtual void menu_show(const memoryview<String>& choices,
|
2013-04-04 13:53:47 +02:00
|
|
|
DisplayCoord anchor, ColorPair fg, ColorPair bg,
|
|
|
|
MenuStyle style) = 0;
|
2012-09-24 19:24:27 +02:00
|
|
|
virtual void menu_select(int selected) = 0;
|
|
|
|
virtual void menu_hide() = 0;
|
2012-12-14 19:04:34 +01:00
|
|
|
|
|
|
|
virtual void info_show(const String& content,
|
|
|
|
const DisplayCoord& anchor, MenuStyle style) = 0;
|
|
|
|
virtual void info_hide() = 0;
|
|
|
|
|
2012-10-20 20:15:20 +02:00
|
|
|
virtual void draw(const DisplayBuffer& display_buffer,
|
2012-10-29 19:01:57 +01:00
|
|
|
const String& mode_line) = 0;
|
2012-10-20 20:15:20 +02:00
|
|
|
virtual DisplayCoord dimensions() = 0;
|
2012-10-28 09:26:54 +01:00
|
|
|
virtual bool is_key_available() = 0;
|
2012-09-24 19:24:27 +02:00
|
|
|
virtual Key get_key() = 0;
|
2013-01-11 19:17:21 +01:00
|
|
|
|
|
|
|
virtual void set_input_callback(InputCallback callback) = 0;
|
2012-09-24 19:24:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // user_interface_hh_INCLUDED
|