Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

gui2::ttext_box Class Reference

Class for a single line text area. More...

#include <text_box.hpp>

Inheritance diagram for gui2::ttext_box:
Inheritance graph
[legend]
Collaboration diagram for gui2::ttext_box:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

Class for a single line text area.

Definition at line 114 of file text_box.hpp.


Constructor & Destructor Documentation

gui2::ttext_box::ttext_box (  ) 

Member Function Documentation

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().

Here is the call graph for this function:

void gui2::ttext_box::delete_selection (  )  [protected, virtual]
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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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]
bool gui2::ttext_box::history_down (  )  [private]

Goes one item down in the history.

Returns:
True if there's a history, false otherwise.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool gui2::ttext_box::history_up (  )  [private]

Goes one item up in the history.

Returns:
True if there's a history, false otherwise.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

void gui2::ttext_box::place ( const tpoint origin,
const tpoint size 
) [protected, virtual]

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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_.

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::ttext_box::update_canvas (  )  [protected, virtual]
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().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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().

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().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:23:31 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs