15 #ifndef GUI_WIDGETS_TEXT_HPP_INCLUDED
16 #define GUI_WIDGETS_TEXT_HPP_INCLUDED
20 #include "../../text.hpp"
50 virtual void set_active(
const bool active)
override;
56 virtual unsigned get_state()
const override;
167 virtual void delete_char(
const bool before_cursor) = 0;
181 const unsigned line = 0)
const
437 std::function<void(ttext_* textbox, const std::string text)>
void set_selection_length(const int selection_length)
virtual void delete_char(const bool before_cursor)=0
Deletes the character.
virtual void delete_selection()=0
Deletes the current selection.
font::ttext text_
The text entered in the widget.
virtual void handle_key_left_arrow(SDLMod modifier, bool &handled)
Left arrow key pressed.
int selection_length_
Length of the selected text.
virtual void handle_key_end(SDLMod modifier, bool &handled)
End key pressed.
void set_font_size(const unsigned font_size)
void set_ellipse_mode(const PangoEllipsizeMode ellipse_mode)
const std::string & text() const
virtual void set_active(const bool active) override
See tcontrol::set_active.
ttext & set_font_style(const unsigned font_style)
void set_font_style(const unsigned font_style)
virtual void paste_selection(const bool mouse)
Pastes the current selection.
void set_maximum_width(const int width)
tstate
Note the order of the states must be the same as defined in settings.hpp.
void signal_handler_lose_keyboard_focus(const event::tevent event)
void signal_handler_sdl_key_down(const event::tevent event, bool &handled, const SDLKey key, SDLMod modifier, const utf8::string &unicode)
ttext & set_font_size(const unsigned font_size)
gui2::tpoint get_column_line(const gui2::tpoint &position) const
Gets the column of line of the character at the position.
ttext & set_maximum_width(int width)
virtual void handle_key_right_arrow(SDLMod modifier, bool &handled)
Right arrow key pressed.
std::string get_value() const
size_t get_selection_start() const
void select_all()
Selects all text.
virtual void set_value(const std::string &text)
The set_value is virtual for the tpassword_box class.
tpoint get_column_line(const tpoint &position) const
std::function< void(ttext_ *textbox, const std::string text)> text_changed_callback_
Text changed callback.
A class inherited from ttext_box that displays its input as stars.
virtual void handle_key_backspace(SDLMod modifier, bool &handled)
Backspace key pressed.
void goto_end_of_data(const bool select=false)
Moves the cursor to the end of all text.
virtual void insert_char(const utf8::string &unicode)
Inserts a character at the cursor.
tstate state_
Current state of the widget.
size_t selection_start_
Start of the selected text.
void goto_start_of_data(const bool select=false)
Moves the cursor to the beginning of the data.
virtual void handle_key_clear_line(SDLMod modifier, bool &handled)=0
Clears the current line.
ttext & set_maximum_height(int height, bool multiline)
size_t get_length() const
Gets the length of the text in characters.
size_t get_length() const
gui2::tpoint get_cursor_position(const unsigned column, const unsigned line=0) const
Gets the location for the cursor.
virtual void handle_key_up_arrow(SDLMod modifier, bool &handled)=0
Every key can have several behaviors.
tevent
The event send to the dispatcher.
virtual void handle_key_delete(SDLMod modifier, bool &handled)
Delete key pressed.
virtual unsigned get_state() const override
See tcontrol::get_state.
GLenum GLenum GLvoid GLvoid * column
virtual void handle_key_down_arrow(SDLMod modifier, bool &handled)=0
Down arrow key pressed.
virtual void goto_start_of_line(const bool select=false)=0
Moves the cursor to the beginning of the line.
virtual void handle_key_default(bool &handled, SDLKey key, SDLMod modifier, const utf8::string &unicode)
Default key handler if none of the above functions is called.
size_t get_selection_length() const
void signal_handler_receive_keyboard_focus(const event::tevent event)
virtual void handle_key_page_down(SDLMod, bool &)
Page down key.
virtual void handle_key_home(SDLMod modifier, bool &handled)
Home key pressed.
virtual void handle_key_page_up(SDLMod, bool &)
Page up key.
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Base class for all visible items.
void set_selection_start(const size_t selection_start)
void signal_handler_middle_button_click(const event::tevent event, bool &handled)
gui2::tpoint get_cursor_position(const unsigned column, const unsigned line=0) const
void set_maximum_length(const size_t maximum_length)
GLint GLint GLint GLint GLint GLint GLsizei width
virtual bool get_active() const override
See tcontrol::get_active.
const std::string & text() const
virtual void goto_end_of_line(const bool select=false)=0
Moves the cursor to the end of the line.
void set_state(const tstate state)
virtual void copy_selection(const bool mouse)
Copies the current selection.
GLsizei const GLcharARB ** string
Abstract base class for text items.
ttext & set_ellipse_mode(const PangoEllipsizeMode ellipse_mode)
void set_cursor(const size_t offset, const bool select)
Moves the cursor at the wanted position.
void set_text_changed_callback(std::function< void(ttext_ *textbox, const std::string text)> cb)
Set the text_changed callback.
void set_maximum_height(const int height, const bool multiline)