#pragma once

#include "Widget.h"

#include <string>

class TextNode;

class TextBox : public Widget
{
public:
    TextBox();

    static std::unique_ptr<TextBox> Create();

    void setContent(const std::string& text);

    std::string getContent() const;

    void appendContent(const std::string& text);

    //void onPaintEvent(const PaintEvent* event) override;

    bool onMyKeyboardEvent(const KeyboardEvent* event) override;

private:
    bool isDirty() const override;
    void doPaint(const PaintEvent* event) override;

    void updateLabel(const PaintEvent* event);

    std::string mContent;
    std::unique_ptr<TextNode> mTextNode;
    bool mContentDirty{true};
    bool mCaps;
};

using TextBoxUPtr = std::unique_ptr<TextBox>;
