#pragma once #include "StringView.hpp" #include "Text.hpp" #include "Cache.hpp" #include #include #include #include #include #include namespace dchat { class Channel; class Chatbar { public: Chatbar(); bool isFocused() const; void processEvent(const sf::Event &event, Cache &cache, Channel *channel); void draw(sf::RenderWindow &window, Cache &cache); static sf::Vector2f getInputPosition(sf::RenderWindow &window); static sf::Vector2f getInputSize(sf::RenderWindow &window); static float getHeight(); static bool addBind(const std::string &key, const std::string &value, bool updateFile = true); static bool removeBind(const std::string &key, bool updateFile = true); static const std::unordered_map& getBinds(); private: void processChatCommand(const StringView &cmd); private: Text text; sf::RectangleShape background; sf::RectangleShape inputBackground; bool focused; }; }