2012-09-24 19:24:27 +02:00
|
|
|
#ifndef user_interface_hh_INCLUDED
|
|
|
|
#define user_interface_hh_INCLUDED
|
|
|
|
|
2014-08-12 01:30:13 +02:00
|
|
|
#include "safe_ptr.hh"
|
2014-12-16 19:57:19 +01:00
|
|
|
#include "unordered_map.hh"
|
2012-09-24 19:24:27 +02:00
|
|
|
|
2014-11-12 22:27:07 +01:00
|
|
|
#include <functional>
|
2014-11-11 00:29:16 +01:00
|
|
|
|
2012-09-24 19:24:27 +02:00
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class String;
|
2012-10-20 20:15:20 +02:00
|
|
|
class DisplayBuffer;
|
2013-04-04 18:50:00 +02:00
|
|
|
class DisplayLine;
|
2014-05-07 20:51:01 +02:00
|
|
|
struct CharCoord;
|
2014-11-12 22:27:07 +01:00
|
|
|
struct Face;
|
|
|
|
struct Key;
|
2015-01-06 14:40:56 +01:00
|
|
|
template<typename T> class ArrayView;
|
2012-09-30 15:18:37 +02:00
|
|
|
|
|
|
|
enum class MenuStyle
|
|
|
|
{
|
|
|
|
Prompt,
|
|
|
|
Inline
|
|
|
|
};
|
2012-09-24 19:24:27 +02:00
|
|
|
|
2014-11-08 18:59:38 +01:00
|
|
|
enum class InfoStyle
|
|
|
|
{
|
|
|
|
Prompt,
|
|
|
|
Inline,
|
2014-11-10 14:28:06 +01:00
|
|
|
InlineAbove,
|
|
|
|
InlineBelow,
|
2014-11-08 18:59:38 +01:00
|
|
|
MenuDoc
|
|
|
|
};
|
|
|
|
|
2014-11-25 02:00:18 +01:00
|
|
|
enum class EventMode;
|
|
|
|
|
|
|
|
using InputCallback = std::function<void(EventMode mode)>;
|
2013-01-11 19:17:21 +01:00
|
|
|
|
2012-09-26 14:13:04 +02:00
|
|
|
class UserInterface : public SafeCountable
|
2012-09-24 19:24:27 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~UserInterface() {}
|
2012-12-14 19:04:34 +01:00
|
|
|
|
2015-01-06 14:40:56 +01:00
|
|
|
virtual void menu_show(ArrayView<String> choices,
|
2014-07-11 01:27:04 +02:00
|
|
|
CharCoord anchor, Face fg, Face bg,
|
2013-04-04 13:53:47 +02:00
|
|
|
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
|
|
|
|
2014-04-30 20:39:52 +02:00
|
|
|
virtual void info_show(StringView title, StringView content,
|
2014-07-11 01:27:04 +02:00
|
|
|
CharCoord anchor, Face face,
|
2014-11-08 18:59:38 +01:00
|
|
|
InfoStyle style) = 0;
|
2012-12-14 19:04:34 +01:00
|
|
|
virtual void info_hide() = 0;
|
|
|
|
|
2012-10-20 20:15:20 +02:00
|
|
|
virtual void draw(const DisplayBuffer& display_buffer,
|
2013-09-16 20:15:13 +02:00
|
|
|
const DisplayLine& status_line,
|
2013-04-04 18:50:00 +02:00
|
|
|
const DisplayLine& mode_line) = 0;
|
2014-05-07 20:51:01 +02:00
|
|
|
virtual CharCoord 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
|
|
|
|
2014-04-15 20:19:44 +02:00
|
|
|
virtual void refresh() = 0;
|
|
|
|
|
2013-01-11 19:17:21 +01:00
|
|
|
virtual void set_input_callback(InputCallback callback) = 0;
|
2014-11-11 00:29:16 +01:00
|
|
|
|
2015-01-14 20:16:32 +01:00
|
|
|
using Options = UnorderedMap<String, String, MemoryDomain::Options>;
|
2014-11-11 00:29:16 +01:00
|
|
|
virtual void set_ui_options(const Options& options) = 0;
|
2012-09-24 19:24:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // user_interface_hh_INCLUDED
|