TextInput.h 531 B

1234567891011121314151617181920212223242526272829
  1. #ifndef TEXT_INPUT_H
  2. #define TEXT_INPUT_H
  3. #include "utils/List.h"
  4. class TextInput final {
  5. List<unsigned int> input;
  6. int cursor;
  7. bool active;
  8. public:
  9. TextInput();
  10. void reset();
  11. void setActive(bool b);
  12. void onKeyEvent(int key, int scancode, int action, int mods);
  13. void onCharEvent(unsigned int codepoint);
  14. template<int N>
  15. void toString(StringBuffer<N>& s) const {
  16. for(unsigned int c : input) {
  17. s.appendUnicode(c);
  18. }
  19. }
  20. int getCursor() const;
  21. };
  22. #endif