29 struct builder_styled_widget;
55 virtual void set_active(
const bool active)
override;
58 virtual bool get_active()
const override;
61 virtual unsigned get_state()
const override;
65 void set_maximum_length(
const std::size_t maximum_length);
69 return text_.get_length();
80 virtual void set_value(
const std::string& text);
86 const std::string&
text()
const 93 std::function<
void(
text_box_base* textbox,
const std::string text)> cb)
95 text_changed_callback_ = cb;
118 void set_selection(std::size_t
start,
int length);
122 size_t get_composition_length()
const;
130 virtual void goto_end_of_line(
const bool select =
false) = 0;
142 set_cursor(text_.get_length(), select);
151 virtual void goto_start_of_line(
const bool select =
false) = 0;
161 set_cursor(0, select);
167 selection_start_ = 0;
168 goto_end_of_data(
true);
178 void set_cursor(
const std::size_t offset,
const bool select);
188 virtual void insert_char(
const std::string& unicode);
197 virtual void delete_char(
const bool before_cursor) = 0;
200 virtual void delete_selection() = 0;
203 virtual void copy_selection(
const bool mouse);
206 virtual void paste_selection(
const bool mouse);
211 const unsigned line = 0)
const 213 return text_.get_cursor_position(column, line);
218 return text_.get_column_line(position);
223 text_.set_font_size(font_size);
228 text_.set_font_style(font_style);
233 text_.set_maximum_width(width);
238 text_.set_maximum_height(height, multiline);
243 text_.set_ellipse_mode(ellipse_mode);
250 return selection_start_;
252 void set_selection_start(
const std::size_t selection_start);
256 return selection_length_;
258 void set_selection_length(
const int selection_length);
262 return ime_start_point_;
268 return ime_composing_;
271 void interrupt_composition();
283 void set_state(
const state_t state);
285 virtual void toggle_cursor_timer(
bool enable);
288 virtual void cursor_timer_callback();
290 virtual void reset_cursor_state();
292 void update_mouse_cursor(
bool enable);
361 virtual void handle_key_up_arrow(SDL_Keymod modifier,
bool& handled) = 0;
368 virtual void handle_key_down_arrow(SDL_Keymod modifier,
bool& handled) = 0;
378 virtual void handle_key_clear_line(SDL_Keymod modifier,
bool& handled) = 0;
389 virtual void handle_key_left_arrow(SDL_Keymod modifier,
bool& handled);
400 virtual void handle_key_right_arrow(SDL_Keymod modifier,
bool& handled);
412 virtual void handle_key_home(SDL_Keymod modifier,
bool& handled);
422 virtual void handle_key_end(SDL_Keymod modifier,
bool& handled);
433 virtual void handle_key_backspace(SDL_Keymod modifier,
bool& handled);
447 virtual void handle_key_delete(SDL_Keymod modifier,
bool& handled);
486 virtual void handle_commit(
bool& handled,
487 const std::string& unicode);
488 virtual void handle_editing(
bool& handled,
489 const std::string& unicode,
502 std::function<void(text_box_base* textbox, const std::string text)>
512 const SDL_Keycode key,
513 SDL_Keymod modifier);
517 const std::string& unicode,
521 void signal_handler_receive_keyboard_focus(
const event::ui_event event);
524 void signal_handler_mouse_enter(
const event::ui_event event,
bool& handled);
525 void signal_handler_mouse_leave(
const event::ui_event event,
bool& handled);
bool is_composing() const
virtual void handle_key_tab(SDL_Keymod, bool &)
Tab key.
state_t
Note the order of the states must be the same as defined in settings.hpp.
void select_all()
Selects all text.
void set_text_changed_callback(std::function< void(text_box_base *textbox, const std::string text)> cb)
Set the text_changed callback.
Abstract base class for text items.
std::size_t cursor_timer_
point get_column_line(const point &position) const
std::string get_value() const
void goto_start_of_data(const bool select=false)
Moves the cursor to the beginning of the data.
unsigned short cursor_blink_rate_ms_
std::size_t get_selection_length() const
void goto_end_of_data(const bool select=false)
Moves the cursor to the end of all text.
void set_font_style(const font::pango_text::FONT_STYLE font_style)
void set_maximum_width(const int width)
std::size_t selection_start_
Start of the selected text.
unsigned short cursor_alpha_
std::string text_cached_
Cached version of the text without any pending IME modifications.
std::size_t get_composition_start() const
std::function< void(text_box_base *textbox, const std::string text)> text_changed_callback_
Text changed callback.
int selection_length_
Length of the selected text.
virtual void handle_key_page_down(SDL_Keymod, bool &)
Page down key.
point get_cursor_position(const unsigned column, const unsigned line=0) const
void set_font_size(const unsigned font_size)
void set_ellipse_mode(const PangoEllipsizeMode ellipse_mode)
virtual void handle_key_page_up(SDL_Keymod, bool &)
Page up key.
std::size_t get_length() const
font::pango_text text_
The text entered in the widget.
state_t state_
Current state of the widget.
const std::string & text() const
void set_maximum_height(const int height, const bool multiline)
EXIT_STATUS start(const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
std::size_t get_selection_start() const
Contains the implementation details for lexical_cast and shouldn't be used directly.
ui_event
The event send to the dispatcher.