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 =
"");
213 void delete_char(
const bool before_cursor)
override;
307 static const std::string&
type();
356 virtual std::unique_ptr<widget>
build()
const override;
A config object defines a single node in a WML file, with access to child nodes.
Abstract base class for text items.
std::string get_value() const
const std::string & text() const
virtual void set_value(const std::string &text)
The set_value is virtual for the password_box class.
virtual void goto_end_of_data(const bool select=false)
Moves the cursor to the end of all text.
virtual void goto_start_of_data(const bool select=false)
Moves the cursor to the beginning of the data.
A widget that allows the user to input text in single line.
std::string get_hint_image() const
virtual void place(const point &origin, const point &size) override
See widget::place.
std::size_t max_input_length_
The maximum length of the text input.
void handle_key_clear_line(SDL_Keymod modifier, bool &handled) override
Inherited from text_box_base.
text_history history_
The history text for this widget.
static const std::string & type()
Static type getter that does not rely on the widget being constructed.
void set_hint_text(const std::string &text)
bool history_down()
Goes one item down in the history.
std::string hint_image_
Image (such as a magnifying glass) that accompanies the help text.
virtual const std::string & get_control_type() const override
Inherited from styled_widget, implemented by REGISTER_WIDGET.
void signal_handler_mouse_motion(const event::ui_event event, bool &handled, const point &coordinate)
void set_hint_image(const std::string &image)
void delete_char(const bool before_cursor) override
Inherited from text_box_base.
void goto_end_of_line(const bool select=false) override
Inherited from text_box_base.
void signal_handler_left_button_down(const event::ui_event event, bool &handled)
unsigned text_height_
The height of the text itself.
void set_max_input_length(const std::size_t length)
void handle_key_down_arrow(SDL_Keymod, bool &) override
Inherited from text_box_base.
std::string hint_text_
Helper text to display (such as "Search") if the text box is empty.
void set_history(const std::string &id)
void goto_start_of_line(const bool select=false) override
Inherited from text_box_base.
void handle_key_up_arrow(SDL_Keymod, bool &) override
Inherited from text_box_base.
bool history_up()
Goes one item up in the history.
std::size_t get_max_input_length() const
std::string get_hint_text() const
void handle_key_tab(SDL_Keymod modifier, bool &handled) override
Inherited from text_box_base.
void handle_mouse_selection(point mouse, const bool start_selection)
void signal_handler_left_button_double_click(const event::ui_event event, bool &handled)
bool dragging_
Is the mouse in dragging mode, this affects selection in mouse move.
void update_offsets()
Updates text_x_offset_ and text_y_offset_.
text_box(const implementation::builder_styled_widget &builder)
void save_to_history()
Saves the text in the widget to the history.
void delete_selection() override
Inherited from text_box_base.
void set_hint_data(const std::string &text, const std::string &image)
void signal_handler_left_button_up(const event::ui_event event, bool &handled)
unsigned text_y_offset_
The y offset in the widget where the text starts.
virtual void update_canvas() override
See styled_widget::update_canvas.
unsigned text_x_offset_
The x offset in the widget where the text starts.
Class for text input history.
text_history(std::vector< std::string > *history, const bool enabled)
static text_history get_history(const std::string &id, const bool enabled)
Gets history that matches id.
unsigned pos_
The current position in the history.
std::string get_value() const
Gets the current history value.
void set_enabled(bool enabled=true)
std::string down(const std::string &text="")
One step down in the history.
bool enabled_
Is the history enabled.
std::vector< std::string > * history_
The items in the history.
void push(const std::string &text)
Push string into the history.
std::string up(const std::string &text="")
One step up in the history.
ui_event
The event sent to the dispatcher.
Functions to load and save images from/to disk.
Contains the implementation details for lexical_cast and shouldn't be used directly.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
builder_text_box(const config &cfg)
std::size_t max_input_length
virtual std::unique_ptr< widget > build() const override
resolution(const config &cfg)
typed_formula< unsigned > text_y_offset
typed_formula< unsigned > text_x_offset
text_box_definition(const config &cfg)