#include <text_box.hpp>
Public Member Functions | |
ttext_box () | |
void | set_history (const std::string &id) |
void | save_to_history () |
void | save_to_history (const std::string &text) |
Protected Member Functions | |
void | insert_char (Uint16 unicode) |
Inherited from ttext_. | |
void | delete_char (const bool before_cursor) |
Inherited from ttext_. | |
void | delete_selection () |
Inherited from ttext_. | |
void | set_canvas_text () |
Inherited from tcontrol. | |
void | set_size (const SDL_Rect &rect) |
Inherited from tcontrol.. | |
void | goto_end_of_line (const bool select=false) |
void | goto_start_of_line (const bool select=false) |
void | handle_mouse_selection (tevent_handler &event, const bool start_selection) |
Handles the selection in a mouse down or mouse move event. | |
void | mouse_left_button_down (tevent_handler &event) |
Inherited from twidget. | |
void | mouse_move (tevent_handler &event) |
Inherited from twidget. | |
void | mouse_left_button_up (tevent_handler &) |
Inherited from twidget. | |
void | mouse_left_button_double_click (tevent_handler &) |
Inherited from twidget. | |
Private Member Functions | |
void | handle_key_up_arrow (SDLMod modifier, bool &handled) |
void | handle_key_down_arrow (SDLMod modifier, bool &handled) |
void | handle_key_clear_line (SDLMod modifier, bool &handled) |
void | calculate_char_offset () |
Inherited from ttext_. | |
unsigned | get_character_offset_at (const unsigned offset) |
Gets the character at the wanted offset, everything beyond will select the last character. | |
const std::string & | get_control_type () const |
Inherited from tcontrol. | |
void | load_config_extra () |
Inherited from tcontrol. | |
void | update_offsets () |
Private Attributes | |
std::vector< unsigned > | character_offset_ |
Contains the end offset of each character in the text area. | |
ttext_history | history_ |
unsigned | text_x_offset_ |
unsigned | text_y_offset_ |
unsigned | text_height_ |
bool | dragging_ |
Is the mouse in dragging mode, this affects selection in mouse movee. |
Definition at line 67 of file text_box.hpp.
gui2::ttext_box::ttext_box | ( | ) | [inline] |
Definition at line 72 of file text_box.hpp.
References gui2::tevent_executor::set_wants_mouse_left_double_click().
void gui2::ttext_box::set_history | ( | const std::string & | id | ) | [inline] |
Definition at line 84 of file text_box.hpp.
References preferences::get_history(), and history_.
Referenced by gui2::tbuilder_text_box::build().
void gui2::ttext_box::save_to_history | ( | ) | [inline] |
Definition at line 87 of file text_box.hpp.
References history_, gui2::ttext_history::push(), and gui2::ttext_::text().
Referenced by gui2::tmp_method_selection::show(), and gui2::taddon_connect::show().
void gui2::ttext_box::save_to_history | ( | const std::string & | text | ) | [inline] |
void gui2::ttext_box::insert_char | ( | Uint16 | unicode | ) | [protected, virtual] |
Inherited from ttext_.
Helper function for text more efficient as set_text.
Inserts a character at the cursor.
Implements gui2::ttext_.
Definition at line 57 of file text_box.cpp.
References character_offset_, gui2::tcontrol::config(), delete_selection(), gui2::render_text(), gui2::ttext_::sel_start(), set_canvas_text(), gui2::ttext_::set_cursor(), gui2::twidget::set_dirty(), utils::string_to_wstring(), gui2::ttext_::text(), and utils::wstring_to_string().
void gui2::ttext_box::delete_char | ( | const bool | before_cursor | ) | [protected, virtual] |
Inherited from ttext_.
Deletes the character.
before_cursor | If true it deletes the character before the cursor (backspace) else the character after the cursor (delete). |
Implements gui2::ttext_.
Definition at line 95 of file text_box.cpp.
References delete_selection(), gui2::ttext_::sel_len(), gui2::ttext_::sel_start(), and gui2::ttext_::set_cursor().
void gui2::ttext_box::delete_selection | ( | ) | [protected, virtual] |
Inherited from ttext_.
Deletes the current selection.
Implements gui2::ttext_.
Definition at line 108 of file text_box.cpp.
References gui2::ttext_::sel_len(), gui2::ttext_::sel_start(), gui2::ttext_::set_cursor(), gui2::ttext_::set_text(), utils::string_to_wstring(), gui2::ttext_::text(), and utils::wstring_to_string().
Referenced by delete_char(), and insert_char().
void gui2::ttext_box::set_canvas_text | ( | ) | [protected, virtual] |
Inherited from tcontrol.
Reimplemented from gui2::tcontrol.
Definition at line 132 of file text_box.cpp.
References gui2::tcontrol::canvas(), character_offset_, gui2::ttext_::sel_len(), gui2::ttext_::sel_start(), gui2::tcanvas::set_variable(), gui2::ttext_::text(), text_x_offset_, and text_y_offset_.
Referenced by handle_mouse_selection(), insert_char(), and update_offsets().
void gui2::ttext_box::set_size | ( | const SDL_Rect & | rect | ) | [protected, virtual] |
Inherited from tcontrol..
Reimplemented from gui2::tcontrol.
Definition at line 172 of file text_box.cpp.
References gui2::tcontrol::set_size(), and update_offsets().
void gui2::ttext_box::goto_end_of_line | ( | const bool | select = false |
) | [inline, protected, virtual] |
Implements gui2::ttext_.
Definition at line 115 of file text_box.hpp.
References gui2::ttext_::goto_end_of_data().
void gui2::ttext_box::goto_start_of_line | ( | const bool | select = false |
) | [inline, protected, virtual] |
Implements gui2::ttext_.
Definition at line 116 of file text_box.hpp.
References gui2::ttext_::goto_start_of_data().
void gui2::ttext_box::handle_mouse_selection | ( | tevent_handler & | event, | |
const bool | start_selection | |||
) | [protected] |
Handles the selection in a mouse down or mouse move event.
Definition at line 181 of file text_box.cpp.
References dragging_, get_character_offset_at(), gui2::twidget::get_x(), gui2::twidget::get_y(), set_canvas_text(), gui2::ttext_::set_cursor(), gui2::twidget::set_dirty(), text_height_, text_x_offset_, text_y_offset_, gui2::tpoint::x, and gui2::tpoint::y.
Referenced by mouse_left_button_down(), and mouse_move().
void gui2::ttext_box::mouse_left_button_down | ( | tevent_handler & | event | ) | [protected, virtual] |
Inherited from twidget.
Reimplemented from gui2::ttext_.
Definition at line 206 of file text_box.cpp.
References DBG_G_E, and handle_mouse_selection().
void gui2::ttext_box::mouse_move | ( | tevent_handler & | event | ) | [protected, virtual] |
Inherited from twidget.
Reimplemented from gui2::ttext_.
Definition at line 214 of file text_box.cpp.
References DBG_G_E, dragging_, and handle_mouse_selection().
void gui2::ttext_box::mouse_left_button_up | ( | tevent_handler & | ) | [protected, virtual] |
Inherited from twidget.
Reimplemented from gui2::ttext_.
Definition at line 226 of file text_box.cpp.
void gui2::ttext_box::mouse_left_button_double_click | ( | tevent_handler & | ) | [protected, virtual] |
Inherited from twidget.
Reimplemented from gui2::ttext_.
Definition at line 234 of file text_box.cpp.
References DBG_G_E, and gui2::ttext_::select_all().
void gui2::ttext_box::handle_key_up_arrow | ( | SDLMod | modifier, | |
bool & | handled | |||
) | [private, virtual] |
Implements gui2::ttext_.
Definition at line 281 of file text_box.cpp.
References gui2::ttext_history::get_enabled(), history_, gui2::ttext_::set_text(), gui2::ttext_::text(), and gui2::ttext_history::up().
void gui2::ttext_box::handle_key_down_arrow | ( | SDLMod | modifier, | |
bool & | handled | |||
) | [private, virtual] |
Implements gui2::ttext_.
Definition at line 294 of file text_box.cpp.
References gui2::ttext_history::down(), gui2::ttext_history::get_enabled(), history_, gui2::ttext_::set_text(), and gui2::ttext_::text().
void gui2::ttext_box::handle_key_clear_line | ( | SDLMod | modifier, | |
bool & | handled | |||
) | [private, virtual] |
Implements gui2::ttext_.
Definition at line 274 of file text_box.cpp.
References gui2::ttext_::set_text().
void gui2::ttext_box::calculate_char_offset | ( | ) | [private, virtual] |
Inherited from ttext_.
Calculates the offsets of all chars.
Implements gui2::ttext_.
Definition at line 242 of file text_box.cpp.
References character_offset_, gui2::tcontrol::config(), font_size, gui2::render_text(), utils::string_to_wstring(), gui2::ttext_::text(), and gui2::tresolution_definition_::text_font_size.
unsigned gui2::ttext_box::get_character_offset_at | ( | const unsigned | offset | ) | [private] |
Gets the character at the wanted offset, everything beyond will select the last character.
Gets the character at the wanted offset, everything beyond will select the last character.
Definition at line 261 of file text_box.cpp.
References character_offset_, and gui2::ttext_::text().
Referenced by handle_mouse_selection().
const std::string& gui2::ttext_box::get_control_type | ( | ) | const [inline, private, virtual] |
Inherited from tcontrol.
Implements gui2::tcontrol.
Definition at line 154 of file text_box.hpp.
References type.
void gui2::ttext_box::load_config_extra | ( | ) | [private, virtual] |
Inherited from tcontrol.
Reimplemented from gui2::tcontrol.
Definition at line 303 of file text_box.cpp.
References update_offsets().
void gui2::ttext_box::update_offsets | ( | ) | [private] |
Definition at line 309 of file text_box.cpp.
References game_logic::map_formula_callable::add(), gui2::tcontrol::canvas(), gui2::tcontrol::config(), gui2::twidget::get_height(), font::get_max_height(), gui2::twidget::get_width(), set_canvas_text(), gui2::tcanvas::set_variable(), gui2::tresolution_definition_::text_font_size, text_height_, gui2::ttext_box_definition::tresolution::text_x_offset, text_x_offset_, gui2::ttext_box_definition::tresolution::text_y_offset, and text_y_offset_.
Referenced by load_config_extra(), and set_size().
std::vector<unsigned> gui2::ttext_box::character_offset_ [private] |
Contains the end offset of each character in the text area.
Definition at line 142 of file text_box.hpp.
Referenced by calculate_char_offset(), get_character_offset_at(), insert_char(), and set_canvas_text().
ttext_history gui2::ttext_box::history_ [private] |
Definition at line 151 of file text_box.hpp.
Referenced by handle_key_down_arrow(), handle_key_up_arrow(), save_to_history(), and set_history().
unsigned gui2::ttext_box::text_x_offset_ [private] |
Definition at line 160 of file text_box.hpp.
Referenced by handle_mouse_selection(), set_canvas_text(), and update_offsets().
unsigned gui2::ttext_box::text_y_offset_ [private] |
Definition at line 161 of file text_box.hpp.
Referenced by handle_mouse_selection(), set_canvas_text(), and update_offsets().
unsigned gui2::ttext_box::text_height_ [private] |
Definition at line 162 of file text_box.hpp.
Referenced by handle_mouse_selection(), and update_offsets().
bool gui2::ttext_box::dragging_ [private] |
Is the mouse in dragging mode, this affects selection in mouse movee.
Reimplemented from gui2::ttext_.
Definition at line 167 of file text_box.hpp.
Referenced by handle_mouse_selection(), mouse_left_button_up(), and mouse_move().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |