Class for a single line text area. More...
#include <text_box.hpp>


Public Member Functions | |
| ttext_box () | |
| void | save_to_history () |
| Saves the text in the widget to the history. | |
| void | set_history (const std::string &id) |
Protected Member Functions | |
| void | place (const tpoint &origin, const tpoint &size) |
| Inherited from tcontrol. | |
| void | update_canvas () |
| Inherited from tcontrol. | |
| void | goto_end_of_line (const bool select=false) |
| Inherited from ttext_. | |
| void | goto_start_of_line (const bool select=false) |
| Inherited from ttext_. | |
| void | delete_char (const bool before_cursor) |
| Inherited from ttext_. | |
| void | delete_selection () |
| Inherited from ttext_. | |
| void | handle_mouse_selection (tpoint mouse, const bool start_selection) |
Private Member Functions | |
| void | update_offsets () |
| Updates text_x_offset_ and text_y_offset_. | |
| void | handle_key_up_arrow (SDLMod, bool &) |
| Inherited from ttext_. | |
| void | handle_key_down_arrow (SDLMod, bool &) |
| Inherited from ttext_. | |
| bool | history_up () |
| Goes one item up in the history. | |
| bool | history_down () |
| Goes one item down in the history. | |
| void | handle_key_default (bool &handled, SDLKey key, SDLMod modifier, Uint16 unicode) |
| Inherited from ttext_. | |
| void | handle_key_clear_line (SDLMod modifier, bool &handled) |
| Inherited from ttext_. | |
| const std::string & | get_control_type () const |
| Inherited from tcontrol. | |
| void | load_config_extra () |
| Inherited from tcontrol. | |
| void | signal_handler_mouse_motion (const event::tevent event, bool &handled, const tpoint &coordinate) |
| void | signal_handler_left_button_down (const event::tevent event, bool &handled) |
| void | signal_handler_left_button_up (const event::tevent event, bool &handled) |
| void | signal_handler_left_button_double_click (const event::tevent event, bool &handled) |
Private Attributes | |
| ttext_history | history_ |
| The history text for this widget. | |
| unsigned | text_x_offset_ |
| The x offset in the widget where the text starts. | |
| unsigned | text_y_offset_ |
| The y offset in the widget where the text starts. | |
| unsigned | text_height_ |
| The height of the text itself. | |
| bool | dragging_ |
| Is the mouse in dragging mode, this affects selection in mouse move. | |
Class for a single line text area.
Definition at line 114 of file text_box.hpp.
| gui2::ttext_box::ttext_box | ( | ) |
Definition at line 97 of file text_box.cpp.
References gui2::tevent_executor::set_wants_mouse_left_double_click(), signal_handler_left_button_double_click(), signal_handler_left_button_down(), signal_handler_left_button_up(), and signal_handler_mouse_motion().

| void gui2::ttext_box::delete_char | ( | const bool | before_cursor | ) | [protected, virtual] |
Inherited from ttext_.
Implements gui2::ttext_.
Reimplemented in gui2::tpassword_box.
Definition at line 182 of file text_box.cpp.
References delete_selection(), gui2::ttext_::get_selection_start(), gui2::ttext_::set_cursor(), and gui2::ttext_::set_selection_length().

| void gui2::ttext_box::delete_selection | ( | ) | [protected, virtual] |
Inherited from ttext_.
Implements gui2::ttext_.
Definition at line 193 of file text_box.cpp.
References gui2::ttext_::get_selection_length(), gui2::ttext_::get_selection_start(), gui2::ttext_::get_value(), gui2::ttext_::set_cursor(), gui2::ttext_::set_value(), editor::start(), utils::string_to_wstring(), gui2::ttext_::text(), and utils::wstring_to_string().
Referenced by delete_char(), gui2::tpassword_box::handle_key_backspace(), and gui2::tpassword_box::handle_key_delete().


| const std::string & gui2::ttext_box::get_control_type | ( | ) | const [private, virtual] |
Inherited from tcontrol.
Implements gui2::tcontrol.
Reimplemented in gui2::tpassword_box.
Definition at line 337 of file text_box.cpp.
References type.
Referenced by signal_handler_mouse_motion().

| void gui2::ttext_box::goto_end_of_line | ( | const bool | select = false |
) | [inline, protected, virtual] |
Inherited from ttext_.
Implements gui2::ttext_.
Definition at line 140 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] |
Inherited from ttext_.
Implements gui2::ttext_.
Definition at line 144 of file text_box.hpp.
References gui2::ttext_::goto_start_of_data().

| void gui2::ttext_box::handle_key_clear_line | ( | SDLMod | modifier, | |
| bool & | handled | |||
| ) | [private, virtual] |
Inherited from ttext_.
Implements gui2::ttext_.
Definition at line 314 of file text_box.cpp.
References gui2::ttext_::set_value().

| void gui2::ttext_box::handle_key_default | ( | bool & | handled, | |
| SDLKey | key, | |||
| SDLMod | modifier, | |||
| Uint16 | unicode | |||
| ) | [private, virtual] |
Inherited from ttext_.
Reimplemented from gui2::ttext_.
Definition at line 297 of file text_box.cpp.
References history_down(), and history_up().

| void gui2::ttext_box::handle_key_down_arrow | ( | SDLMod | , | |
| bool & | ||||
| ) | [inline, private, virtual] |
Inherited from ttext_.
Unmodified Unhandled. Control Ignored. Shift Ignored. Alt Ignored.
Implements gui2::ttext_.
Definition at line 205 of file text_box.hpp.
| void gui2::ttext_box::handle_key_up_arrow | ( | SDLMod | , | |
| bool & | ||||
| ) | [inline, private, virtual] |
Inherited from ttext_.
Unmodified Unhandled. Control Ignored. Shift Ignored. Alt Ignored.
Implements gui2::ttext_.
Definition at line 195 of file text_box.hpp.
| void gui2::ttext_box::handle_mouse_selection | ( | tpoint | mouse, | |
| const bool | start_selection | |||
| ) | [protected] |
Definition at line 216 of file text_box.cpp.
References dragging_, gui2::ttext_::get_column_line(), gui2::twidget::get_x(), gui2::twidget::get_y(), gui2::ttext_::set_cursor(), gui2::twidget::set_dirty(), text_height_, text_x_offset_, text_y_offset_, update_canvas(), gui2::tpoint::x, and gui2::tpoint::y.
Referenced by signal_handler_left_button_down(), and signal_handler_mouse_motion().


| bool gui2::ttext_box::history_down | ( | ) | [private] |
Goes one item down in the history.
Definition at line 284 of file text_box.cpp.
References gui2::ttext_history::down(), gui2::ttext_history::get_enabled(), gui2::ttext_::get_value(), history_, and gui2::ttext_::set_value().
Referenced by handle_key_default().


| bool gui2::ttext_box::history_up | ( | ) | [private] |
Goes one item up in the history.
Definition at line 271 of file text_box.cpp.
References gui2::ttext_history::get_enabled(), gui2::ttext_::get_value(), history_, gui2::ttext_::set_value(), and gui2::ttext_history::up().
Referenced by handle_key_default().


| void gui2::ttext_box::load_config_extra | ( | ) | [private, virtual] |
Inherited from tcontrol.
Reimplemented from gui2::tcontrol.
Definition at line 321 of file text_box.cpp.
References gui2::tcontrol::config(), gui2::ttext_::set_font_size(), gui2::ttext_::set_font_style(), and update_offsets().

Inherited from tcontrol.
Reimplemented from gui2::tcontrol.
Definition at line 117 of file text_box.cpp.
References gui2::tcontrol::get_text_maximum_height(), gui2::tcontrol::get_text_maximum_width(), gui2::ttext_::set_maximum_height(), gui2::ttext_::set_maximum_width(), and update_offsets().

| void gui2::ttext_box::save_to_history | ( | ) | [inline] |
Saves the text in the widget to the history.
Definition at line 120 of file text_box.hpp.
References gui2::ttext_::get_value(), history_, and gui2::ttext_history::push().
Referenced by gui2::tfield_text::finalize_specialized(), gui2::tmp_method_selection::post_show(), gui2::taddon_connect::post_show(), and gui2::tlobby_main::send_message_button_callback().


