2016-03-06 02:37:20 +01:00
|
|
|
#ifndef json_ui_hh_INCLUDED
|
|
|
|
#define json_ui_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "user_interface.hh"
|
|
|
|
#include "event_manager.hh"
|
|
|
|
#include "coord.hh"
|
2017-03-07 02:12:37 +01:00
|
|
|
#include "string.hh"
|
2016-03-06 02:37:20 +01:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2016-03-14 14:38:46 +01:00
|
|
|
struct Value;
|
2016-03-06 02:37:20 +01:00
|
|
|
|
|
|
|
class JsonUI : public UserInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
JsonUI();
|
|
|
|
|
|
|
|
JsonUI(const JsonUI&) = delete;
|
|
|
|
JsonUI& operator=(const JsonUI&) = delete;
|
|
|
|
|
|
|
|
void draw(const DisplayBuffer& display_buffer,
|
2016-04-11 14:44:10 +02:00
|
|
|
const Face& default_face,
|
|
|
|
const Face& buffer_padding) override;
|
2016-03-06 02:37:20 +01:00
|
|
|
|
|
|
|
void draw_status(const DisplayLine& status_line,
|
|
|
|
const DisplayLine& mode_line,
|
|
|
|
const Face& default_face) override;
|
|
|
|
|
|
|
|
void menu_show(ConstArrayView<DisplayLine> items,
|
2016-09-22 21:36:26 +02:00
|
|
|
DisplayCoord anchor, Face fg, Face bg,
|
2016-03-06 02:37:20 +01:00
|
|
|
MenuStyle style) override;
|
|
|
|
void menu_select(int selected) override;
|
|
|
|
void menu_hide() override;
|
|
|
|
|
|
|
|
void info_show(StringView title, StringView content,
|
2016-09-22 21:36:26 +02:00
|
|
|
DisplayCoord anchor, Face face,
|
2016-03-06 02:37:20 +01:00
|
|
|
InfoStyle style) override;
|
|
|
|
void info_hide() override;
|
|
|
|
|
2016-03-07 14:54:20 +01:00
|
|
|
void refresh(bool force) override;
|
2016-03-06 02:37:20 +01:00
|
|
|
|
2016-09-22 21:36:26 +02:00
|
|
|
DisplayCoord dimensions() override;
|
2016-11-29 22:35:53 +01:00
|
|
|
void set_on_key(OnKeyCallback callback) override;
|
|
|
|
void set_ui_options(const Options& options) override;
|
2016-03-06 02:37:20 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void parse_requests(EventMode mode);
|
|
|
|
void eval_json(const Value& value);
|
|
|
|
|
|
|
|
FDWatcher m_stdin_watcher;
|
2016-11-29 22:35:53 +01:00
|
|
|
OnKeyCallback m_on_key;
|
2016-11-28 14:59:55 +01:00
|
|
|
Vector<Key, MemoryDomain::Client> m_pending_keys;
|
2016-09-22 21:36:26 +02:00
|
|
|
DisplayCoord m_dimensions;
|
2016-03-06 15:23:56 +01:00
|
|
|
String m_requests;
|
2016-03-06 02:37:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // json_ui_hh_INCLUDED
|