#pragma once #include "Panel.hpp" #include "Label.hpp" class Font; class ActionsHistory; namespace gui { struct TextBoxLineLayout { size_t start = 0; std::wstring text; glm::vec2 pos {0}; std::vector advances; }; struct TextBoxLayout { bool ready = false; std::string font; int lineHeight = 0; int textHeight = 0; glm::vec4 caret {0}; std::vector selection; std::vector lines; }; class TextBoxHistorian; class TextBox final : public Container { const Input& inputEvents; LabelCache rawTextCache; std::shared_ptr history; std::unique_ptr historian; int editedHistorySize = 0; protected: glm::vec4 focusedColor {0.0f, 0.0f, 0.0f, 1.0f}; glm::vec4 invalidColor {0.1f, 0.05f, 0.03f, 1.0f}; glm::vec4 textColor {1.0f, 1.0f, 1.0f, 1.0f}; glm::vec4 padding {2}; std::shared_ptr