#pragma once

#include "GuiWidget.h"
#include "client/Client.h"
#include <string>
#include <vector>

namespace blitz {

namespace gui {

class GameChatGui : public GuiWidget, game::ClientListener {
  private:
	char InputBuf[256];
	std::vector<protocol::ColoredText> m_Lines;
	std::vector<protocol::ColoredText> m_TempLines;
	bool m_FocusRequested = false;
	int HistoryPos;	 // -1: new line, 0..History.Size-1 browsing history.
	bool ScrollToBottom = false;
	bool AutoScroll = true;
	float m_ChatDisplay = 0;


	void Draw(const char* title, bool* p_open);
	void DrawMini(const char* title, bool* p_open);

  public:
	GameChatGui(GuiWidget* parent, Client* client);

	virtual void OnTextChatReceived(const protocol::ColoredText& text) override;

	virtual void Render() override;
};

}  // namespace gui
}  // namespace blitz
