gui2::ttext_history Class Reference

Class for text input history. More...

#include <text_box.hpp>

Collaboration diagram for gui2::ttext_history:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ttext_history ()
void push (const std::string &text)
 Push string into the history if it is non-empty and is not the same as the last item updates position to end of history.
std::string up (const std::string &text="")
 One step up/down in history. Pushes text to the history if at the end.
std::string down (const std::string &text="")
std::string get_value () const
 Returns the value at the current history position.
void set_enabled (bool enabled=true)
bool get_enabled () const

Static Public Member Functions

static ttext_history get_history (const std::string &id, const bool enabled)
 Gets history that matches id and enables or disables it.

Private Member Functions

 ttext_history (std::vector< std::string > *history, const bool enabled)

Private Attributes

std::vector< std::string > * history_
unsigned pos_
bool enabled_


Detailed Description

Class for text input history.

Definition at line 24 of file text_box.hpp.


Constructor & Destructor Documentation

gui2::ttext_history::ttext_history (  )  [inline]

Definition at line 31 of file text_box.hpp.

Referenced by get_history().

gui2::ttext_history::ttext_history ( std::vector< std::string > *  history,
const bool  enabled 
) [inline, private]

Definition at line 54 of file text_box.hpp.


Member Function Documentation

ttext_history gui2::ttext_history::get_history ( const std::string &  id,
const bool  enabled 
) [static]

Gets history that matches id and enables or disables it.

Definition at line 337 of file text_box.cpp.

References preferences::get_history(), and ttext_history().

void gui2::ttext_history::push ( const std::string &  text  ) 

Push string into the history if it is non-empty and is not the same as the last item updates position to end of history.

Definition at line 343 of file text_box.cpp.

References enabled_, history_, and pos_.

Referenced by down(), gui2::ttext_box::save_to_history(), and up().

std::string gui2::ttext_history::up ( const std::string &  text = ""  ) 

One step up/down in history. Pushes text to the history if at the end.

Definition at line 356 of file text_box.cpp.

References enabled_, get_value(), history_, pos_, and push().

Referenced by gui2::ttext_box::handle_key_up_arrow().

std::string gui2::ttext_history::down ( const std::string &  text = ""  ) 

Definition at line 375 of file text_box.cpp.

References enabled_, get_value(), history_, pos_, and push().

Referenced by gui2::ttext_box::handle_key_down_arrow().

std::string gui2::ttext_history::get_value (  )  const

Returns the value at the current history position.

Returns "" if not enabled or if at the end of the history.

Definition at line 388 of file text_box.cpp.

References enabled_, history_, and pos_.

Referenced by down(), and up().

void gui2::ttext_history::set_enabled ( bool  enabled = true  )  [inline]

Definition at line 50 of file text_box.hpp.

References enabled_.

bool gui2::ttext_history::get_enabled (  )  const [inline]


Member Data Documentation

std::vector<std::string>* gui2::ttext_history::history_ [private]

Definition at line 60 of file text_box.hpp.

Referenced by down(), get_value(), push(), and up().

unsigned gui2::ttext_history::pos_ [private]

Definition at line 61 of file text_box.hpp.

Referenced by down(), get_value(), push(), and up().

Definition at line 63 of file text_box.hpp.

Referenced by down(), get_enabled(), get_value(), push(), set_enabled(), and up().


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