1 #ifndef BLANK_UI_TEXTINPUT_HPP_
2 #define BLANK_UI_TEXTINPUT_HPP_
5 #include "../graphics/PrimitiveMesh.hpp"
18 explicit TextInput(const Font &);
20 const std::string &GetInput() const noexcept { return input; }
22 void Focus(Viewport &) noexcept;
25 void Clear() noexcept;
26 void Backspace() noexcept;
27 void Delete() noexcept;
29 void MoveBegin() noexcept;
30 void MoveBackward() noexcept;
31 void MoveForward() noexcept;
32 void MoveEnd() noexcept;
34 void Insert(const char *);
36 bool AtBegin() const noexcept;
37 bool AtEnd() const noexcept;
39 void Position(const glm::vec3 &p, Gravity g, Gravity pv) noexcept;
40 void Width(float) noexcept;
42 void Foreground(const PrimitiveMesh::Color &col) noexcept { fg = col; dirty_cursor = true; }
43 void Background(const PrimitiveMesh::Color &col) noexcept { bg = col; dirty_box = true; }
45 void Handle(const SDL_TextInputEvent &);
46 void Handle(const SDL_TextEditingEvent &);
48 void Render(Viewport &);
56 std::string::size_type cursor;
59 PrimitiveMesh bg_mesh;
60 PrimitiveMesh cursor_mesh;
62 PrimitiveMesh::Color bg;
63 PrimitiveMesh::Color fg;