2012-10-23 22:55:44 +02:00
|
|
|
#ifndef remote_hh_INCLUDED
|
|
|
|
#define remote_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "user_interface.hh"
|
|
|
|
#include "display_buffer.hh"
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2012-10-30 14:00:44 +01:00
|
|
|
struct peer_disconnected {};
|
2012-10-26 13:45:32 +02:00
|
|
|
|
2012-10-23 22:55:44 +02:00
|
|
|
class RemoteUI : public UserInterface
|
|
|
|
{
|
|
|
|
public:
|
2012-11-19 19:06:32 +01:00
|
|
|
RemoteUI(int socket);
|
|
|
|
~RemoteUI();
|
2012-10-23 22:55:44 +02:00
|
|
|
|
|
|
|
void print_status(const String& status, CharCount cursor_pos) override;
|
2012-12-14 19:04:34 +01:00
|
|
|
|
2012-10-23 22:55:44 +02:00
|
|
|
void menu_show(const memoryview<String>& choices,
|
|
|
|
const DisplayCoord& anchor, MenuStyle style) override;
|
|
|
|
void menu_select(int selected) override;
|
|
|
|
void menu_hide() override;
|
2012-12-14 19:04:34 +01:00
|
|
|
|
|
|
|
void info_show(const String& content,
|
|
|
|
const DisplayCoord& anchor, MenuStyle style) override;
|
|
|
|
void info_hide() override;
|
|
|
|
|
2012-10-23 22:55:44 +02:00
|
|
|
void draw(const DisplayBuffer& display_buffer,
|
2012-10-29 19:01:57 +01:00
|
|
|
const String& mode_line) override;
|
2012-10-28 09:26:54 +01:00
|
|
|
|
|
|
|
bool is_key_available() override;
|
2012-10-23 22:55:44 +02:00
|
|
|
Key get_key() override;
|
|
|
|
DisplayCoord dimensions() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_socket;
|
|
|
|
DisplayCoord m_dimensions;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RemoteClient
|
|
|
|
{
|
|
|
|
public:
|
2012-10-25 12:51:01 +02:00
|
|
|
RemoteClient(int socket, UserInterface* ui);
|
2012-10-23 22:55:44 +02:00
|
|
|
|
|
|
|
void process_next_message();
|
|
|
|
void write_next_key();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_socket;
|
|
|
|
std::unique_ptr<UserInterface> m_ui;
|
2012-10-26 16:14:51 +02:00
|
|
|
DisplayCoord m_dimensions;
|
2012-10-23 22:55:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // remote_hh_INCLUDED
|
|
|
|
|