18 #ifndef HEADER_SUPERTUX_GUI_ITEM_TEXTFIELD_HPP 19 #define HEADER_SUPERTUX_GUI_ITEM_TEXTFIELD_HPP 21 #include "gui/menu_item.hpp" 26 ItemTextField(
const std::string& text_, std::string* input_,
int id_ = -1);
29 virtual void draw(
DrawingContext&,
const Vector& pos,
int menu_width,
bool active)
override;
39 void change_input(
const std::string& input_) {
49 virtual void event(
const SDL_Event& ev)
override;
64 virtual void insert_text(
const std::string& text,
const int left_offset_pos);
66 virtual void go_left();
67 virtual void go_right();
68 virtual void go_to_beginning();
69 virtual void go_to_end();
70 virtual void delete_front();
71 virtual void delete_back();
79 std::string m_input_undo;
80 std::string m_input_redo;
82 const std::string m_cursor;
84 int m_cursor_left_offset;
virtual void process_action(const MenuAction &action) override
Processes the menu action.
Definition: item_textfield.cpp:122
virtual void event(const SDL_Event &ev) override
Processes the given event.
Definition: item_textfield.cpp:75
virtual void draw(DrawingContext &, const Vector &pos, int menu_width, bool active) override
Draws the menu item.
Definition: item_textfield.cpp:40
Definition: item_textfield.hpp:23
virtual void on_input_update()
Calls when the input gets updated.
Definition: item_textfield.hpp:60
virtual bool changes_width() const override
Indicates that this item changes its width.
Definition: item_textfield.hpp:52
virtual void update_undo()
Updates undo and redo status.
Definition: item_textfield.cpp:139
virtual void invalid_remove()
Calls when the user wants to remove an invalid char.
Definition: item_textfield.hpp:46
virtual int get_width() const override
Returns the minimum width of the menu item.
Definition: item_textfield.cpp:69
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42