24 struct builder_text_box;
61 void push(
const std::string& text);
72 std::string up(
const std::string& text =
"");
83 std::string down(
const std::string& text =
"");
92 std::string get_value()
const;
107 : history_(history), pos_(history->
size()), enabled_(enabled)
151 history_.push(get_value());
163 max_input_length_ = length;
183 virtual void place(
const point& origin,
const point&
size)
override;
188 virtual void update_canvas()
override;
193 goto_end_of_data(select);
199 goto_start_of_data(select);
203 void delete_char(
const bool before_cursor)
override;
206 void delete_selection()
override;
208 void handle_mouse_selection(
point mouse,
const bool start_selection);
240 void update_offsets();
290 void handle_key_tab(SDL_Keymod modifier,
bool& handled)
override;
293 void handle_key_clear_line(SDL_Keymod modifier,
bool& handled)
override;
297 static const std::string&
type();
301 virtual const std::string& get_control_type()
const override;
315 void signal_handler_left_button_double_click(
const event::ui_event event,
346 virtual std::unique_ptr<widget>
build()
const override;
Base class of a resolution, contains the common keys for a resolution.
void set_history(const std::string &id)
Abstract base class for text items.
ui_event
The event sent to the dispatcher.
unsigned pos_
The current position in the history.
void set_hint_data(const std::string &text, const std::string &image)
std::size_t max_input_length_
The maximum length of the text input.
void save_to_history()
Saves the text in the widget to the history.
void handle_key_down_arrow(SDL_Keymod, bool &) override
Inherited from text_box_base.
void set_max_input_length(const std::size_t length)
bool dragging_
Is the mouse in dragging mode, this affects selection in mouse move.
static text_history get_history(const std::string &id, const bool enabled)
Gets history that matches id.
Class for a single line text area.
void goto_start_of_line(const bool select=false) override
Inherited from text_box_base.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
text_history(std::vector< std::string > *history, const bool enabled)
void set_enabled(bool enabled=true)
typed_formula< unsigned > text_x_offset
unsigned text_height_
The height of the text itself.
bool enabled_
Is the history enabled.
Class for text input history.
void goto_end_of_line(const bool select=false) override
Inherited from text_box_base.
std::vector< std::string > * get_history(const std::string &id)
Returns a pointer to the history vector associated with given id making a new one if it doesn't exist...
std::vector< std::string > * history_
The items in the history.
unsigned text_y_offset_
The y offset in the widget where the text starts.
unsigned text_x_offset_
The x offset in the widget where the text starts.
Functions to load and save images from/to disk.
std::string hint_image_
Image (such as a magnifying glass) that accompanies the help text.
std::size_t max_input_length
void handle_key_up_arrow(SDL_Keymod, bool &) override
Inherited from text_box_base.
std::unique_ptr< window > build(const builder_window::window_resolution &definition)
Builds a window.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
text_history history_
The history text for this widget.
typed_formula< unsigned > text_y_offset
A config object defines a single node in a WML file, with access to child nodes.
std::string hint_text_
Helper text to display (such as "Search") if the text box is empty.
Contains the implementation details for lexical_cast and shouldn't be used directly.