#ifndef TEXT_INPUT_H
#define TEXT_INPUT_H

#include "utils/List.h"

class TextInput final {
    List<uint32> input;
    int cursor;
    int limit;
    bool active;

public:
    TextInput();

    void setLimit(int limit);
    void reset();
    void setActive(bool b);
    void onKeyEvent(int key, int scancode, int action, int mods);
    void onCharEvent(uint32);
    void fill(const char* s);

    template<int N>
    void toString(StringBuffer<N>& s) const {
        for(unsigned int c : input) {
            s.appendUnicode(c);
        }
    }

    int getCursor() const;
};

#endif