1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-20 10:01:57 +03:00
kakoune/src/client_manager.hh

53 lines
1.4 KiB
C++
Raw Normal View History

#ifndef client_manager_hh_INCLUDED
#define client_manager_hh_INCLUDED
#include "context.hh"
#include "input_handler.hh"
namespace Kakoune
{
struct client_removed{};
class ClientManager : public Singleton<ClientManager>
{
public:
2012-10-31 17:23:44 +04:00
void create_client(std::unique_ptr<UserInterface>&& ui,
int event_fd, const String& init_cmd);
bool empty() const { return m_clients.empty(); }
size_t count() const { return m_clients.size(); }
2012-10-31 17:23:44 +04:00
Window& get_unused_window_for_buffer(Buffer& buffer);
void ensure_no_client_uses_buffer(Buffer& buffer);
void redraw_clients() const;
void set_client_name(Context& context, String name);
Context& get_client_context(const String& name);
private:
void remove_client_by_context(Context& context);
2012-10-31 17:23:44 +04:00
struct Client
{
Client(std::unique_ptr<UserInterface>&& ui, Window& window)
: user_interface(std::move(ui)),
context(input_handler, window, *user_interface) {}
Client(Client&&) = delete;
Client& operator=(Client&& other) = delete;
2012-10-31 17:23:44 +04:00
std::unique_ptr<UserInterface> user_interface;
InputHandler input_handler;
Context context;
String name;
2012-10-31 17:23:44 +04:00
};
std::vector<std::unique_ptr<Client>> m_clients;
std::vector<std::unique_ptr<Window>> m_windows;
};
}
#endif // client_manager_hh_INCLUDED