home/src/client_manager.hh

59 lines
1.4 KiB
C++
Raw Normal View History

#ifndef client_manager_hh_INCLUDED
#define client_manager_hh_INCLUDED
2013-09-12 23:47:23 +02:00
#include "client.hh"
#include "completion.hh"
namespace Kakoune
{
struct client_removed{};
2014-01-27 21:28:38 +01:00
struct WindowAndSelections
{
std::unique_ptr<Window> window;
SelectionList selections;
size_t timestamp;
2014-01-27 21:28:38 +01:00
};
class ClientManager : public Singleton<ClientManager>
{
public:
ClientManager();
~ClientManager();
2013-09-12 23:47:23 +02:00
Client* create_client(std::unique_ptr<UserInterface>&& ui,
EnvVarMap env_vars, StringView init_cmd);
bool empty() const { return m_clients.empty(); }
size_t count() const { return m_clients.size(); }
2012-10-31 14:23:44 +01:00
void ensure_no_client_uses_buffer(Buffer& buffer);
WindowAndSelections get_free_window(Buffer& buffer);
void add_free_window(std::unique_ptr<Window>&& window, SelectionList selections);
void redraw_clients() const;
void clear_mode_trashes() const;
void handle_available_inputs() const;
Client* get_client_ifp(StringView name);
Client& get_client(StringView name);
bool validate_client_name(StringView name) const;
2013-09-12 23:47:23 +02:00
void remove_client(Client& client);
CandidateList complete_client_name(StringView name,
ByteCount cursor_pos = -1) const;
private:
String generate_name() const;
2013-09-12 23:47:23 +02:00
std::vector<std::unique_ptr<Client>> m_clients;
std::vector<WindowAndSelections> m_free_windows;
};
}
#endif // client_manager_hh_INCLUDED