| void gui2::ttext_box::set_history | ( | const std::string & | id | ) | [inline] |
Definition at line 124 of file text_box.hpp.
References preferences::get_history(), and history_.

| void gui2::ttext_box::signal_handler_left_button_double_click | ( | const event::tevent | event, | |
| bool & | handled | |||
| ) | [private] |
Definition at line 381 of file text_box.cpp.
References DBG_GUI_E, LOG_HEADER, and gui2::ttext_::select_all().
Referenced by ttext_box().


| void gui2::ttext_box::signal_handler_left_button_down | ( | const event::tevent | event, | |
| bool & | handled | |||
| ) | [private] |
Definition at line 355 of file text_box.cpp.
References DBG_GUI_E, gui2::get_mouse_position(), gui2::twidget::get_window(), handle_mouse_selection(), gui2::twindow::keyboard_capture(), LOG_HEADER, and gui2::twindow::mouse_capture().
Referenced by ttext_box().


| void gui2::ttext_box::signal_handler_left_button_up | ( | const event::tevent | event, | |
| bool & | handled | |||
| ) | [private] |
Definition at line 372 of file text_box.cpp.
References DBG_GUI_E, dragging_, and LOG_HEADER.
Referenced by ttext_box().

| void gui2::ttext_box::signal_handler_mouse_motion | ( | const event::tevent | event, | |
| bool & | handled, | |||
| const tpoint & | coordinate | |||
| ) | [private] |
Definition at line 343 of file text_box.cpp.
References DBG_GUI_E, dragging_, get_control_type(), handle_mouse_selection(), and gui2::twidget::id().
Referenced by ttext_box().


| void gui2::ttext_box::update_canvas | ( | ) | [protected, virtual] |
Inherited from tcontrol.
Reimplemented from gui2::tcontrol.
Definition at line 128 of file text_box.cpp.
References gui2::twidget::can_wrap(), gui2::tcontrol::canvas(), gui2::ttext_::get_cursor_position(), gui2::ttext_::get_length(), gui2::ttext_::get_selection_length(), gui2::ttext_::get_selection_start(), gui2::tcontrol::get_text_maximum_height(), gui2::tcontrol::get_text_maximum_width(), gui2::ttext_::get_value(), gui2::ttext_::set_ellipse_mode(), gui2::tcanvas::set_variable(), editor::start(), text_x_offset_, text_y_offset_, and gui2::tpoint::x.
Referenced by handle_mouse_selection(), gui2::tpassword_box::post_function(), and update_offsets().


| void gui2::ttext_box::update_offsets | ( | ) | [private] |
Updates text_x_offset_ and text_y_offset_.
Definition at line 241 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(), gui2::tcanvas::set_variable(), text_height_, text_x_offset_, text_y_offset_, and update_canvas().
Referenced by load_config_extra(), and place().


bool gui2::ttext_box::dragging_ [private] |
Is the mouse in dragging mode, this affects selection in mouse move.
Definition at line 185 of file text_box.hpp.
Referenced by handle_mouse_selection(), signal_handler_left_button_up(), and signal_handler_mouse_motion().
ttext_history gui2::ttext_box::history_ [private] |
The history text for this widget.
Definition at line 157 of file text_box.hpp.
Referenced by history_down(), history_up(), save_to_history(), and set_history().
unsigned gui2::ttext_box::text_height_ [private] |
The height of the text itself.
Needed to determine whether a click is on the text.
Definition at line 179 of file text_box.hpp.
Referenced by handle_mouse_selection(), and update_offsets().
unsigned gui2::ttext_box::text_x_offset_ [private] |
The x offset in the widget where the text starts.
This value is needed to translate a location in the widget to a location in the text.
Definition at line 165 of file text_box.hpp.
Referenced by handle_mouse_selection(), update_canvas(), and update_offsets().
unsigned gui2::ttext_box::text_y_offset_ [private] |
The y offset in the widget where the text starts.
Needed to determine whether a click is on the text.
Definition at line 172 of file text_box.hpp.
Referenced by handle_mouse_selection(), update_canvas(), and update_offsets().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:23:31 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |