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


Detailed Description

Class for a single line text area.

Definition at line 67 of file text_box.hpp.


Constructor & Destructor Documentation

gui2::ttext_box::ttext_box (  )  [inline]


Member Function Documentation

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]

void gui2::ttext_box::save_to_history ( const std::string &  text  )  [inline]

Definition at line 88 of file text_box.hpp.

References history_, and gui2::ttext_history::push().

void gui2::ttext_box::insert_char ( Uint16  unicode  )  [protected, virtual]

void gui2::ttext_box::delete_char ( const bool  before_cursor  )  [protected, virtual]

Inherited from ttext_.

Deletes the character.

Parameters:
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]

void gui2::ttext_box::set_canvas_text (  )  [protected, virtual]

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]

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.

References DBG_G_E, and dragging_.

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]

void gui2::ttext_box::handle_key_down_arrow ( SDLMod  modifier,
bool &  handled 
) [private, virtual]

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]

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]


Member Data Documentation

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

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

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


The documentation for this class was generated from the following files:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs